second.c File Reference

Include dependency graph for second.c:

Go to the source code of this file.

Defines

#define TAB_DOM   "%s%12lld%15lld%17lld\n"
#define CASE2   0
#define CREATE   1
#define ADD   2
#define MIDDLE   3
#define CHANGE   4
#define SUPERVISOR   5

Functions

void dump_and_verify (int test_case, long long **values)
void case1 (int num)
void case2 (int num, int domain, long long *values)
void case2_driver (void)
void case1_driver (void)
int main (int argc, char **argv)

Define Documentation

#define ADD   2

Definition at line 24 of file second.c.

#define CASE2   0

Definition at line 22 of file second.c.

#define CHANGE   4

Definition at line 26 of file second.c.

#define CREATE   1

Definition at line 23 of file second.c.

#define MIDDLE   3

Definition at line 25 of file second.c.

#define SUPERVISOR   5

Definition at line 27 of file second.c.

#define TAB_DOM   "%s%12lld%15lld%17lld\n"

Definition at line 20 of file second.c.


Function Documentation

void case1 ( int  num  ) 

Definition at line 135 of file second.c.

00136 {
00137     int retval, num_tests = 3;
00138     long long **values;
00139     int EventSet1 = PAPI_NULL, EventSet2 = PAPI_NULL, EventSet3 = PAPI_NULL;
00140     PAPI_option_t options;
00141     const PAPI_component_info_t *cmpinfo;
00142 
00143     memset( &options, 0x0, sizeof ( options ) );
00144 
00145     retval = PAPI_library_init( PAPI_VER_CURRENT );
00146     if ( retval != PAPI_VER_CURRENT )
00147         test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00148 
00149     /* get info from cpu component */
00150     cmpinfo = PAPI_get_component_info( 0 ); 
00151     if ( cmpinfo == NULL ) {
00152        test_fail( __FILE__, __LINE__,"PAPI_get_component_info", PAPI_ECMP);
00153     }
00154 
00155     if ( ( retval = PAPI_query_event( PAPI_TOT_INS ) ) != PAPI_OK )
00156         test_skip( __FILE__, __LINE__, "PAPI_query_event", retval );
00157 
00158     if ( ( retval = PAPI_query_event( PAPI_TOT_CYC ) ) != PAPI_OK )
00159         test_skip( __FILE__, __LINE__, "PAPI_query_event", retval );
00160 
00161     retval = PAPI_create_eventset( &EventSet1 );
00162     if ( retval == PAPI_OK )
00163         retval = PAPI_create_eventset( &EventSet2 );
00164     if ( retval == PAPI_OK )
00165         retval = PAPI_create_eventset( &EventSet3 );
00166     if ( retval != PAPI_OK )
00167         test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
00168 
00169     /* In Component PAPI, EventSets must be assigned a component index
00170        before you can fiddle with their internals. 0 is always the cpu component */
00171     retval = PAPI_assign_eventset_component( EventSet1, 0 );
00172     if ( retval == PAPI_OK )
00173         retval = PAPI_assign_eventset_component( EventSet2, 0 );
00174     if ( retval == PAPI_OK )
00175         retval = PAPI_assign_eventset_component( EventSet3, 0 );
00176     if ( retval != PAPI_OK )
00177         test_fail( __FILE__, __LINE__, "PAPI_assign_eventset_component",
00178                    retval );
00179 
00180     if ( num == CREATE ) {
00181         printf
00182             ( "\nTest case CREATE: Call PAPI_set_opt(PAPI_DOMAIN) on EventSet before add\n" );
00183         options.domain.eventset = EventSet1;
00184         options.domain.domain = PAPI_DOM_ALL;
00185 
00186         retval = PAPI_set_opt( PAPI_DOMAIN, &options );
00187         if ( retval != PAPI_OK )
00188             test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
00189 
00190         options.domain.eventset = EventSet2;
00191         options.domain.domain = PAPI_DOM_KERNEL;
00192 
00193         retval = PAPI_set_opt( PAPI_DOMAIN, &options );
00194         if ( retval != PAPI_OK )
00195             test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
00196 
00197         options.domain.eventset = EventSet3;
00198         options.domain.domain = PAPI_DOM_USER;
00199 
00200         retval = PAPI_set_opt( PAPI_DOMAIN, &options );
00201         if ( retval != PAPI_OK )
00202             test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
00203     }
00204 
00205     retval = PAPI_add_event( EventSet1, PAPI_TOT_INS );
00206     if ( retval != PAPI_OK )
00207         test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
00208 
00209     retval = PAPI_add_event( EventSet1, PAPI_TOT_CYC );
00210     if ( retval != PAPI_OK )
00211         test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_CYC)", retval );
00212 
00213     retval = PAPI_add_event( EventSet2, PAPI_TOT_INS );
00214     if ( retval != PAPI_OK )
00215         test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
00216 
00217     retval = PAPI_add_event( EventSet2, PAPI_TOT_CYC );
00218     if ( retval != PAPI_OK )
00219         test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_CYC)", retval );
00220 
00221     retval = PAPI_add_event( EventSet3, PAPI_TOT_INS );
00222     if ( retval != PAPI_OK )
00223         test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
00224 
00225     if ( num == MIDDLE ) {
00226         printf
00227             ( "\nTest case MIDDLE: Call PAPI_set_opt(PAPI_DOMAIN) on EventSet between adds\n" );
00228         options.domain.eventset = EventSet1;
00229         options.domain.domain = PAPI_DOM_ALL;
00230 
00231         retval = PAPI_set_opt( PAPI_DOMAIN, &options );
00232         if ( retval != PAPI_OK && retval != PAPI_ECMP ) {
00233            test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
00234         }
00235 
00236         options.domain.eventset = EventSet2;
00237         options.domain.domain = PAPI_DOM_KERNEL;
00238 
00239         retval = PAPI_set_opt( PAPI_DOMAIN, &options );
00240         if ( retval != PAPI_OK )
00241             test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
00242 
00243         options.domain.eventset = EventSet3;
00244         options.domain.domain = PAPI_DOM_USER;
00245 
00246         retval = PAPI_set_opt( PAPI_DOMAIN, &options );
00247         if ( retval != PAPI_OK )
00248             test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
00249     }
00250 
00251     retval = PAPI_add_event( EventSet3, PAPI_TOT_CYC );
00252     if ( retval != PAPI_OK )
00253         test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_CYC)", retval );
00254 
00255     if ( num == ADD ) {
00256         printf
00257             ( "\nTest case ADD: Call PAPI_set_opt(PAPI_DOMAIN) on EventSet after add\n" );
00258         options.domain.eventset = EventSet1;
00259         options.domain.domain = PAPI_DOM_ALL;
00260 
00261         retval = PAPI_set_opt( PAPI_DOMAIN, &options );
00262         if ( retval != PAPI_OK && retval != PAPI_ECMP ) {
00263            test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
00264         }
00265         options.domain.eventset = EventSet2;
00266         options.domain.domain = PAPI_DOM_KERNEL;
00267 
00268         retval = PAPI_set_opt( PAPI_DOMAIN, &options );
00269         if ( retval != PAPI_OK )
00270             test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
00271 
00272         options.domain.eventset = EventSet3;
00273         options.domain.domain = PAPI_DOM_USER;
00274 
00275         retval = PAPI_set_opt( PAPI_DOMAIN, &options );
00276         if ( retval != PAPI_OK )
00277             test_fail( __FILE__, __LINE__, "PAPI_set_opt", retval );
00278     }
00279 
00280     /* 2 events */
00281 
00282     values = allocate_test_space( num_tests, 2 );
00283 
00284     if ( num == CHANGE ) {
00285         /* This testcase is dependent on the CREATE testcase running immediately before it, using
00286          * domain settings of "All", "Kernel" and "User", on event sets 1, 2, and 3, respectively.
00287          */
00288         PAPI_option_t option;
00289         printf
00290             ( "\nTest case CHANGE 1: Change domain on EventSet between runs, using generic domain options:\n" );
00291         PAPI_start( EventSet1 );
00292         PAPI_stop( EventSet1, values[0] );
00293 
00294         // change EventSet1 domain from All  to User
00295         option.domain.domain = PAPI_DOM_USER;
00296         option.domain.eventset = EventSet1;
00297         retval = PAPI_set_opt( PAPI_DOMAIN, &option );
00298         if ( retval != PAPI_OK )
00299             test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
00300 
00301         PAPI_start( EventSet2 );
00302         PAPI_stop( EventSet2, values[1] );
00303 
00304         // change EventSet2 domain from Kernel to All
00305         option.domain.domain = PAPI_DOM_ALL;
00306         option.domain.eventset = EventSet2;
00307         retval = PAPI_set_opt( PAPI_DOMAIN, &option );
00308         if ( retval != PAPI_OK )
00309             test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
00310 
00311         PAPI_start( EventSet3 );
00312         PAPI_stop( EventSet3, values[2] );
00313 
00314         // change EventSet3 domain from User  to Kernel
00315         option.domain.domain = PAPI_DOM_KERNEL;
00316         option.domain.eventset = EventSet3;
00317         retval = PAPI_set_opt( PAPI_DOMAIN, &option );
00318         if ( retval != PAPI_OK )
00319             test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
00320 
00321         free_test_space( values, num_tests );
00322         values = allocate_test_space( num_tests, 2 );
00323 
00324     }
00325 
00326     if ( num == SUPERVISOR &&
00327          ( cmpinfo->available_domains & PAPI_DOM_SUPERVISOR ) ) {
00328         PAPI_option_t option;
00329 
00330         printf
00331             ( "\nTest case CHANGE 2: Change domain on EventSets to include/exclude supervisor events:\n" );
00332 
00333         option.domain.domain = PAPI_DOM_ALL;
00334         option.domain.eventset = EventSet1;
00335         retval = PAPI_set_opt( PAPI_DOMAIN, &option );
00336         if ( retval != PAPI_OK )
00337             test_fail( __FILE__, __LINE__, "PAPI_set_domain ALL ", retval );
00338 
00339         option.domain.domain = PAPI_DOM_ALL ^ PAPI_DOM_SUPERVISOR;
00340         option.domain.eventset = EventSet2;
00341         retval = PAPI_set_opt( PAPI_DOMAIN, &option );
00342         if ( retval != PAPI_OK ) {
00343 
00344                    /* DOM_ALL is special-cased as domains_available   */
00345                    /* in papi.c .  Some machines don't like DOM_OTHER */
00346                    /* so try that if the above case fails.            */
00347            option.domain.domain ^= PAPI_DOM_OTHER;
00348            option.domain.eventset = EventSet2;
00349            retval = PAPI_set_opt( PAPI_DOMAIN, &option );
00350 
00351                    if (retval != PAPI_OK) {
00352             test_fail( __FILE__, __LINE__, "PAPI_set_domain ALL^SUPERVISOR ", retval );
00353                    }
00354                 }
00355 
00356         option.domain.domain = PAPI_DOM_SUPERVISOR;
00357         option.domain.eventset = EventSet3;
00358         retval = PAPI_set_opt( PAPI_DOMAIN, &option );
00359         if ( retval != PAPI_OK )
00360             test_fail( __FILE__, __LINE__, "PAPI_set_domain SUPERVISOR ", retval );
00361 
00362         free_test_space( values, num_tests );
00363         values = allocate_test_space( num_tests, 2 );
00364     }
00365     /* Warm it up dude */
00366 
00367     PAPI_start( EventSet1 );
00368     do_flops( NUM_FLOPS );
00369     PAPI_stop( EventSet1, NULL );
00370 
00371     retval = PAPI_start( EventSet1 );
00372     if ( retval != PAPI_OK )
00373         test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00374 
00375     do_flops( NUM_FLOPS );
00376 
00377     retval = PAPI_stop( EventSet1, values[0] );
00378     if ( retval != PAPI_OK )
00379         test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00380 
00381     retval = PAPI_start( EventSet2 );
00382 
00383     do_flops( NUM_FLOPS );
00384 
00385     if ( retval == PAPI_OK ) {
00386         retval = PAPI_stop( EventSet2, values[1] );
00387         if ( retval != PAPI_OK )
00388             test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00389     } else {
00390         values[1][0] = retval;
00391         values[1][1] = retval;
00392     }
00393 
00394     retval = PAPI_start( EventSet3 );
00395     if ( retval != PAPI_OK )
00396         test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00397 
00398     do_flops( NUM_FLOPS );
00399 
00400     retval = PAPI_stop( EventSet3, values[2] );
00401     if ( retval != PAPI_OK )
00402         test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00403 
00404     retval = PAPI_cleanup_eventset( EventSet1 );
00405     if ( retval != PAPI_OK )
00406         test_fail( __FILE__, __LINE__, "PAPI_cleanup", retval );
00407 
00408     retval = PAPI_destroy_eventset( &EventSet1 );
00409     if ( retval != PAPI_OK )
00410         test_fail( __FILE__, __LINE__, "PAPI_destroy", retval );
00411 
00412     retval = PAPI_cleanup_eventset( EventSet2 );
00413     if ( retval != PAPI_OK )
00414         test_fail( __FILE__, __LINE__, "PAPI_cleanup", retval );
00415 
00416     retval = PAPI_destroy_eventset( &EventSet2 );
00417     if ( retval != PAPI_OK )
00418         test_fail( __FILE__, __LINE__, "PAPI_destroy", retval );
00419 
00420     retval = PAPI_cleanup_eventset( EventSet3 );
00421     if ( retval != PAPI_OK )
00422         test_fail( __FILE__, __LINE__, "PAPI_cleanup", retval );
00423 
00424     retval = PAPI_destroy_eventset( &EventSet3 );
00425     if ( retval != PAPI_OK )
00426         test_fail( __FILE__, __LINE__, "PAPI_destroy", retval );
00427 
00428     dump_and_verify( num, values );
00429 
00430     free(values);
00431 
00432     PAPI_shutdown(  );
00433 }

Here is the call graph for this function:

void case1_driver ( void   ) 

Definition at line 548 of file second.c.

00549 {
00550     case1( ADD );
00551     case1( MIDDLE );
00552     case1( CREATE );
00553     case1( CHANGE );
00554     case1( SUPERVISOR );
00555 }

Here is the call graph for this function:

Here is the caller graph for this function:

void case2 ( int  num,
int  domain,
long long *  values 
)

Definition at line 436 of file second.c.

00437 {
00438     int retval;
00439     int EventSet1 = PAPI_NULL;
00440     PAPI_option_t options;
00441 
00442     memset( &options, 0x0, sizeof ( options ) );
00443 
00444     retval = PAPI_library_init( PAPI_VER_CURRENT );
00445     if ( retval != PAPI_VER_CURRENT )
00446         test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00447 
00448     if ( ( retval = PAPI_query_event( PAPI_TOT_INS ) ) != PAPI_OK )
00449         test_skip( __FILE__, __LINE__, "PAPI_query_event", retval );
00450 
00451     if ( ( retval = PAPI_query_event( PAPI_TOT_CYC ) ) != PAPI_OK )
00452         test_skip( __FILE__, __LINE__, "PAPI_query_event", retval );
00453 
00454     if ( num == CREATE ) {
00455         printf
00456             ( "\nTest case 2, CREATE: Call PAPI_set_domain(%s) before create\n",
00457               stringify_domain( domain ) );
00458         printf
00459             ( "This should override the domain setting for this EventSet.\n" );
00460 
00461         retval = PAPI_set_domain( domain );
00462         if ( retval != PAPI_OK )
00463             test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
00464     }
00465 
00466     retval = PAPI_create_eventset( &EventSet1 );
00467     if ( retval != PAPI_OK )
00468         test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
00469 
00470     if ( num == ADD ) {
00471         printf( "\nTest case 2, ADD: Call PAPI_set_domain(%s) before add\n",
00472                 stringify_domain( domain ) );
00473         printf
00474             ( "This should have no effect on the domain setting for this EventSet.\n" );
00475 
00476         retval = PAPI_set_domain( domain );
00477         if ( retval != PAPI_OK )
00478             test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
00479     }
00480 
00481     retval = PAPI_add_event( EventSet1, PAPI_TOT_INS );
00482     if ( retval != PAPI_OK )
00483         test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
00484 
00485     if ( num == MIDDLE ) {
00486         printf
00487             ( "\nTest case 2, MIDDLE: Call PAPI_set_domain(%s) between adds\n",
00488               stringify_domain( domain ) );
00489         printf
00490             ( "This should have no effect on the domain setting for this EventSet.\n" );
00491 
00492         retval = PAPI_set_domain( domain );
00493         if ( retval != PAPI_OK )
00494             test_fail( __FILE__, __LINE__, "PAPI_set_domain", retval );
00495     }
00496 
00497     retval = PAPI_add_event( EventSet1, PAPI_TOT_CYC );
00498     if ( retval != PAPI_OK )
00499         test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_CYC)", retval );
00500 
00501 
00502     /* Warm it up dude */
00503 
00504     PAPI_start( EventSet1 );
00505     do_flops( NUM_FLOPS );
00506     PAPI_stop( EventSet1, NULL );
00507 
00508     retval = PAPI_start( EventSet1 );
00509     if ( retval != PAPI_OK )
00510         test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00511 
00512     do_flops( NUM_FLOPS );
00513 
00514     retval = PAPI_stop( EventSet1, values );
00515     if ( retval != PAPI_OK )
00516         test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00517 
00518     retval = PAPI_cleanup_eventset( EventSet1 );
00519     if ( retval != PAPI_OK )
00520         test_fail( __FILE__, __LINE__, "PAPI_cleanup", retval );
00521 
00522     retval = PAPI_destroy_eventset( &EventSet1 );
00523     if ( retval != PAPI_OK )
00524         test_fail( __FILE__, __LINE__, "PAPI_destroy", retval );
00525 
00526     PAPI_shutdown(  );
00527 }

