operf_sfile.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include "operf_sfile.h"
#include "operf_kernel.h"
#include "operf_utils.h"
#include "cverb.h"
#include "op_string.h"
#include "operf_mangling.h"
#include "operf_stats.h"
#include "op_libiberty.h"
Include dependency graph for operf_sfile.cpp:

Go to the source code of this file.

Defines

#define HASH_SIZE   2048
#define HASH_BITS   (HASH_SIZE - 1)
#define LRU_AMOUNT   256

Typedefs

typedef int(* operf_sfile_func )(struct operf_sfile *, void *)

Functions

static LIST_HEAD (lru_list)
static unsigned long sfile_hash (struct operf_transient const *trans, struct operf_kernel_image *ki)
static int do_match (struct operf_sfile const *sf, struct operf_kernel_image const *ki, bool is_anon, const char *image_name, size_t image_len, const char *appname, size_t app_len, pid_t tgid, pid_t tid, unsigned int cpu)
int operf_sfile_equal (struct operf_sfile const *sf, struct operf_sfile const *sf2)
static struct operf_sfilecreate_sfile (unsigned long hash, struct operf_transient const *trans, struct operf_kernel_image *ki)
struct operf_sfileoperf_sfile_find (struct operf_transient const *trans)
void operf_sfile_dup (struct operf_sfile *to, struct operf_sfile *from)
static odb_tget_file (struct operf_transient const *trans, int is_cg)
static void verbose_print_sample (struct operf_sfile *sf, vma_t pc, uint counter)
static void verbose_sample (struct operf_transient const *trans, vma_t pc)
static void verbose_arc (struct operf_transient const *trans, vma_t from, vma_t to)
void operf_sfile_log_arc (struct operf_transient const *trans)
void operf_sfile_log_sample (struct operf_transient const *trans)
void operf_sfile_log_sample_count (struct operf_transient const *trans, unsigned long int count)
static int close_sfile (struct operf_sfile *sf, void *data __attribute__((unused)))
static void kill_sfile (struct operf_sfile *sf)
static int sync_sfile (struct operf_sfile *sf, void *data __attribute__((unused)))
static int is_sfile_kernel (struct operf_sfile *sf, void *data __attribute__((unused)))
static void for_one_sfile (struct operf_sfile *sf, operf_sfile_func func, void *data)
static void for_each_sfile (operf_sfile_func func, void *data)
void operf_sfile_clear_kernel (void)
void operf_sfile_sync_files (void)
static int _release_resources (struct operf_sfile *sf __attribute__((unused)), void *p __attribute__((unused)))
void operf_sfile_close_files (void)
static int always_true (void)
int operf_sfile_lru_clear (void)
void operf_sfile_get (struct operf_sfile *sf)
void operf_sfile_put (struct operf_sfile *sf)
void operf_sfile_init (void)

Variables

static struct list_head hashes [HASH_SIZE]

Define Documentation

#define HASH_BITS   (HASH_SIZE - 1)

Definition at line 28 of file operf_sfile.cpp.

#define HASH_SIZE   2048

Definition at line 27 of file operf_sfile.cpp.

#define LRU_AMOUNT   256

Definition at line 520 of file operf_sfile.cpp.


Typedef Documentation

typedef int(* operf_sfile_func)(struct operf_sfile *, void *)

Definition at line 451 of file operf_sfile.cpp.


Function Documentation

static int _release_resources ( struct operf_sfile *sf   __attribute__(unused),
void *p   __attribute__(unused) 
) [static]

Definition at line 503 of file operf_sfile.cpp.

Referenced by operf_sfile_close_files().

Here is the caller graph for this function:

static int always_true ( void   )  [static]

Definition at line 514 of file operf_sfile.cpp.

Referenced by operf_sfile_lru_clear().

Here is the caller graph for this function:

static int close_sfile ( struct operf_sfile sf,
void *data   __attribute__(unused) 
) [static]

Definition at line 408 of file operf_sfile.cpp.

References operf_sfile::files, odb_close(), and op_nr_counters.

Referenced by kill_sfile().

Here is the call graph for this function:

Here is the caller graph for this function:

static struct operf_sfile* create_sfile ( unsigned long  hash,
struct operf_transient const *  trans,
struct operf_kernel_image ki 
) [static, read]
static int do_match ( struct operf_sfile const *  sf,
struct operf_kernel_image const *  ki,
bool  is_anon,
const char *  image_name,
size_t  image_len,
const char *  appname,
size_t  app_len,
pid_t  tgid,
pid_t  tid,
unsigned int  cpu 
) [static]
static void for_each_sfile ( operf_sfile_func  func,
void *  data 
) [static]

