opd_proc.h File Reference

Management of processes. More...

#include "op_types.h"
#include "op_list.h"
Include dependency graph for opd_proc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  opd_proc
 track process, created either by a fork or an exec notification. More...

Functions

void opd_init_procs (void)
 initialize opd_proc container
void opd_put_sample (struct op_sample const *sample)
 opd_put_sample - process a sample
void opd_put_image_sample (struct opd_image *image, unsigned long offset, u32 counter)
 opd_put_image_sample - write sample to file
void opd_handle_fork (struct op_note const *note)
 opd_handle_fork - deal with fork notification
void opd_handle_exec (pid_t tid, pid_t tgid)
 opd_handle_exec - deal with notification of execve()
void opd_handle_exit (struct op_note const *note)
 opd_handle_exit - deal with exit notification
struct opd_procopd_get_proc (pid_t tid, pid_t tgid)
 opd_get_proc - get process from process list
struct opd_procopd_new_proc (pid_t tid, pid_t tgid)
 opd_new_proc - create a new process structure
int opd_get_nr_procs (void)
 opd_get_nr_procs - return number of processes tracked
void opd_age_procs (void)
 opd_age_procs - age all dead process preparing them for a deletion
void opd_proc_cleanup (void)
 freeze all resource used by opd_procs managment
void opd_clear_kernel_mapping (void)
 opd_clear_kernel_mapping - remove all kernel mapping for all opd_proc

Detailed Description

Management of processes.

Remarks:
Copyright 2002 OProfile authors
Read the file COPYING
Author:
John Levon
Philippe Elie

Function Documentation

void opd_age_procs ( void   ) 

opd_age_procs - age all dead process preparing them for a deletion

void opd_clear_kernel_mapping ( void   ) 

opd_clear_kernel_mapping - remove all kernel mapping for all opd_proc

invalidate (by removing them) all kernel mapping. This function do nothing when separate_kernel == 0 because we don't add mapping for kernel sample in proc struct. As side effect decrease reference count of associated with these mapping which eventually close this image

Referenced by opd_clear_module_info().

int opd_get_nr_procs ( void   ) 

opd_get_nr_procs - return number of processes tracked

Referenced by opd_print_24_stats().

struct opd_proc* opd_get_proc ( pid_t  tid,
pid_t  tgid 
) [read]

opd_get_proc - get process from process list

Parameters:
tid tid for this process
tgid tgid for this process

A process with pid tid is searched on the process list, maintaining LRU order. If it is not found, NULL is returned, otherwise the process structure is returned.

References list_entry, list_for_each_safe, opd_proc::next, list_head::next, opd_24_stats, OPD_PROC_QUEUE_ACCESS, OPD_PROC_QUEUE_DEPTH, opd_proc::tgid, and opd_proc::tid.

Referenced by opd_get_ascii_procs(), opd_handle_exec(), opd_handle_exit(), opd_handle_fork(), opd_handle_mapping(), and opd_put_sample().

void opd_handle_exec ( pid_t  tid,
pid_t  tgid 
)

opd_handle_exec - deal with notification of execve()

Parameters:
tid tid for this process
tgid tgid for this process

Drop all mapping information for the process.

References opd_proc::name, opd_get_proc(), opd_kill_maps(), opd_new_proc(), verbprintf, and vmisc.

void opd_handle_exit ( struct op_note const *  note  ) 

opd_handle_exit - deal with exit notification

Parameters:
note note to handle

Deal with an exit() notification by setting the flag "dead" on a process. These will be later cleaned up by the SIGALRM handler.

sample->pid contains the process id of the exited process.

References opd_proc::accessed, opd_proc::dead, opd_get_proc(), op_note::pid, op_note::tgid, verbprintf, and vmisc.

void opd_handle_fork ( struct op_note const *  note  ) 

opd_handle_fork - deal with fork notification

Parameters:
note note to handle

Deal with a fork() notification by creating a new process structure, and copying mapping information from the old process.

sample->pid contains the process id of the old process. sample->eip contains the process id of the new process.

References op_note::addr, opd_map::end, opd_map::image, opd_image::kernel, op_note::len, list_entry, list_for_each, opd_proc::maps, opd_proc::name, opd_image::name, opd_map::next, opd_map::offset, opd_add_mapping(), opd_get_image(), opd_get_proc(), opd_new_proc(), op_note::pid, separate_thread, opd_map::start, op_note::tgid, verbprintf, and vmisc.

void opd_init_procs ( void   ) 

initialize opd_proc container

References OPD_MAX_PROC_HASH.

struct opd_proc* opd_new_proc ( pid_t  tid,
pid_t  tgid 
) [read]

opd_new_proc - create a new process structure

Parameters:
tid tid for this process
tgid tgid for this process

Allocate and initialise a process structure and insert it into the procs hash table.

References opd_proc::accessed, opd_proc::dead, opd_proc::maps, opd_proc::name, opd_proc::next, opd_proc::tgid, and opd_proc::tid.

Referenced by opd_get_ascii_procs(), opd_handle_exec(), opd_handle_fork(), and opd_handle_mapping().

void opd_proc_cleanup ( void   ) 

freeze all resource used by opd_procs managment

void opd_put_image_sample ( struct opd_image image,
unsigned long  offset,
u32  counter 
)

opd_put_image_sample - write sample to file

Parameters:
image image for sample
offset (file) offset to write to
counter counter number

Add to the count stored at position offset in the image file. Overflow pins the count at the maximum value.

References cpu_number, opd_image::ignored, odb_open_count(), odb_update_node(), OP_MAX_COUNTERS, opd_24_sfile_lru(), opd_24_stats, OPD_LOST_SAMPLEFILE, opd_open_24_sample_file(), opd_24_sfile::sample_file, and opd_image::sfiles.

Referenced by opd_handle_kernel_sample().

void opd_put_sample ( struct op_sample const *  sample  ) 

opd_put_sample - process a sample

Parameters:
sample sample to process

Write out the sample to the appropriate sample file. This routine handles kernel and module samples as well as ordinary ones.

References op_sample::counter, op_sample::eip, no_vmlinux, opd_24_stats, opd_add_kernel_map(), opd_eip_is_kernel(), opd_get_proc(), opd_handle_kernel_sample(), OPD_LOST_MAP_PROCESS, OPD_LOST_PROCESS, OPD_SAMPLES, op_sample::pid, separate_kernel, op_sample::tgid, verbprintf, vmisc, and vsamples.

Referenced by opd_process_samples().


Generated on 27 Aug 2012 for oprofile by  doxygen 1.6.1