Here is the call graph for this function:

void case2_driver ( void   ) 

Definition at line 530 of file second.c.

00531 {
00532     long long **values;
00533 
00534     /* 3 tests, 2 events */
00535 
00536     values = allocate_test_space( 3, 2 );
00537 
00538     case2( CREATE, PAPI_DOM_KERNEL, values[0] );
00539     case2( ADD, PAPI_DOM_KERNEL, values[1] );
00540     case2( MIDDLE, PAPI_DOM_KERNEL, values[2] );
00541 
00542     dump_and_verify( CASE2, values );
00543 
00544     free(values);
00545 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dump_and_verify ( int  test_case,
long long **  values 
)

Definition at line 30 of file second.c.

00031 {
00032     long long min, max, min2, max2;
00033 
00034     printf
00035         ( "-----------------------------------------------------------------\n" );
00036     printf( "Using %d iterations of c += a*b\n", NUM_FLOPS );
00037     printf( "-------------------------------------------------------------\n" );
00038 
00039     if ( test_case == CASE2 ) {
00040         printf
00041             ( "Test type   :   Before Create   Before Add       Between Adds\n" );
00042         printf( TAB_DOM, "PAPI_TOT_INS: ", ( values[0] )[0], ( values[1] )[0],
00043                 ( values[2] )[0] );
00044         printf( TAB_DOM, "PAPI_TOT_CYC: ", ( values[0] )[1], ( values[1] )[1],
00045                 ( values[2] )[1] );
00046         printf
00047             ( "-------------------------------------------------------------\n" );
00048         printf( "Verification:\n" );
00049         printf( "Both rows equal 'n  N  N' where n << N\n" );
00050         return;
00051     } else if ( test_case == CHANGE ) {
00052         min = ( long long ) ( ( double ) values[0][0] * ( 1 - TOLERANCE ) );
00053         max = ( long long ) ( ( double ) values[0][0] * ( 1 + TOLERANCE ) );
00054         if ( values[1][0] > max || values[1][0] < min )
00055             test_fail( __FILE__, __LINE__, "PAPI_TOT_INS", 1 );
00056 
00057         min = ( long long ) ( ( double ) values[1][1] * ( 1 - TOLERANCE ) );
00058         max = ( long long ) ( ( double ) values[1][1] * ( 1 + TOLERANCE ) );
00059         if ( ( values[2][1] + values[0][1] ) > max ||
00060              ( values[2][1] + values[0][1] ) < min )
00061             test_fail( __FILE__, __LINE__, "PAPI_TOT_CYC", 1 );
00062 
00063         printf
00064             ( "Test type   :   PAPI_DOM_ALL  PAPI_DOM_KERNEL  PAPI_DOM_USER\n" );
00065         printf( TAB_DOM, "PAPI_TOT_INS: ", ( values[1] )[0], ( values[2] )[0],
00066                 ( values[0] )[0] );
00067         printf( TAB_DOM, "PAPI_TOT_CYC: ", ( values[1] )[1], ( values[2] )[1],
00068                 ( values[0] )[1] );
00069         printf
00070             ( "-------------------------------------------------------------\n" );
00071 
00072         printf( "Verification:\n" );
00073         printf( "Both rows approximately equal '(N+n)  n  N', where n << N\n" );
00074         printf( "Column 1 approximately equals column 2 plus column 3\n" );
00075     } else if ( test_case == SUPERVISOR ) {
00076         printf
00077             ( "Test type   :   PAPI_DOM_ALL  All-minus-supervisor  Supervisor-only\n" );
00078         printf( TAB_DOM, "PAPI_TOT_INS: ", ( values[0] )[0], ( values[1] )[0],
00079                 ( values[2] )[0] );
00080         printf( TAB_DOM, "PAPI_TOT_CYC: ", ( values[0] )[1], ( values[1] )[1],
00081                 ( values[2] )[1] );
00082         printf
00083             ( "-------------------------------------------------------------\n" );
00084         printf( "Verification:\n" );
00085         printf( "Both rows approximately equal '(N+n)  n  N', where n << N\n" );
00086         printf( "Column 1 approximately equals column 2 plus column 3\n" );
00087     } else {
00088         min = ( long long ) ( ( double ) values[2][0] * ( 1 - TOLERANCE ) );
00089         max = ( long long ) ( ( double ) values[2][0] * ( 1 + TOLERANCE ) );
00090 
00091         min2 = ( long long ) ( ( double ) values[0][1] * ( 1 - TOLERANCE ) );
00092         max2 =
00093             ( long long ) ( ( double ) ( double ) values[0][1] *
00094                             ( 1 + TOLERANCE ) );
00095 
00096         printf
00097             ( "Test type   :   PAPI_DOM_ALL  PAPI_DOM_KERNEL  PAPI_DOM_USER\n" );
00098         printf( TAB_DOM, "PAPI_TOT_INS: ", ( values[0] )[0], ( values[1] )[0],
00099                 ( values[2] )[0] );
00100         printf( TAB_DOM, "PAPI_TOT_CYC: ", ( values[0] )[1], ( values[1] )[1],
00101                 ( values[2] )[1] );
00102         printf
00103             ( "-------------------------------------------------------------\n" );
00104         printf( "Verification:\n" );
00105         printf( "Both rows approximately equal '(N+n)  n  N', where n << N\n" );
00106         printf( "Column 1 approximately equals column 2 plus column 3\n" );
00107 
00108         if ( values[0][0] > max || values[0][0] < min )
00109             test_fail( __FILE__, __LINE__, "PAPI_TOT_INS", 1 );
00110 
00111         if ( ( values[1][1] + values[2][1] ) > max2 ||
00112              ( values[1][1] + values[2][1] ) < min2 )
00113             test_fail( __FILE__, __LINE__, "PAPI_TOT_CYC", 1 );
00114     }
00115 
00116     if ( values[0][0] == 0 || values[0][1] == 0 ||
00117          values[1][0] == 0 || values[1][1] == 0 )
00118         test_fail( __FILE__, __LINE__,
00119                    "Verify non-zero count for all domain types", 1 );
00120 
00121     if ( values[2][0] == 0 || values[2][1] == 0 ) {
00122         if ( test_case == SUPERVISOR ) {
00123             printf
00124                 ( "WARNING: No events counted in supervisor context.  This is expected in a non-virtualized environment.\n" );
00125         } else {
00126             test_fail( __FILE__, __LINE__,
00127                        "Verify non-zero count for all domain types", 1 );
00128         }
00129     }
00130 }

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 558 of file second.c.

00559 {
00560     tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */
00561 
00562 #if defined(sgi) && defined(host_mips)
00563     uid_t id;
00564     id = getuid(  );
00565     if ( id != 0 ) {
00566         printf( "IRIX requires root for PAPI_DOM_KERNEL and PAPI_DOM_ALL.\n" );
00567         test_skip( __FILE__, __LINE__, "", 1 );
00568     }
00569 #endif
00570 
00571     printf
00572         ( "Test second.c: set domain of eventset via PAPI_set_domain and PAPI_set_opt.\n\n" );
00573     printf
00574         ( "* PAPI_set_domain(DOMAIN) sets the default domain \napplied to subsequently created EventSets.\n" );
00575     printf( "It should have no effect on existing EventSets.\n\n" );
00576     printf
00577         ( "* PAPI_set_opt(DOMAIN,xxx) sets the domain for a specific EventSet.\n" );
00578     printf
00579         ( "It should always override the default setting for that EventSet.\n" );
00580     case2_driver(  );
00581     case1_driver(  );
00582 
00583     test_pass( __FILE__, NULL, 0 );
00584     exit( 1 );
00585 }

Here is the call graph for this function:


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1