Definition at line 480 of file operf_sfile.cpp.

References for_one_sfile(), list_entry, list_for_each_safe, and lru.

Referenced by operf_sfile_clear_kernel(), operf_sfile_close_files(), and operf_sfile_sync_files().

Here is the call graph for this function:

Here is the caller graph for this function:

static void for_one_sfile ( struct operf_sfile sf,
operf_sfile_func  func,
void *  data 
) [static]

Definition at line 454 of file operf_sfile.cpp.

References operf_sfile::cg_hash, CG_HASH_SIZE, operf_cg_entry::hash, kill_sfile(), list_del(), list_entry, list_for_each_safe, and operf_cg_entry::to.

Referenced by for_each_sfile(), and operf_sfile_lru_clear().

Here is the call graph for this function:

Here is the caller graph for this function:

static odb_t* get_file ( struct operf_transient const *  trans,
int  is_cg 
) [static]
static int is_sfile_kernel ( struct operf_sfile sf,
void *data   __attribute__(unused) 
) [static]

Definition at line 445 of file operf_sfile.cpp.

References operf_sfile::kernel.

Referenced by operf_sfile_clear_kernel().

Here is the caller graph for this function:

static void kill_sfile ( struct operf_sfile sf  )  [static]

Definition at line 423 of file operf_sfile.cpp.

References close_sfile(), operf_sfile::hash, list_del(), and operf_sfile::lru.

Referenced by for_one_sfile().

Here is the call graph for this function:

Here is the caller graph for this function:

static LIST_HEAD ( lru_list   )  [static]

All sfiles are on this list.

void operf_sfile_clear_kernel ( void   ) 

clear any sfiles that are for the kernel

Definition at line 492 of file operf_sfile.cpp.

References for_each_sfile(), and is_sfile_kernel().

Here is the call graph for this function:

void operf_sfile_close_files ( void   ) 

close sample files

Definition at line 508 of file operf_sfile.cpp.

References _release_resources(), and for_each_sfile().

Referenced by OP_perf_utils::op_release_resources().

Here is the call graph for this function:

Here is the caller graph for this function:

void operf_sfile_dup ( struct operf_sfile to,
struct operf_sfile from 
)

Definition at line 215 of file operf_sfile.cpp.

References operf_sfile::cg_hash, CG_HASH_SIZE, operf_sfile::files, operf_sfile::hash, list_init(), operf_sfile::lru, odb_init(), and op_nr_counters.

Referenced by get_file().

Here is the call graph for this function:

Here is the caller graph for this function:

int operf_sfile_equal ( struct operf_sfile const *  sf,
struct operf_sfile const *  sf2 
)

Definition at line 121 of file operf_sfile.cpp.

References operf_sfile::app_filename, operf_sfile::app_len, operf_sfile::cpu, do_match(), operf_sfile::image_len, operf_sfile::image_name, operf_sfile::is_anon, operf_sfile::kernel, operf_sfile::tgid, and operf_sfile::tid.

Referenced by get_file().

Here is the call graph for this function:

Here is the caller graph for this function:

struct operf_sfile* operf_sfile_find ( struct operf_transient const *  trans  )  [read]

Find the sfile for the current parameters. Note that is required that the PC value be set appropriately (needed for kernel images)

Definition at line 175 of file operf_sfile.cpp.

References operf_transient::app_filename, operf_transient::app_len, operf_transient::cpu, create_sfile(), cverb, do_match(), operf_sfile::hash, hashes, operf_transient::image_len, operf_transient::image_name, operf_transient::in_kernel, operf_transient::is_anon, list_add(), list_entry, list_for_each, lru, operf_find_kernel_image(), OPERF_LOST_KERNEL, operf_sfile_get(), operf_sfile_put(), operf_stats, operf_transient::pc, sfile_hash(), operf_transient::tgid, operf_transient::tid, and vsfile.

Referenced by __handle_callchain(), and __handle_sample_event().

Here is the call graph for this function:

Here is the caller graph for this function:

void operf_sfile_get ( struct operf_sfile sf  ) 

remove a sfile from the lru list, protecting it from operf_sfile_lru_clear()

Definition at line 548 of file operf_sfile.cpp.

References list_del(), and operf_sfile::lru.

