20#if (defined(linux) && defined(__ia64__)) || (defined(_AIX)) \
21 || ((defined(__powerpc64__) && (_CALL_ELF != 2)))
23#define DO_READS (unsigned long)(*(void **)do_reads)
24#define DO_FLOPS (unsigned long)(*(void **)do_flops)
29#define DO_READS (unsigned long)(do_reads)
30#define DO_FLOPS (unsigned long)(do_flops)
37main(
int argc,
char **argv )
41 unsigned short **
buf = (
unsigned short ** )
profbuf;
42 unsigned long length, blength;
59 test_fail( __FILE__, __LINE__,
"PAPI_get_executable_info", 1 );
69 prof_print_address(
"Test case sprofile: POSIX compatible profiling over multiple regions.\n",
81#if defined(linux) && defined(__ia64__)
83 fprintf(
stderr,
"do_flops is at %p %p\n", &
do_flops, sprof[0].pr_off );
90#if defined(linux) && defined(__ia64__)
92 fprintf(
stderr,
"do_reads is at %p %p\n", &
do_reads, sprof[1].pr_off );
109 if (!
quiet) printf(
"Trouble creating events\n");
136 printf(
"Test case: PAPI_sprofil()\n" );
137 printf(
"---------Buffer 1--------\n" );
140 printf(
"%#lx\t%d\n",
DO_FLOPS + 2 * (
unsigned long )
i,
143 printf(
"---------Buffer 2--------\n" );
146 printf(
"%#lx\t%d\n",
DO_READS + 2 * (
unsigned long )
i,
149 printf(
"-------------------------\n" );
150 printf(
"%u samples fell outside the regions.\n", *
buf[2] );
154 for (
i = 0;
i < 3;
i++ ) {
158 test_fail( __FILE__, __LINE__,
"No information in buffers", 1 );
Get the executable's address space info.
initialize the PAPI library.
Generate PC histogram data from multiple code regions where hardware counter overflow occurs.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
#define PAPI_PROFIL_POSIX
#define PAPI_PROFIL_BUCKET_16
static long long values[NUM_EVENTS]
static struct timeval start
Return codes and api definitions.
int tests_quiet(int argc, char **argv)
int add_test_events(int *number, int *mask, int allow_derived)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
long long ** allocate_test_space(int num_tests, int num_events)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
int remove_test_events(int *EventSet, int mask)
int prof_check(int n, int bucket, int num_buckets)
unsigned long prof_size(unsigned long plength, unsigned scale, int bucket, int *num_buckets)
void prof_alloc(int num, unsigned long blength)
void prof_print_address(const char *title, const PAPI_exe_info_t *prginfo)
get the executable's info
PAPI_address_map_t address_info