earprofile.c File Reference

Include dependency graph for earprofile.c:

Go to the source code of this file.

Defines

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

Define 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.

00054 {
00055     int i, retval;
00056     unsigned long blength;
00057     int num_buckets;
00058     char *profstr[2] = { "PAPI_PROFIL_POSIX", "PAPI_PROFIL_INST_EAR" };
00059     int profflags[2] =
00060         { PAPI_PROFIL_POSIX, PAPI_PROFIL_POSIX | PAPI_PROFIL_INST_EAR };
00061     int num_profs;
00062 
00063     do_stuff(  );
00064 
00065     num_profs = sizeof ( profflags ) / sizeof ( int );
00066     ear_no_profile(  );
00067     blength = prof_size( plength, scale, bucket, &num_buckets );
00068     prof_alloc( num_profs, blength );
00069 
00070     for ( i = 0; i < num_profs; i++ ) {
00071         if ( !TESTS_QUIET )
00072             printf( "Test type   : \t%s\n", profstr[i] );
00073 
00074         if ( ( retval = PAPI_profil( profbuf[i], blength, start, scale,
00075                                      EventSet, PAPI_event, thresh,
00076                                      profflags[i] | bucket ) ) != PAPI_OK ) {
00077             test_fail( __FILE__, __LINE__, "PAPI_profil", retval );
00078         }
00079         if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
00080             test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00081 
00082         do_stuff(  );
00083 
00084         if ( ( retval = PAPI_stop( EventSet, values[1] ) ) != PAPI_OK )
00085             test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00086 
00087         if ( !TESTS_QUIET ) {
00088             printf( TAB1, event_name, ( values[1] )[0] );
00089             printf( TAB1, "PAPI_TOT_CYC:", ( values[1] )[1] );
00090         }
00091         if ( ( retval = PAPI_profil( profbuf[i], blength, start, scale,
00092                                      EventSet, PAPI_event, 0,
00093                                      profflags[i] ) ) != PAPI_OK )
00094             test_fail( __FILE__, __LINE__, "PAPI_profil", retval );
00095     }
00096 
00097     prof_head( blength, bucket, num_buckets,
00098                "address\t\t\tPOSIX\tINST_DEAR\n" );
00099     prof_out( start, num_profs, bucket, num_buckets, scale );
00100 
00101     retval = prof_check( num_profs, bucket, num_buckets );
00102 
00103     for ( i = 0; i < num_profs; i++ ) {
00104         free( profbuf[i] );
00105     }
00106 
00107     return ( retval );
00108 }

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.

00035 {
00036     int retval;
00037 
00038     if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
00039         test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00040 
00041     do_l1misses( 10000 );
00042 
00043     if ( ( retval = PAPI_stop( EventSet, values[0] ) ) != PAPI_OK )
00044         test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00045 
00046     printf( "Test type   : \tNo profiling\n" );
00047     printf( TAB1, event_name, ( values[0] )[0] );
00048     printf( TAB1, "PAPI_TOT_CYC:", ( values[0] )[1] );
00049 }

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.

00113 {
00114     int num_events, num_tests = 6;
00115     long length;
00116     int retval, retval2;
00117     const PAPI_hw_info_t *hw_info;
00118     const PAPI_exe_info_t *prginfo;
00119     caddr_t start, end;
00120 
00121     prof_init( argc, argv, &prginfo );
00122 
00123     if ( ( hw_info = PAPI_get_hardware_info(  ) ) == NULL ) {
00124        test_fail( __FILE__, __LINE__, "PAPI_get_hardware_info", 0 );
00125     }
00126 
00127     if ( ( strncasecmp( hw_info->model_string, "Itanium", strlen( "Itanium" ) )
00128            != 0 ) &&
00129          ( strncasecmp( hw_info->model_string, "32", strlen( "32" ) ) != 0 ) )
00130         test_skip( __FILE__, __LINE__, "Test unsupported", PAPI_ENOIMPL );
00131 
00132     if ( TESTS_QUIET ) {
00133        test_skip( __FILE__, __LINE__,
00134              "Test deprecated in quiet mode for PAPI 3.6", 0 );
00135 
00136     }
00137 
00138     sprintf( event_name, "DATA_EAR_CACHE_LAT4" );
00139     if ( ( retval =
00140            PAPI_event_name_to_code( event_name, &PAPI_event ) ) != PAPI_OK )
00141         test_fail( __FILE__, __LINE__, "PAPI_event_name_to_code", retval );
00142 
00143     if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK )
00144         test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
00145 
00146     if ( ( retval = PAPI_add_event( EventSet, PAPI_event ) ) != PAPI_OK )
00147         test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
00148 
00149     if ( ( retval = PAPI_add_event( EventSet, PAPI_TOT_CYC ) ) != PAPI_OK )
00150         test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
00151 
00152     num_events = 2;
00153     values = allocate_test_space( num_tests, num_events );
00154 
00155 /* use these lines to profile entire code address space */
00156     start = prginfo->address_info.text_start;
00157     end = prginfo->address_info.text_end;
00158     length = end - start;
00159     if ( length < 0 )
00160         test_fail( __FILE__, __LINE__, "Profile length < 0!", length );
00161 
00162     prof_print_address
00163         ( "Test earprofile: POSIX compatible event address register profiling.\n",
00164           prginfo );
00165     prof_print_prof_info( start, end, THRESHOLD, event_name );
00166     retval =
00167         do_profile( start, length, FULL_SCALE, THRESHOLD,
00168                     PAPI_PROFIL_BUCKET_16 );
00169 
00170     retval2 = PAPI_remove_event( EventSet, PAPI_event );
00171     if ( retval2 == PAPI_OK )
00172         retval2 = PAPI_remove_event( EventSet, PAPI_TOT_CYC );
00173     if ( retval2 != PAPI_OK )
00174         test_fail( __FILE__, __LINE__, "Can't remove events", retval2 );
00175 
00176     if ( retval )
00177         test_pass( __FILE__, values, num_tests );
00178     else
00179         test_fail( __FILE__, __LINE__, "No information in buffers", 1 );
00180     exit( 1 );
00181 }

Here is the call graph for this function:


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1