PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
earprofile.c File Reference
Include dependency graph for earprofile.c:

Go to the source code of this file.

Macros

#define THRESHOLD   1000
 

Functions

static void ear_no_profile (void)
 
static int do_profile (caddr_t start, unsigned long plength, unsigned scale, int thresh, int bucket)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

#define THRESHOLD   1000

Definition at line 31 of file earprofile.c.

Function Documentation

static int do_profile ( caddr_t  start,
unsigned long  plength,
unsigned  scale,
int  thresh,
int  bucket 
)
static

Definition at line 52 of file earprofile.c.

54 {
55  int i, retval;
56  unsigned long blength;
57  int num_buckets;
58  char *profstr[2] = { "PAPI_PROFIL_POSIX", "PAPI_PROFIL_INST_EAR" };
59  int profflags[2] =
61  int num_profs;
62 
63  do_stuff( );
64 
65  num_profs = sizeof ( profflags ) / sizeof ( int );
66  ear_no_profile( );
67  blength = prof_size( plength, scale, bucket, &num_buckets );
68  prof_alloc( num_profs, blength );
69 
70  for ( i = 0; i < num_profs; i++ ) {
71  if ( !TESTS_QUIET )
72  printf( "Test type : \t%s\n", profstr[i] );
73 
74  if ( ( retval = PAPI_profil( profbuf[i], blength, start, scale,
75  EventSet, PAPI_event, thresh,
76  profflags[i] | bucket ) ) != PAPI_OK ) {
77  test_fail( __FILE__, __LINE__, "PAPI_profil", retval );
78  }
79  if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
80  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
81 
82  do_stuff( );
83 
84  if ( ( retval = PAPI_stop( EventSet, values[1] ) ) != PAPI_OK )
85  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
86 
87  if ( !TESTS_QUIET ) {
88  printf( TAB1, event_name, ( values[1] )[0] );
89  printf( TAB1, "PAPI_TOT_CYC:", ( values[1] )[1] );
90  }
91  if ( ( retval = PAPI_profil( profbuf[i], blength, start, scale,
92  EventSet, PAPI_event, 0,
93  profflags[i] ) ) != PAPI_OK )
94  test_fail( __FILE__, __LINE__, "PAPI_profil", retval );
95  }
96 
97  prof_head( blength, bucket, num_buckets,
98  "address\t\t\tPOSIX\tINST_DEAR\n" );
99  prof_out( start, num_profs, bucket, num_buckets, scale );
100 
101  retval = prof_check( num_profs, bucket, num_buckets );
102 
103  for ( i = 0; i < num_profs; i++ ) {
104  free( profbuf[i] );
105  }
106 
107  return ( retval );
108 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:23
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2258
int PAPI_event[2]
Definition: data_range.c:24
void prof_head(unsigned long blength, int bucket, int num_buckets, char *header)
Definition: prof_utils.c:194
start
Definition: iozone.c:22736
void do_stuff(void)
Definition: do_loops.c:249
#define TAB1
Definition: papi_test.h:112
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
#define printf
Definition: papi_test.h:125
int TESTS_QUIET
Definition: test_utils.c:11
unsigned long prof_size(unsigned long plength, unsigned scale, int bucket, int *num_buckets)
Definition: prof_utils.c:321
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_profil(void *buf, unsigned bufsiz, caddr_t offset, unsigned scale, int EventSet, int EventCode, int threshold, int flags)
Definition: papi.c:5364
int i
Definition: fileop.c:140
void prof_out(caddr_t start, int n, int bucket, int num_buckets, unsigned int scale)
Definition: prof_utils.c:213
free(dummyfile[xx])
static void ear_no_profile(void)
Definition: earprofile.c:34
void * profbuf[5]
Definition: prof_utils.c:28
#define PAPI_PROFIL_INST_EAR
Definition: papi.h:403
#define PAPI_PROFIL_POSIX
Definition: papi.h:394
int prof_check(int n, int bucket, int num_buckets)
Definition: prof_utils.c:283
int PAPI_start(int EventSet)
Definition: papi.c:2053
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338
void prof_alloc(int num, unsigned long blength)
Definition: prof_utils.c:151

Here is the call graph for this function:

Here is the caller graph for this function:

static void ear_no_profile ( void  )
static

Definition at line 34 of file earprofile.c.

35 {
36  int retval;
37 
38  if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
39  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
40 
41  do_l1misses( 10000 );
42 
43  if ( ( retval = PAPI_stop( EventSet, values[0] ) ) != PAPI_OK )
44  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
45 
46  printf( "Test type : \tNo profiling\n" );
47  printf( TAB1, event_name, ( values[0] )[0] );
48  printf( TAB1, "PAPI_TOT_CYC:", ( values[0] )[1] );
49 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:23
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2258
#define TAB1
Definition: papi_test.h:112
int EventSet
Definition: data_range.c:25
return PAPI_OK
Definition: linux-nvml.c:458
#define printf
Definition: papi_test.h:125
void do_l1misses(int n)
Definition: do_loops.c:213
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_start(int EventSet)
Definition: papi.c:2053
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 112 of file earprofile.c.

113 {
114  int num_events, num_tests = 6;
115  long length;
116  int retval, retval2;
117  const PAPI_hw_info_t *hw_info;
118  const PAPI_exe_info_t *prginfo;
119  caddr_t start, end;
120 
121  prof_init( argc, argv, &prginfo );
122 
123  if ( ( hw_info = PAPI_get_hardware_info( ) ) == NULL ) {
124  test_fail( __FILE__, __LINE__, "PAPI_get_hardware_info", 0 );
125  }
126 
127  if ( ( strncasecmp( hw_info->model_string, "Itanium", strlen( "Itanium" ) )
128  != 0 ) &&
129  ( strncasecmp( hw_info->model_string, "32", strlen( "32" ) ) != 0 ) )
130  test_skip( __FILE__, __LINE__, "Test unsupported", PAPI_ENOIMPL );
131 
132  if ( TESTS_QUIET ) {
133  test_skip( __FILE__, __LINE__,
134  "Test deprecated in quiet mode for PAPI 3.6", 0 );
135 
136  }
137 
138  sprintf( event_name, "DATA_EAR_CACHE_LAT4" );
139  if ( ( retval =
141  test_fail( __FILE__, __LINE__, "PAPI_event_name_to_code", retval );
142 
143  if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK )
144  test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
145 
146  if ( ( retval = PAPI_add_event( EventSet, PAPI_event ) ) != PAPI_OK )
147  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
148 
149  if ( ( retval = PAPI_add_event( EventSet, PAPI_TOT_CYC ) ) != PAPI_OK )
150  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
151 
152  num_events = 2;
153  values = allocate_test_space( num_tests, num_events );
154 
155 /* use these lines to profile entire code address space */
156  start = prginfo->address_info.text_start;
157  end = prginfo->address_info.text_end;
158  length = end - start;
159  if ( length < 0 )
160  test_fail( __FILE__, __LINE__, "Profile length < 0!", length );
161 
163  ( "Test earprofile: POSIX compatible event address register profiling.\n",
164  prginfo );
165  prof_print_prof_info( start, end, THRESHOLD, event_name );
166  retval =
167  do_profile( start, length, FULL_SCALE, THRESHOLD,
169 
170  retval2 = PAPI_remove_event( EventSet, PAPI_event );
171  if ( retval2 == PAPI_OK )
173  if ( retval2 != PAPI_OK )
174  test_fail( __FILE__, __LINE__, "Can't remove events", retval2 );
175 
176  if ( retval )
177  test_pass( __FILE__, values, num_tests );
178  else
179  test_fail( __FILE__, __LINE__, "No information in buffers", 1 );
180  exit( 1 );
181 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:23
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
unsigned long long length
Definition: iozone.c:17106
int PAPI_event[2]
Definition: data_range.c:24
void prof_print_address(char *title, const PAPI_exe_info_t *prginfo)
Definition: prof_utils.c:82
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1622
Hardware info structure.
Definition: papi.h:777
caddr_t text_end
Definition: papi.h:695
start
Definition: iozone.c:22736
int PAPI_remove_event(int EventSet, int EventCode)
Definition: papi.c:1717
void test_skip(char *file, int line, char *call, int retval)
Definition: test_utils.c:614
#define PAPI_PROFIL_BUCKET_16
Definition: papi.h:398
int EventSet
Definition: data_range.c:25
int num_events
get the executable&#39;s info
Definition: papi.h:704
return PAPI_OK
Definition: linux-nvml.c:458
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
int TESTS_QUIET
Definition: test_utils.c:11
char ** argv
Definition: iozone.c:1610
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
#define FULL_SCALE
Definition: prof_utils.h:23
#define PAPI_TOT_CYC
caddr_t text_start
Definition: papi.h:694
PAPI_address_map_t address_info
Definition: papi.h:706
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1424
int num_tests
Definition: zero_fork.c:46
#define PAPI_ENOIMPL
Definition: papi.h:270
int PAPI_event_name_to_code(char *in, int *out)
Definition: papi.c:1010
static int do_profile(caddr_t start, unsigned long plength, unsigned scale, int thresh, int bucket)
Definition: earprofile.c:52
void prof_init(int argc, char **argv, const PAPI_exe_info_t **prginfo)
Definition: prof_utils.c:39
void prof_print_prof_info(caddr_t start, caddr_t end, int threshold, char *event_name)
Definition: prof_utils.c:106
char model_string[PAPI_MAX_STR_LEN]
Definition: papi.h:787
#define THRESHOLD
Definition: earprofile.c:31
const PAPI_hw_info_t * PAPI_get_hardware_info(void)
Definition: papi.c:6111
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338
long long ** allocate_test_space(int num_tests, int num_events)
Definition: test_utils.c:107
static const PAPI_hw_info_t * hw_info
Definition: byte_profile.c:23
void exit()

Here is the call graph for this function: