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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 16 of file profile_twoevents.c.

17 {
18  int i, num_tests = 6;
19  unsigned long length, blength;
20  int num_buckets, mask;
21  char title[80];
22  int retval;
23  const PAPI_exe_info_t *prginfo;
24  caddr_t start, end;
25 
26  prof_init( argc, argv, &prginfo );
27 
28  mask = prof_events( num_tests );
29  start = prginfo->address_info.text_start;
30  end = prginfo->address_info.text_end;
31 
32  /* Must have at least FP instr or Tot ins */
33 
34  if ( ( ( mask & MASK_FP_INS ) == 0 ) && ( ( mask & MASK_TOT_INS ) == 0 ) ) {
35  test_skip( __FILE__, __LINE__, "No FP or Total Ins. event", 1 );
36  }
37 
38  if ( start > end )
39  test_fail( __FILE__, __LINE__, "Profile length < 0!", 0 );
40  length = ( unsigned long ) ( end - start );
42  ( "Test case profile: POSIX compatible profiling with two events.\n",
43  prginfo );
45  prof_alloc( 2, length );
46 
47  blength =
48  prof_size( length, FULL_SCALE, PAPI_PROFIL_BUCKET_16, &num_buckets );
49  do_no_profile( );
50 
51  if ( !TESTS_QUIET ) {
52  printf( "Test type : \tPAPI_PROFIL_POSIX\n" );
53  }
54  if ( ( retval =
55  PAPI_profil( profbuf[0], ( unsigned int ) blength, start, FULL_SCALE,
57  PAPI_PROFIL_POSIX ) ) != PAPI_OK ) {
58  test_fail( __FILE__, __LINE__, "PAPI_profil", retval );
59  }
60  if ( ( retval =
61  PAPI_profil( profbuf[1], ( unsigned int ) blength, start, FULL_SCALE,
63  PAPI_PROFIL_POSIX ) ) != PAPI_OK )
64  test_fail( __FILE__, __LINE__, "PAPI_profil", retval );
65 
66  do_stuff( );
67 
68  if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
69  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
70 
71  do_stuff( );
72 
73  if ( ( retval = PAPI_stop( EventSet, values[1] ) ) != PAPI_OK )
74  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
75 
76  if ( !TESTS_QUIET ) {
77  printf( TAB1, event_name, ( values[1] )[0] );
78  printf( TAB1, "PAPI_TOT_CYC:", ( values[1] )[1] );
79  }
80  if ( ( retval =
81  PAPI_profil( profbuf[0], ( unsigned int ) blength, start, FULL_SCALE,
82  EventSet, PAPI_event, 0,
83  PAPI_PROFIL_POSIX ) ) != PAPI_OK )
84  test_fail( __FILE__, __LINE__, "PAPI_profil", retval );
85 
86  if ( ( retval =
87  PAPI_profil( profbuf[1], ( unsigned int ) blength, start, FULL_SCALE,
89  PAPI_PROFIL_POSIX ) ) != PAPI_OK )
90  test_fail( __FILE__, __LINE__, "PAPI_profil", retval );
91 
92  sprintf( title,
93  " \t\t %s\tPAPI_TOT_CYC\naddress\t\t\tcounts\tcounts\n",
94  event_name );
95  prof_head( blength, PAPI_PROFIL_BUCKET_16, num_buckets, title );
96  prof_out( start, 2, PAPI_PROFIL_BUCKET_16, num_buckets, FULL_SCALE );
97 
98  remove_test_events( &EventSet, mask );
99 
100  retval = prof_check( 2, PAPI_PROFIL_BUCKET_16, num_buckets );
101 
102  for ( i = 0; i < 2; i++ ) {
103  free( profbuf[i] );
104  }
105 
106  if ( retval == 0 )
107  test_fail( __FILE__, __LINE__, "No information in buffers", 1 );
108 
109  test_pass( __FILE__, values, num_tests );
110 
111  exit( 1 );
112 }
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")
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2232
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
void prof_head(unsigned long blength, int bucket, int num_buckets, char *header)
Definition: prof_utils.c:194
caddr_t text_end
Definition: papi.h:693
start
Definition: iozone.c:22736
void test_skip(char *file, int line, char *call, int retval)
Definition: test_utils.c:614
void do_stuff(void)
Definition: do_loops.c:249
#define TAB1
Definition: papi_test.h:112
get the executable&#39;s info
Definition: papi.h:702
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_PROFIL_POSIX
Definition: fpapi.h:75
#define printf
Definition: papi_test.h:125
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
void do_no_profile(void)
Definition: prof_utils.c:126
unsigned long prof_size(unsigned long plength, unsigned scale, int bucket, int *num_buckets)
Definition: prof_utils.c:321
#define MASK_FP_INS
Definition: papi_test.h:47
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:5316
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
#define PAPI_TOT_CYC
Definition: fpapi.h:194
#define FULL_SCALE
Definition: prof_utils.h:23
free(dummyfile[xx])
caddr_t text_start
Definition: papi.h:692
PAPI_address_map_t address_info
Definition: papi.h:704
#define PAPI_PROFIL_BUCKET_16
Definition: fpapi.h:79
void * profbuf[5]
Definition: prof_utils.c:28
long long
Definition: iozone.c:19827
int num_tests
Definition: zero_fork.c:46
int EventSet
#define MASK_TOT_INS
Definition: papi_test.h:48
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
int prof_check(int n, int bucket, int num_buckets)
Definition: prof_utils.c:283
int prof_events(int num_tests)
Definition: prof_utils.c:59
int PAPI_start(int EventSet)
Definition: papi.c:2026
#define THRESHOLD
Definition: earprofile.c:31
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338
void exit()
int remove_test_events(int *EventSet, int mask)
Definition: test_utils.c:277
void prof_alloc(int num, unsigned long blength)
Definition: prof_utils.c:151

Here is the call graph for this function: