#include "op_types.h"
#include "op_list.h"
Go to the source code of this file.
Data Structures | |
struct | opd_proc |
Functions | |
void | opd_init_procs (void) |
void | opd_put_sample (struct op_sample const *sample) |
void | opd_put_image_sample (struct opd_image *image, unsigned long offset, u32 counter) |
void | opd_handle_fork (struct op_note const *note) |
void | opd_handle_exec (pid_t tid, pid_t tgid) |
void | opd_handle_exit (struct op_note const *note) |
struct opd_proc * | opd_get_proc (pid_t tid, pid_t tgid) |
struct opd_proc * | opd_new_proc (pid_t tid, pid_t tgid) |
int | opd_get_nr_procs (void) |
void | opd_age_procs (void) |
void | opd_proc_cleanup (void) |
void | opd_clear_kernel_mapping (void) |
Management of processes
Definition in file opd_proc.h.
void opd_age_procs | ( | void | ) |
opd_age_procs - age all dead process preparing them for a deletion
Definition at line 400 of file opd_proc.c.
References opd_age_proc(), and opd_for_each_proc().
Referenced by opd_alarm().
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
Definition at line 429 of file opd_proc.c.
References opd_for_each_proc(), and opd_remove_kernel_mapping().
Referenced by opd_clear_module_info().
int opd_get_nr_procs | ( | void | ) |
opd_get_nr_procs - return number of processes tracked
Definition at line 50 of file opd_proc.c.
References nr_procs.
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
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.
Definition at line 85 of file opd_proc.c.
References list_add(), list_del(), list_entry, list_for_each_safe, opd_proc::next, list_head::next, opd_24_stats, OPD_PROC_QUEUE_ACCESS, OPD_PROC_QUEUE_DEPTH, opd_procs, proc_hash(), 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()
tid | tid for this process | |
tgid | tgid for this process |
Drop all mapping information for the process.
Definition at line 286 of file opd_proc.c.
References opd_proc::name, opd_get_proc(), opd_kill_maps(), opd_new_proc(), verbprintf, and vmisc.
Referenced by opd_do_notes().
void opd_handle_exit | ( | struct op_note const * | note | ) |
opd_handle_exit - deal with exit notification
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.
Definition at line 317 of file opd_proc.c.
References opd_proc::accessed, opd_proc::dead, opd_get_proc(), op_note::pid, op_note::tgid, verbprintf, and vmisc.
Referenced by opd_do_notes().
void opd_handle_fork | ( | struct op_note const * | note | ) |
opd_handle_fork - deal with fork notification
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.
Definition at line 238 of file opd_proc.c.
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.
Referenced by opd_do_notes().
void opd_init_procs | ( | void | ) |
initialize opd_proc container
Definition at line 42 of file opd_proc.c.
References list_init(), OPD_MAX_PROC_HASH, and opd_procs.
Referenced by opd_24_init().
struct opd_proc* opd_new_proc | ( | pid_t | tid, | |
pid_t | tgid | |||
) | [read] |
opd_new_proc - create a new process structure
tid | tid for this process | |
tgid | tgid for this process |
Allocate and initialise a process structure and insert it into the procs hash table.
Definition at line 68 of file opd_proc.c.
References opd_proc::accessed, opd_proc::dead, list_add(), list_init(), opd_proc::maps, opd_proc::name, opd_proc::next, nr_procs, opd_procs, proc_hash(), 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
Definition at line 375 of file opd_proc.c.
References opd_delete_proc(), and opd_for_each_proc().
Referenced by opd_24_exit().
opd_put_image_sample - write sample to file
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.
Definition at line 122 of file opd_proc.c.
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(), opd_handle_module_sample(), and opd_lookup_maps().
void opd_put_sample | ( | struct op_sample const * | sample | ) |
opd_put_sample - process a sample
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.
Definition at line 190 of file opd_proc.c.
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_lookup_maps(), OPD_LOST_MAP_PROCESS, OPD_LOST_PROCESS, OPD_SAMPLES, op_sample::pid, separate_kernel, op_sample::tgid, verbprintf, vmisc, and vsamples.
Referenced by opd_do_samples(), and opd_process_samples().