#include <errno.h>#include <stdio.h>#include <fcntl.h>#include <libgen.h>#include <sys/stat.h>#include "ir_prof.h"

Go to the source code of this file.
Data Types | |
| type | HASH_STRUCT |
Defines | |
| #define | FALSE 0 |
| #define | TRUE 1 |
| #define | NUM_COUNTS_ENTRY 4097 |
| #define | SAMPLE_SIZE 15 |
| #define | DEF_STRSIZE 3 |
| #define | DEF_NBUCKETS (NUM_COUNTS_ENTRY-1) |
| #define | DEF_NSYM (NUM_COUNTS_ENTRY-1) |
| #define | UNDEF -1 |
| #define | PR_ASSERT(EX, p) if (!(EX)) ir_prof_error(ER_FATAL, p, "Ir_pr") |
| #define | MALLOC(nbytes) malloc((size_t)(nbytes)) |
| #define | REALLOC(ptr, size) realloc((void *)(ptr), (size_t)(size)) |
Functions/Subroutines | |
| void | hashinit (void) |
| void * | atexit () |
| int | file_exists (char *path) |
| static void | usage (char *progname) |
| void | ir_prof_dump (void) |
| void | ir_prof_error (int type, char *fmt, char *fname) |
| void | ir_prof_start (void) |
| void | ir_prof_dump_counts (int fd_counts) |
| void | cgt_fini (void) |
| void | ir_prof_init (void) |
| void | expand_htab () |
| void | expand_strtab (int i) |
| int | enter_str (char *name) |
| static void | hash_entry (ADDR caller, ADDR callee, char *caller_name, char *callee_name) |
| void | __profile_call (ADDR caller, ADDR callee, char *caller_name, char *callee_name) |
Variables | |
| static char * | thisfile = __FILE__ |
| static int | fd_counts |
| static counts_entry * | counts_array |
| static long | num_counts |
| static long | sizeof_counts_array = NUM_COUNTS_ENTRY |
| static HASH_STRUCT | h_tab |
| #define DEF_NBUCKETS (NUM_COUNTS_ENTRY-1) |
| #define DEF_NSYM (NUM_COUNTS_ENTRY-1) |
| #define DEF_STRSIZE 3 |
| #define NUM_COUNTS_ENTRY 4097 |
Definition at line 106 of file ir_prof.c.
Referenced by __profile_call(), ir_prof_dump_counts(), and ir_prof_start().
| #define SAMPLE_SIZE 15 |
Definition at line 375 of file ir_prof.c.
References hash_entry(), ir_prof_start(), num_counts, PR_ASSERT, REALLOC, and sizeof_counts_array.
| void* atexit | ( | ) |
Definition at line 187 of file ir_prof.c.
References close, ENOENT, ER_FATAL, errno, fd_counts, file_exists(), ir_prof_dump(), ir_prof_dump_counts(), ir_prof_error(), num_counts, O_CREAT, O_RDWR, O_TRUNC, open, stat, strerror(), and void.
Referenced by ir_prof_init().
| int enter_str | ( | char * | name | ) |
Definition at line 291 of file ir_prof.c.
References expand_strtab(), i, memcpy, HASH_STRUCT::nchars, p, ret, strlen(), HASH_STRUCT::strsize, and HASH_STRUCT::strtab.
Referenced by hash_entry().
| void expand_htab | ( | ) |
Definition at line 265 of file ir_prof.c.
References bzero(), HASH_STRUCT::chain, ER_FATAL, ir_prof_error(), HASH_STRUCT::nsym, and realloc.
Referenced by hash_entry().
| void expand_strtab | ( | int | i | ) |
Definition at line 279 of file ir_prof.c.
References ER_FATAL, ir_prof_error(), realloc, HASH_STRUCT::strsize, and HASH_STRUCT::strtab.
Referenced by enter_str().
| int file_exists | ( | char * | path | ) |
| static void hash_entry | ( | ADDR | caller, | |
| ADDR | callee, | |||
| char * | caller_name, | |||
| char * | callee_name | |||
| ) | [static] |
Definition at line 311 of file ir_prof.c.
References counts_entry::callee, counts_entry::callee_name_idx, counts_entry::caller, counts_entry::caller_name_idx, HASH_STRUCT::chain, counts_entry::count, enter_str(), expand_htab(), i, HASH_STRUCT::nchain, HASH_STRUCT::nsym, num_counts, HASH_STRUCT::phash, HASH_STRUCT::size, UNDEF, and is::y.
Referenced by __profile_call().
Definition at line 236 of file ir_prof.c.
References bzero(), HASH_STRUCT::chain, DEF_NBUCKETS, DEF_NSYM, DEF_STRSIZE, ER_FATAL, ir_prof_error(), malloc, memset, HASH_STRUCT::nchain, HASH_STRUCT::nchars, HASH_STRUCT::nsym, p, HASH_STRUCT::phash, return, HASH_STRUCT::size, HASH_STRUCT::strsize, and HASH_STRUCT::strtab.
Referenced by ir_prof_start().
Definition at line 111 of file ir_prof.c.
References callee, counts_entry::callee_name_idx, caller, counts_entry::caller_name_idx, count, i, num_counts, printf(), SAMPLE_SIZE, and HASH_STRUCT::strtab.
Referenced by cgt_fini().
| void ir_prof_dump_counts | ( | int | fd_counts | ) |
Definition at line 159 of file ir_prof.c.
References Counts_hdr::c_dummy1, Counts_hdr::c_entry, Counts_hdr::c_ident, C_VERSION, Counts_hdr::c_version, COUNTSMAG0, COUNTSMAG1, COUNTSMAG2, COUNTSMAG3, COUNTSMAG4, COUNTSMAG5, COUNTSMAG6, COUNTSMAG7, HASH_STRUCT::nchars, num_counts, PR_ASSERT, HASH_STRUCT::strtab, and write.
Referenced by cgt_fini().
| void ir_prof_error | ( | int | type, | |
| char * | fmt, | |||
| char * | fname | |||
| ) |
Definition at line 126 of file ir_prof.c.
References ER_ERROR, ER_FATAL, ER_INFO, ER_MSG, ER_VERBOSE, ER_WARNING, exit(), fflush(), fprintf(), and fputc().
Referenced by cgt_fini(), expand_htab(), expand_strtab(), and hashinit().
Definition at line 146 of file ir_prof.c.
References hashinit(), MALLOC, num_counts, NUM_COUNTS_ENTRY, and PR_ASSERT.
Referenced by __profile_call().
| static void usage | ( | char * | progname | ) | [static] |
counts_entry* counts_array [static] |
int fd_counts [static] |
Definition at line 49 of file ir_prof.c.
Referenced by cgt_fini(), close_counts_file(), and open_counts_file().
HASH_STRUCT h_tab [static] |
long num_counts [static] |
Definition at line 57 of file ir_prof.c.
Referenced by __profile_call(), cgt_fini(), hash_entry(), ir_prof_dump(), ir_prof_dump_counts(), ir_prof_init(), and ir_prof_start().
long sizeof_counts_array = NUM_COUNTS_ENTRY [static] |
1.5.6