Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
#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.
Classes | |
struct | 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 | |
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) |
Definition at line 68 of file ir_prof.c.
Referenced by hashinit().
#define DEF_NSYM (NUM_COUNTS_ENTRY-1) |
Definition at line 69 of file ir_prof.c.
Referenced by hashinit().
#define DEF_STRSIZE 3 |
Definition at line 67 of file ir_prof.c.
Referenced by hashinit().
#define FALSE 0 |
Definition at line 47 of file ir_prof.c.
Referenced by file_exists().
Definition at line 103 of file ir_prof.c.
Referenced by ir_prof_start(), and NAME().
#define NUM_COUNTS_ENTRY 4097 |
Definition at line 49 of file ir_prof.c.
Referenced by ir_prof_start().
#define PR_ASSERT | ( | EX, | |
p | |||
) | if (!(EX)) ir_prof_error(ER_FATAL, p, "Ir_pr") |
Definition at line 102 of file ir_prof.c.
Referenced by __profile_call(), ir_prof_dump_counts(), and ir_prof_start().
Definition at line 104 of file ir_prof.c.
Referenced by __profile_call().
#define SAMPLE_SIZE 15 |
Definition at line 50 of file ir_prof.c.
Referenced by ir_prof_dump().
#define TRUE 1 |
Definition at line 48 of file ir_prof.c.
Referenced by file_exists().
#define UNDEF -1 |
Definition at line 70 of file ir_prof.c.
Referenced by hash_entry().
void __profile_call | ( | ADDR | caller, |
ADDR | callee, | ||
char * | caller_name, | ||
char * | callee_name | ||
) |
Definition at line 371 of file ir_prof.c.
References hash_entry(), ir_prof_start(), num_counts, PR_ASSERT, REALLOC, and sizeof_counts_array.
void* atexit | ( | ) |
Referenced by _initialize_e_fortran_io(), Configure(), and ir_prof_init().
void cgt_fini | ( | void | ) |
Definition at line 183 of file ir_prof.c.
References close, ER_FATAL, errno, fd_counts, file_exists(), ir_prof_dump(), ir_prof_dump_counts(), ir_prof_error(), name, num_counts, open, stat, and sys_errlist.
Referenced by ir_prof_init().
int enter_str | ( | char * | name | ) |
Definition at line 287 of file ir_prof.c.
References expand_strtab(), HASH_STRUCT::nchars, ret, HASH_STRUCT::strsize, and HASH_STRUCT::strtab.
Referenced by hash_entry().
void expand_htab | ( | ) |
Definition at line 261 of file ir_prof.c.
References bzero(), HASH_STRUCT::chain, ER_FATAL, ir_prof_error(), and HASH_STRUCT::nsym.
Referenced by hash_entry().
void expand_strtab | ( | int | i | ) |
Definition at line 275 of file ir_prof.c.
References ER_FATAL, ir_prof_error(), 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 307 of file ir_prof.c.
References callee, counts_entry::callee, counts_entry::callee_name_idx, caller, counts_entry::caller, counts_entry::caller_name_idx, HASH_STRUCT::chain, counts_entry::count, enter_str(), expand_htab(), HASH_STRUCT::nchain, HASH_STRUCT::nsym, num_counts, HASH_STRUCT::phash, HASH_STRUCT::size, and UNDEF.
Referenced by __profile_call().
void hashinit | ( | void | ) |
Definition at line 232 of file ir_prof.c.
References bzero(), HASH_STRUCT::chain, DEF_NBUCKETS, DEF_NSYM, DEF_STRSIZE, ER_FATAL, ir_prof_error(), HASH_STRUCT::nchain, HASH_STRUCT::nchars, HASH_STRUCT::nsym, HASH_STRUCT::phash, return(), HASH_STRUCT::size, HASH_STRUCT::strsize, and HASH_STRUCT::strtab.
Referenced by ir_prof_start().
void ir_prof_dump | ( | void | ) |
Definition at line 107 of file ir_prof.c.
References callee, counts_entry::callee_name_idx, caller, counts_entry::caller_name_idx, num_counts, SAMPLE_SIZE, and HASH_STRUCT::strtab.
Referenced by cgt_fini().
void ir_prof_dump_counts | ( | int | fd_counts | ) |
Definition at line 155 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 122 of file ir_prof.c.
References ER_ERROR, ER_FATAL, ER_INFO, ER_MSG, ER_VERBOSE, ER_WARNING, exit(), and fprintf().
Referenced by cgt_fini(), expand_htab(), expand_strtab(), and hashinit().
void ir_prof_init | ( | void | ) |
Definition at line 224 of file ir_prof.c.
References atexit(), cgt_fini(), and num_counts.
void ir_prof_start | ( | void | ) |
Definition at line 142 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 45 of file ir_prof.c.
Referenced by cgt_fini().
HASH_STRUCT h_tab [static] |
long num_counts [static] |
Definition at line 53 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] |
Definition at line 54 of file ir_prof.c.
Referenced by __profile_call().