|
PAPI
5.0.1.0
|

Go to the source code of this file.
Functions | |
| void | prof_init (int argc, char **argv, const PAPI_exe_info_t **prginfo) |
| int | prof_events (int num_tests) |
| void | prof_print_address (char *title, const PAPI_exe_info_t *prginfo) |
| void | prof_print_prof_info (caddr_t start, caddr_t end, int threshold, char *event_name) |
| void | do_no_profile (void) |
| void | prof_alloc (int num, unsigned long blength) |
| int | prof_buckets (int bucket) |
| void | prof_head (unsigned long blength, int bucket, int num_buckets, char *header) |
| void | prof_out (caddr_t start, int n, int bucket, int num_buckets, unsigned int scale) |
| int | prof_check (int n, int bucket, int num_buckets) |
| unsigned long | prof_size (unsigned long plength, unsigned scale, int bucket, int *num_buckets) |
Variables | |
| long long ** | values |
| char | event_name [PAPI_MAX_STR_LEN] |
| int | PAPI_event |
| int | EventSet = PAPI_NULL |
| void * | profbuf [5] |
| void do_no_profile | ( | void | ) |
Definition at line 126 of file prof_utils.c.
{
int retval;
if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_start", retval );
do_flops( getenv( "NUM_ITERS" ) ? atoi( getenv( "NUM_ITERS" ) ) :
NUM_ITERS );
if ( ( retval = PAPI_stop( EventSet, values[0] ) ) != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
printf( "Test type : \t%s\n", "No profiling" );
printf( TAB1, event_name, ( values[0] )[0] );
printf( TAB1, "PAPI_TOT_CYC", ( values[0] )[1] );
}


| void prof_alloc | ( | int | num, |
| unsigned long | blength | ||
| ) |
Definition at line 151 of file prof_utils.c.
{
int i;
for ( i = 0; i < num; i++ ) {
profbuf[i] = malloc( blength );
if ( profbuf[i] == NULL ) {
test_fail( __FILE__, __LINE__, "malloc", PAPI_ESYS );
}
memset( profbuf[i], 0x00, blength );
}
}


| int prof_buckets | ( | int | bucket | ) |
Definition at line 171 of file prof_utils.c.
{
int bucket_size;
switch ( bucket ) {
case PAPI_PROFIL_BUCKET_16:
bucket_size = sizeof ( short );
break;
case PAPI_PROFIL_BUCKET_32:
bucket_size = sizeof ( int );
break;
case PAPI_PROFIL_BUCKET_64:
bucket_size = sizeof ( unsigned long long );
break;
default:
bucket_size = 0;
break;
}
return ( bucket_size );
}

| int prof_check | ( | int | n, |
| int | bucket, | ||
| int | num_buckets | ||
| ) |
Definition at line 283 of file prof_utils.c.
{
int i, j;
int retval = 0;
unsigned short **buf16 = ( unsigned short ** ) profbuf;
unsigned int **buf32 = ( unsigned int ** ) profbuf;
unsigned long long **buf64 = ( unsigned long long ** ) profbuf;
switch ( bucket ) {
case PAPI_PROFIL_BUCKET_16:
for ( i = 0; i < num_buckets; i++ )
for ( j = 0; j < n; j++ )
retval = retval || buf16[j][i];
break;
case PAPI_PROFIL_BUCKET_32:
for ( i = 0; i < num_buckets; i++ )
for ( j = 0; j < n; j++ )
retval = retval || buf32[j][i];
break;
case PAPI_PROFIL_BUCKET_64:
for ( i = 0; i < num_buckets; i++ )
for ( j = 0; j < n; j++ )
retval = retval || buf64[j][i];
break;
}
return ( retval );
}

| int prof_events | ( | int | num_tests | ) |
Definition at line 59 of file prof_utils.c.
{
int retval;
int num_events, mask;
/* add PAPI_TOT_CYC and one of the events in PAPI_FP_INS, PAPI_FP_OPS or
PAPI_TOT_INS, depends on the availability of the event on the
platform */
EventSet =
add_two_nonderived_events( &num_events, &PAPI_event, &mask );
values = allocate_test_space( num_tests, num_events );
if ( ( retval =
PAPI_event_code_to_name( PAPI_event, event_name ) ) != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval );
return ( mask );
}


| void prof_head | ( | unsigned long | blength, |
| int | bucket, | ||
| int | num_buckets, | ||
| char * | header | ||
| ) |
Definition at line 194 of file prof_utils.c.
{
int bucket_size = prof_buckets( bucket );
printf
( "\n------------------------------------------------------------\n" );
printf( "PAPI_profil() hash table, Bucket size: %d bits.\n",
bucket_size * 8 );
printf( "Number of buckets: %d.\nLength of buffer: %ld bytes.\n",
num_buckets, blength );
printf( "------------------------------------------------------------\n" );
printf( "%s\n", header );
}


| void prof_init | ( | int | argc, |
| char ** | argv, | ||
| const PAPI_exe_info_t ** | prginfo | ||
| ) |
Definition at line 39 of file prof_utils.c.
{
int retval;
tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
if ( ( retval =
PAPI_library_init( PAPI_VER_CURRENT ) ) != PAPI_VER_CURRENT )
test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
if ( ( *prginfo = PAPI_get_executable_info( ) ) == NULL )
test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
}


| void prof_out | ( | caddr_t | start, |
| int | n, | ||
| int | bucket, | ||
| int | num_buckets, | ||
| unsigned int | scale | ||
| ) |
Definition at line 213 of file prof_utils.c.
{
int i, j;
unsigned short buf_16;
unsigned int buf_32;
unsigned long long buf_64;
unsigned short **buf16 = ( unsigned short ** ) profbuf;
unsigned int **buf32 = ( unsigned int ** ) profbuf;
unsigned long long **buf64 = ( unsigned long long ** ) profbuf;
if ( !TESTS_QUIET ) {
/* printf("0x%lx\n",(unsigned long) start + (unsigned long) (2 * i)); */
/* printf("start: %p; i: %x; scale: %x; i*scale: %x; i*scale >>15: %x\n", start, i, scale, i*scale, (i*scale)>>15); */
switch ( bucket ) {
case PAPI_PROFIL_BUCKET_16:
for ( i = 0; i < num_buckets; i++ ) {
for ( j = 0, buf_16 = 0; j < n; j++ )
buf_16 |= ( buf16[j] )[i];
if ( buf_16 ) {
/* On 32bit builds with gcc 4.3 gcc complained about casting caddr_t => long long
* Thus the unsigned long to long long cast */
printf( "0x%-16llx",
(long long) (unsigned long)start +
( ( ( long long ) i * scale ) >> 15 ) );
for ( j = 0, buf_16 = 0; j < n; j++ )
printf( "\t%d", ( buf16[j] )[i] );
printf( "\n" );
}
}
break;
case PAPI_PROFIL_BUCKET_32:
for ( i = 0; i < num_buckets; i++ ) {
for ( j = 0, buf_32 = 0; j < n; j++ )
buf_32 |= ( buf32[j] )[i];
if ( buf_32 ) {
printf( "0x%-16llx",
(long long) (unsigned long)start +
( ( ( long long ) i * scale ) >> 15 ) );
for ( j = 0, buf_32 = 0; j < n; j++ )
printf( "\t%d", ( buf32[j] )[i] );
printf( "\n" );
}
}
break;
case PAPI_PROFIL_BUCKET_64:
for ( i = 0; i < num_buckets; i++ ) {
for ( j = 0, buf_64 = 0; j < n; j++ )
buf_64 |= ( buf64[j] )[i];
if ( buf_64 ) {
printf( "0x%-16llx",
(long long) (unsigned long)start +
( ( ( long long ) i * scale ) >> 15 ) );
for ( j = 0, buf_64 = 0; j < n; j++ )
printf( "\t%lld", ( buf64[j] )[i] );
printf( "\n" );
}
}
break;
}
printf
( "------------------------------------------------------------\n\n" );
}
}

| void prof_print_address | ( | char * | title, |
| const PAPI_exe_info_t * | prginfo | ||
| ) |
Definition at line 82 of file prof_utils.c.
{
printf( "%s\n", title );
printf
( "----------------------------------------------------------------\n" );
printf( "Text start: %p, Text end: %p, Text length: 0x%x\n",
prginfo->address_info.text_start, prginfo->address_info.text_end,
( unsigned int ) ( prginfo->address_info.text_end -
prginfo->address_info.text_start ) );
printf( "Data start: %p, Data end: %p\n", prginfo->address_info.data_start,
prginfo->address_info.data_end );
printf( "BSS start : %p, BSS end : %p\n", prginfo->address_info.bss_start,
prginfo->address_info.bss_end );
printf
( "----------------------------------------------------------------\n" );
}

| void prof_print_prof_info | ( | caddr_t | start, |
| caddr_t | end, | ||
| int | threshold, | ||
| char * | event_name | ||
| ) |
Definition at line 106 of file prof_utils.c.
{
printf( "Profiling event : %s\n", event_name );
printf( "Profile Threshold: %d\n", threshold );
printf( "Profile Iters : %d\n",
( getenv( "NUM_ITERS" ) ? atoi( getenv( "NUM_ITERS" ) ) :
NUM_ITERS ) );
printf( "Profile Range : %p to %p\n", start, end );
printf
( "----------------------------------------------------------------\n" );
printf( "\n" );
}


| unsigned long prof_size | ( | unsigned long | plength, |
| unsigned | scale, | ||
| int | bucket, | ||
| int * | num_buckets | ||
| ) |
Definition at line 321 of file prof_utils.c.
{
unsigned long blength;
long long llength = ( ( long long ) plength * scale );
int bucket_size = prof_buckets( bucket );
*num_buckets = ( int ) ( llength / 65536 / 2 );
blength = ( unsigned long ) ( *num_buckets * bucket_size );
return ( blength );
}


| char event_name[PAPI_MAX_STR_LEN] |
Definition at line 25 of file prof_utils.c.
Definition at line 27 of file prof_utils.c.
| int PAPI_event |
Definition at line 26 of file prof_utils.c.
| void* profbuf[5] |
Definition at line 28 of file prof_utils.c.
| long long** values |
Definition at line 24 of file prof_utils.c.