Referenced by operf_open_sample_file(), and operf_sfile_find().

Here is the call graph for this function:

Here is the caller graph for this function:

void operf_sfile_init ( void   ) 

initialise hashes

Definition at line 562 of file operf_sfile.cpp.

References HASH_SIZE, hashes, and list_init().

Referenced by OP_perf_utils::op_write_event().

Here is the call graph for this function:

Here is the caller graph for this function:

void operf_sfile_log_arc ( struct operf_transient const *  trans  ) 

Log a callgraph arc.

Definition at line 323 of file operf_sfile.cpp.

References operf_transient::current, cverb, get_file(), operf_sfile::is_anon, operf_sfile::kernel, operf_transient::last, operf_transient::last_pc, odb_update_node(), OPERF_LOST_SAMPLEFILE, operf_stats, operf_transient::pc, operf_kernel_image::start, operf_sfile::start_addr, varcs, and verbose_arc().

Referenced by __handle_callchain().

Here is the call graph for this function:

Here is the caller graph for this function:

void operf_sfile_log_sample ( struct operf_transient const *  trans  ) 

Log the sample in a previously located sfile.

Definition at line 366 of file operf_sfile.cpp.

References operf_sfile_log_sample_count().

Referenced by __handle_sample_event().

Here is the call graph for this function:

Here is the caller graph for this function:

void operf_sfile_log_sample_count ( struct operf_transient const *  trans,
unsigned long int  count 
)

Log the event/cycle count in a previously located sfile

Definition at line 372 of file operf_sfile.cpp.

References operf_transient::current, cverb, get_file(), operf_transient::in_kernel, operf_sfile::is_anon, operf_sfile::kernel, odb_update_node_with_offset(), OPERF_KERNEL, OPERF_LOST_SAMPLEFILE, OPERF_PROCESS, OPERF_SAMPLES, operf_stats, operf_transient::pc, operf_kernel_image::start, operf_sfile::start_addr, verbose_sample(), and vsfile.

Referenced by operf_sfile_log_sample().

Here is the call graph for this function:

Here is the caller graph for this function:

int operf_sfile_lru_clear ( void   ) 

clear out a certain amount of LRU entries return non-zero if the lru is already empty

Definition at line 527 of file operf_sfile.cpp.

References always_true(), for_one_sfile(), list_empty(), list_entry, list_for_each_safe, lru, and LRU_AMOUNT.

Referenced by operf_open_sample_file().

Here is the call graph for this function:

Here is the caller graph for this function:

void operf_sfile_put ( struct operf_sfile sf  ) 

add this sfile to lru list

Definition at line 555 of file operf_sfile.cpp.

References list_add_tail(), and operf_sfile::lru.

Referenced by operf_open_sample_file(), and operf_sfile_find().

Here is the call graph for this function:

Here is the caller graph for this function:

void operf_sfile_sync_files ( void   ) 

sync sample files

Definition at line 498 of file operf_sfile.cpp.

References for_each_sfile(), and sync_sfile().

Here is the call graph for this function:

static unsigned long sfile_hash ( struct operf_transient const *  trans,
struct operf_kernel_image ki 
) [static]
static int sync_sfile ( struct operf_sfile sf,
void *data   __attribute__(unused) 
) [static]

Definition at line 431 of file operf_sfile.cpp.

References operf_sfile::files, odb_sync(), and op_nr_counters.

Referenced by operf_sfile_sync_files().

Here is the call graph for this function:

Here is the caller graph for this function:

static void verbose_arc ( struct operf_transient const *  trans,
vma_t  from,
vma_t  to 
) [static]

Definition at line 315 of file operf_sfile.cpp.

References operf_transient::current, operf_transient::event, and verbose_print_sample().

Referenced by operf_sfile_log_arc().

Here is the call graph for this function:

Here is the caller graph for this function:

static void verbose_print_sample ( struct operf_sfile sf,
vma_t  pc,
uint  counter 
) [static]
static void verbose_sample ( struct operf_transient const *  trans,
vma_t  pc 
) [static]

Definition at line 307 of file operf_sfile.cpp.

References operf_transient::current, operf_transient::event, and verbose_print_sample().

Referenced by operf_sfile_log_sample_count().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

struct list_head hashes[HASH_SIZE] [static]

All sfiles are hashed into these lists

Definition at line 31 of file operf_sfile.cpp.

Referenced by operf_sfile_find(), and operf_sfile_init().


Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1