init.c File Reference

#include "config.h"
#include "opd_proc.h"
#include "opd_mapping.h"
#include "opd_24_stats.h"
#include "opd_sample_files.h"
#include "opd_image.h"
#include "opd_parse_proc.h"
#include "opd_kernel.h"
#include "opd_printf.h"
#include "oprofiled.h"
#include "op_sample_file.h"
#include "op_config_24.h"
#include "op_interface.h"
#include "op_libiberty.h"
#include "op_deviceio.h"
#include "op_events.h"
#include "op_get_time.h"
#include "op_fileio.h"
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
Include dependency graph for init.c:

Go to the source code of this file.

Functions

static void opd_sighup (void)
static void opd_alarm (void)
static void opd_sigterm (void)
static void op_open_files (void)
static void opd_do_samples (struct op_buffer_head const *buf)
static void opd_do_notes (struct op_note const *opd_buf, size_t count)
static void opd_shutdown (struct op_buffer_head *buf, size_t size, struct op_note *nbuf, size_t nsize)
static void opd_do_read (struct op_buffer_head *buf, size_t size, struct op_note *nbuf, size_t nsize)
static void clean_exit (void)
static void opd_24_init (void)
static void opd_24_start (void)
static void opd_24_exit (void)

Variables

fd_t hashmapdevfd
int cpu_number
static fd_t devfd
static fd_t notedevfd
static struct op_buffer_headsbuf
static size_t s_buf_bytesize
static struct op_notenbuf
static size_t n_buf_bytesize
struct oprofiled_ops opd_24_ops

Detailed Description

Daemon set up and main loop for 2.4

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

Definition in file init.c.


Function Documentation

static void clean_exit ( void   )  [static]

Definition at line 309 of file init.c.

References op_free_events(), op_lock_file, and opd_cleanup_hash_name().

Referenced by opd_24_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void op_open_files ( void   )  [static]

op_open_files - open necessary files

Open the device files and the log file, and mmap() the hash map.

Definition at line 61 of file init.c.

References devfd, hashmapdevfd, notedevfd, op_device, op_get_time(), op_hash_device, op_log_file, op_note_device, op_open_device(), opd_init_hash_map(), and opd_open_logfile().

Referenced by opd_24_start().

Here is the call graph for this function:

Here is the caller graph for this function:

static void opd_24_exit ( void   )  [static]

Definition at line 369 of file init.c.

References op_get_time(), opd_clear_module_info(), opd_delete_image(), opd_for_each_image(), opd_print_24_stats(), and opd_proc_cleanup().

Here is the call graph for this function:

static void opd_24_init ( void   )  [static]
static void opd_24_start ( void   )  [static]

Definition at line 357 of file init.c.

References n_buf_bytesize, op_open_files(), opd_do_read(), opd_get_ascii_procs(), and s_buf_bytesize.

Here is the call graph for this function:

static void opd_alarm ( void   )  [static]

opd_alarm - clean up old procs, msync, and report stats

Definition at line 285 of file init.c.

References opd_age_procs(), opd_print_24_stats(), and opd_sync_samples_files().

Referenced by opd_do_read().

Here is the call graph for this function:

Here is the caller graph for this function:

static void opd_do_notes ( struct op_note const *  opd_buf,
size_t  count 
) [static]

opd_do_notes - process a notes buffer

Parameters:
opd_buf buffer to process
count number of bytes in buffer

Process a buffer of notes.

Definition at line 212 of file init.c.

References OP_DROP_MODULES, OP_EXEC, OP_EXIT, OP_FORK, OP_MAP, opd_24_stats, opd_clear_module_info(), opd_handle_exec(), opd_handle_exit(), opd_handle_fork(), opd_handle_mapping(), OPD_NOTIFICATIONS, op_note::pid, op_note::tgid, and op_note::type.

Referenced by opd_do_read(), and opd_shutdown().

Here is the call graph for this function:

Here is the caller graph for this function:

static void opd_do_read ( struct op_buffer_head buf,
size_t  size,
struct op_note nbuf,
size_t  nsize 
) [static]

opd_do_read - enter processing loop

Parameters:
buf buffer to read into
size size of buffer
nbuf note buffer
nsize size of note buffer

Read some of a buffer from the device and process the contents.

Definition at line 165 of file init.c.

References devfd, notedevfd, op_read_device(), opd_alarm(), opd_do_notes(), opd_do_samples(), opd_shutdown(), opd_sighup(), opd_sigterm(), signal_alarm, signal_hup, signal_term, op_buffer_head::state, STOPPING, verbprintf, and vmisc.

Referenced by opd_24_start().

Here is the call graph for this function:

Here is the caller graph for this function:

static void opd_do_samples ( struct op_buffer_head const *  opd_buf  )  [static]

opd_do_samples - process a sample buffer

Parameters:
opd_buf buffer to process

Process a buffer of samples. The signals specified by the global variable maskset are masked.

If the sample could be processed correctly, it is written to the relevant sample file. Additionally mapping and process notifications are handled here.

Definition at line 262 of file init.c.

References op_buffer_head::buffer, buffer, op_buffer_head::count, op_buffer_head::cpu_nr, cpu_number, op_sample::eip, opd_24_stats, OPD_DUMP_COUNT, opd_put_sample(), pid, separate_cpu, verbprintf, vmisc, and vsamples.

Referenced by opd_do_read(), and opd_shutdown().

Here is the call graph for this function:

Here is the caller graph for this function:

static void opd_shutdown ( struct op_buffer_head buf,
size_t  size,
struct op_note nbuf,
size_t  nsize 
) [static]

do_shutdown - shutdown cleanly, reading as much remaining data as possible.

Parameters:
buf sample buffer area
size size of sample buffer
nbuf note buffer area
nsize size of note buffer

Definition at line 120 of file init.c.

References devfd, notedevfd, op_read_device(), opd_do_notes(), opd_do_samples(), op_buffer_head::state, verbprintf, and vmisc.

Referenced by opd_do_read().

Here is the call graph for this function:

Here is the caller graph for this function:

static void opd_sighup ( void   )  [static]

Definition at line 298 of file init.c.

References opd_close_image_samples_files(), opd_for_each_image(), and opd_open_logfile().

Referenced by opd_do_read().

Here is the call graph for this function:

Here is the caller graph for this function:

static void opd_sigterm ( void   )  [static]

Definition at line 317 of file init.c.

References op_get_time(), and opd_print_24_stats().

Referenced by opd_do_read().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 41 of file init.c.

Referenced by opd_do_samples(), and opd_put_image_sample().

fd_t devfd [static]

Definition at line 43 of file init.c.

Referenced by op_open_files(), opd_do_read(), and opd_shutdown().

Definition at line 39 of file init.c.

Referenced by op_open_files(), and opd_init_hash_map().

size_t n_buf_bytesize [static]

Definition at line 48 of file init.c.

Referenced by opd_24_init(), and opd_24_start().

struct op_note* nbuf [static]

Definition at line 47 of file init.c.

fd_t notedevfd [static]

Definition at line 44 of file init.c.

Referenced by op_open_files(), opd_do_read(), and opd_shutdown().

Initial value:
 {
    .init = opd_24_init,
    .start = opd_24_start,
    .exit = opd_24_exit
}

Definition at line 383 of file init.c.

Referenced by get_ops().

size_t s_buf_bytesize [static]

Definition at line 46 of file init.c.

Referenced by opd_24_init(), and opd_24_start().

struct op_buffer_head* sbuf [static]

Definition at line 45 of file init.c.


Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1