Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
ir_prof.c File Reference
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <libgen.h>
#include <sys/stat.h>
#include "ir_prof.h"
Include dependency graph for ir_prof.c:

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_entrycounts_array
static long num_counts
static long sizeof_counts_array = NUM_COUNTS_ENTRY
static HASH_STRUCT h_tab

Define Documentation

#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().

#define MALLOC (   nbytes)    malloc((size_t)(nbytes))

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,
 
)    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().

#define REALLOC (   ptr,
  size 
)    realloc((void *)(ptr), (size_t)(size))

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().


Function Documentation

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.

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

int file_exists ( char *  path)

Definition at line 80 of file ir_prof.c.

References errno, FALSE, stat, and TRUE.

static void hash_entry ( ADDR  caller,
ADDR  callee,
char *  caller_name,
char *  callee_name 
) [static]
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().

Here is the call graph for this function:

void ir_prof_init ( void  )

Definition at line 224 of file ir_prof.c.

References atexit(), cgt_fini(), and num_counts.

Here is the call graph for this function:

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().

Here is the call graph for this function:

static void usage ( char *  progname) [static]

Definition at line 93 of file ir_prof.c.

References exit(), and fprintf().

Here is the call graph for this function:


Variable Documentation

Definition at line 52 of file ir_prof.c.

int fd_counts [static]

Definition at line 45 of file ir_prof.c.

Referenced by cgt_fini().

HASH_STRUCT h_tab [static]

Definition at line 71 of file ir_prof.c.

Definition at line 54 of file ir_prof.c.

Referenced by __profile_call().

char* thisfile = __FILE__ [static]

Definition at line 42 of file ir_prof.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines