perf_event_user_kernel.c File Reference

Include dependency graph for perf_event_user_kernel.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 9 of file perf_event_user_kernel.c.

00009                                   {
00010 
00011 
00012    char *instructions_event=NULL;
00013    char event_name[BUFSIZ];
00014 
00015    char user_event[BUFSIZ];
00016    char kernel_event[BUFSIZ];
00017    char user_kernel_event[BUFSIZ];
00018 
00019 
00020    int retval;
00021 
00022    /* Default Domain */
00023    int EventSet_default = PAPI_NULL;
00024    int EventSet_default_user = PAPI_NULL;
00025    int EventSet_default_kernel = PAPI_NULL;
00026    int EventSet_default_user_kernel = PAPI_NULL;
00027    long long default_values[1];
00028    long long default_user_values[1];
00029    long long default_kernel_values[1];
00030    long long default_user_kernel_values[1];
00031 
00032    /* User Domain */
00033    int EventSet_user = PAPI_NULL;
00034    int EventSet_user_user = PAPI_NULL;
00035    int EventSet_user_kernel = PAPI_NULL;
00036    int EventSet_user_user_kernel = PAPI_NULL;
00037    long long user_values[1];
00038    long long user_user_values[1];
00039    long long user_kernel_values[1];
00040    long long user_user_kernel_values[1];
00041 
00042    /* Kernel Domain */
00043    int EventSet_kernel = PAPI_NULL;
00044    int EventSet_kernel_user = PAPI_NULL;
00045    int EventSet_kernel_kernel = PAPI_NULL;
00046    int EventSet_kernel_user_kernel = PAPI_NULL;
00047    long long kernel_values[1];
00048    long long kernel_user_values[1];
00049    long long kernel_kernel_values[1];
00050    long long kernel_user_kernel_values[1];
00051 
00052    /* All Domain */
00053    int EventSet_all = PAPI_NULL;
00054    int EventSet_all_user = PAPI_NULL;
00055    int EventSet_all_kernel = PAPI_NULL;
00056    int EventSet_all_user_kernel = PAPI_NULL;
00057    long long all_values[1];
00058    long long all_user_values[1];
00059    long long all_kernel_values[1];
00060    long long all_user_kernel_values[1];
00061 
00062    /* Two Events */
00063    int EventSet_two = PAPI_NULL;
00064    long long two_values[2];
00065 
00066    /* Set TESTS_QUIET variable */
00067    tests_quiet( argc, argv );
00068 
00069    /* Init the PAPI library */
00070    retval = PAPI_library_init( PAPI_VER_CURRENT );
00071    if ( retval != PAPI_VER_CURRENT ) {
00072       test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00073    }
00074 
00075 
00076    /* Get a relevant event name */
00077    instructions_event=get_instructions_event(event_name, BUFSIZ);
00078    if (instructions_event==NULL) {
00079       test_skip( __FILE__, __LINE__,
00080                 "No instructions event definition for this arch", 
00081          PAPI_ENOSUPP );
00082    }
00083 
00084    sprintf(user_event,"%s:u=1",instructions_event);
00085    sprintf(kernel_event,"%s:k=1",instructions_event);
00086    sprintf(user_kernel_event,"%s:u=1:k=1",instructions_event);
00087 
00088    /*********************************/
00089    /* Two Events                    */
00090    /*********************************/
00091 
00092    if (!TESTS_QUIET) {
00093       printf("\tTwo Events in same EventSet\n");
00094    }
00095 
00096    retval = PAPI_create_eventset(&EventSet_two);
00097    if (retval != PAPI_OK) {
00098       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00099    }
00100 
00101 
00102    retval = PAPI_add_named_event(EventSet_two, user_event);
00103    if (retval != PAPI_OK) {
00104       if ( !TESTS_QUIET ) {
00105      fprintf(stderr,"Error trying to add %s\n",user_event);
00106       }
00107       test_fail(__FILE__, __LINE__, "adding user event ",retval);
00108    }
00109    retval = PAPI_add_named_event(EventSet_two, kernel_event);
00110    if (retval != PAPI_OK) {
00111       if ( !TESTS_QUIET ) {
00112      fprintf(stderr,"Error trying to add %s\n",kernel_event);
00113       }
00114       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00115    }
00116 
00117    retval = PAPI_start( EventSet_two );
00118    if ( retval != PAPI_OK ) {
00119       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00120    }
00121 
00122    do_flops( NUM_FLOPS );
00123 
00124    retval = PAPI_stop( EventSet_two, two_values );
00125    if ( retval != PAPI_OK ) {
00126       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00127    }
00128 
00129    if ( !TESTS_QUIET ) {
00130      printf("\t\t%s count = %lld, %s count = %lld\n",
00131         user_event,two_values[0],
00132         kernel_event,two_values[1]);
00133    }
00134 
00135 
00136    /*********************************/
00137    /* Default Domain, Default Event */
00138    /*********************************/
00139 
00140    if (!TESTS_QUIET) {
00141       printf("\tDefault Domain\n");
00142    }
00143 
00144    retval = PAPI_create_eventset(&EventSet_default);
00145    if (retval != PAPI_OK) {
00146       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00147    }
00148 
00149 
00150    retval = PAPI_add_named_event(EventSet_default, instructions_event);
00151    if (retval != PAPI_OK) {
00152       if ( !TESTS_QUIET ) {
00153      fprintf(stderr,"Error trying to add %s\n",instructions_event);
00154       }
00155       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00156    }
00157 
00158    retval = PAPI_start( EventSet_default );
00159    if ( retval != PAPI_OK ) {
00160       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00161    }
00162 
00163    do_flops( NUM_FLOPS );
00164 
00165    retval = PAPI_stop( EventSet_default, default_values );
00166    if ( retval != PAPI_OK ) {
00167       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00168    }
00169 
00170    if ( !TESTS_QUIET ) {
00171      printf("\t\t%s count = %lld\n",instructions_event,default_values[0]);
00172    }
00173 
00174 
00175    /*********************************/
00176    /* Default Domain, User Event */
00177    /*********************************/
00178 
00179    retval = PAPI_create_eventset(&EventSet_default_user);
00180    if (retval != PAPI_OK) {
00181       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00182    }
00183 
00184 
00185    retval = PAPI_add_named_event(EventSet_default_user, user_event);
00186    if (retval != PAPI_OK) {
00187       if ( !TESTS_QUIET ) {
00188      fprintf(stderr,"Error trying to add %s\n",user_event);
00189       }
00190       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00191    }
00192 
00193    retval = PAPI_start( EventSet_default_user );
00194    if ( retval != PAPI_OK ) {
00195       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00196    }
00197 
00198    do_flops( NUM_FLOPS );
00199 
00200    retval = PAPI_stop( EventSet_default_user, default_user_values );
00201    if ( retval != PAPI_OK ) {
00202       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00203    }
00204 
00205    if ( !TESTS_QUIET ) {
00206      printf("\t\t%s count = %lld\n",user_event,default_user_values[0]);
00207    }
00208 
00209    /*********************************/
00210    /* Default Domain, Kernel Event */
00211    /*********************************/
00212 
00213    retval = PAPI_create_eventset(&EventSet_default_kernel);
00214    if (retval != PAPI_OK) {
00215       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00216    }
00217 
00218 
00219    retval = PAPI_add_named_event(EventSet_default_kernel, kernel_event);
00220    if (retval != PAPI_OK) {
00221       if ( !TESTS_QUIET ) {
00222      fprintf(stderr,"Error trying to add %s\n",kernel_event);
00223       }
00224       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00225    }
00226 
00227    retval = PAPI_start( EventSet_default_kernel );
00228    if ( retval != PAPI_OK ) {
00229       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00230    }
00231 
00232    do_flops( NUM_FLOPS );
00233 
00234    retval = PAPI_stop( EventSet_default_kernel, default_kernel_values );
00235    if ( retval != PAPI_OK ) {
00236       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00237    }
00238 
00239    if ( !TESTS_QUIET ) {
00240      printf("\t\t%s count = %lld\n",kernel_event,default_kernel_values[0]);
00241    }
00242 
00243    /*****************************************/
00244    /* Default Domain, user and Kernel Event */
00245    /*****************************************/
00246 
00247 
00248    retval = PAPI_create_eventset(&EventSet_default_user_kernel);
00249    if (retval != PAPI_OK) {
00250       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00251    }
00252 
00253 
00254    retval = PAPI_add_named_event(EventSet_default_user_kernel, user_kernel_event);
00255    if (retval != PAPI_OK) {
00256       if ( !TESTS_QUIET ) {
00257      fprintf(stderr,"Error trying to add %s\n",user_kernel_event);
00258       }
00259       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00260    }
00261 
00262    retval = PAPI_start( EventSet_default_user_kernel );
00263    if ( retval != PAPI_OK ) {
00264       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00265    }
00266 
00267    do_flops( NUM_FLOPS );
00268 
00269    retval = PAPI_stop( EventSet_default_user_kernel, default_user_kernel_values );
00270    if ( retval != PAPI_OK ) {
00271       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00272    }
00273 
00274    if ( !TESTS_QUIET ) {
00275      printf("\t\t%s count = %lld\n",user_kernel_event,default_user_kernel_values[0]);
00276    }
00277 
00278    /*********************************/
00279    /* User Domain, Default Event    */
00280    /*********************************/
00281 
00282    if (!TESTS_QUIET) {
00283       printf("\tPAPI_DOM_USER Domain\n");
00284    }
00285 
00286    retval=PAPI_set_cmp_domain(PAPI_DOM_USER, 0);
00287 
00288    retval = PAPI_create_eventset(&EventSet_user);
00289    if (retval != PAPI_OK) {
00290       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00291    }
00292 
00293 
00294    retval = PAPI_add_named_event(EventSet_user, instructions_event);
00295    if (retval != PAPI_OK) {
00296       if ( !TESTS_QUIET ) {
00297      fprintf(stderr,"Error trying to add %s\n",instructions_event);
00298       }
00299       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00300    }
00301 
00302    retval = PAPI_start( EventSet_user );
00303    if ( retval != PAPI_OK ) {
00304       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00305    }
00306 
00307    do_flops( NUM_FLOPS );
00308 
00309    retval = PAPI_stop( EventSet_user, user_values );
00310    if ( retval != PAPI_OK ) {
00311       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00312    }
00313 
00314    if ( !TESTS_QUIET ) {
00315      printf("\t\t%s count = %lld\n",instructions_event,user_values[0]);
00316    }
00317 
00318 
00319    /*********************************/
00320    /* User Domain, User Event       */
00321    /*********************************/
00322 
00323    retval = PAPI_create_eventset(&EventSet_user_user);
00324    if (retval != PAPI_OK) {
00325       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00326    }
00327 
00328 
00329    retval = PAPI_add_named_event(EventSet_user_user, user_event);
00330    if (retval != PAPI_OK) {
00331       if ( !TESTS_QUIET ) {
00332      fprintf(stderr,"Error trying to add %s\n",user_event);
00333       }
00334       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00335    }
00336 
00337    retval = PAPI_start( EventSet_user_user );
00338    if ( retval != PAPI_OK ) {
00339       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00340    }
00341 
00342    do_flops( NUM_FLOPS );
00343 
00344    retval = PAPI_stop( EventSet_user_user, user_user_values );
00345    if ( retval != PAPI_OK ) {
00346       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00347    }
00348 
00349    if ( !TESTS_QUIET ) {
00350      printf("\t\t%s count = %lld\n",user_event,user_user_values[0]);
00351    }
00352 
00353    /*********************************/
00354    /* User Domain, Kernel Event     */
00355    /*********************************/
00356 
00357    retval = PAPI_create_eventset(&EventSet_user_kernel);
00358    if (retval != PAPI_OK) {
00359       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00360    }
00361 
00362 
00363    retval = PAPI_add_named_event(EventSet_user_kernel, kernel_event);
00364    if (retval != PAPI_OK) {
00365       if ( !TESTS_QUIET ) {
00366      fprintf(stderr,"Error trying to add %s\n",user_event);
00367       }
00368       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00369    }
00370 
00371    retval = PAPI_start( EventSet_user_kernel );
00372    if ( retval != PAPI_OK ) {
00373       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00374    }
00375 
00376    do_flops( NUM_FLOPS );
00377 
00378    retval = PAPI_stop( EventSet_user_kernel, user_kernel_values );
00379    if ( retval != PAPI_OK ) {
00380       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00381    }
00382 
00383    if ( !TESTS_QUIET ) {
00384      printf("\t\t%s count = %lld\n",kernel_event,user_kernel_values[0]);
00385    }
00386 
00387    /*****************************************/
00388    /* User Domain, user and Kernel Event    */
00389    /*****************************************/
00390 
00391    retval = PAPI_create_eventset(&EventSet_user_user_kernel);
00392    if (retval != PAPI_OK) {
00393       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00394    }
00395 
00396 
00397    retval = PAPI_add_named_event(EventSet_user_user_kernel, user_kernel_event);
00398    if (retval != PAPI_OK) {
00399       if ( !TESTS_QUIET ) {
00400      fprintf(stderr,"Error trying to add %s\n",user_kernel_event);
00401       }
00402       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00403    }
00404 
00405    retval = PAPI_start( EventSet_user_user_kernel );
00406    if ( retval != PAPI_OK ) {
00407       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00408    }
00409 
00410    do_flops( NUM_FLOPS );
00411 
00412    retval = PAPI_stop( EventSet_user_user_kernel, user_user_kernel_values );
00413    if ( retval != PAPI_OK ) {
00414       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00415    }
00416 
00417    if ( !TESTS_QUIET ) {
00418      printf("\t\t%s count = %lld\n",user_kernel_event,user_user_kernel_values[0]);
00419    }
00420 
00421    /*********************************/
00422    /* Kernel Domain, Default Event  */
00423    /*********************************/
00424 
00425    if (!TESTS_QUIET) {
00426       printf("\tPAPI_DOM_KERNEL Domain\n");
00427    }
00428 
00429    retval=PAPI_set_cmp_domain(PAPI_DOM_KERNEL, 0);
00430 
00431    retval = PAPI_create_eventset(&EventSet_kernel);
00432    if (retval != PAPI_OK) {
00433       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00434    }
00435 
00436 
00437    retval = PAPI_add_named_event(EventSet_kernel, instructions_event);
00438    if (retval != PAPI_OK) {
00439       if ( !TESTS_QUIET ) {
00440      fprintf(stderr,"Error trying to add %s\n",instructions_event);
00441       }
00442       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00443    }
00444 
00445    retval = PAPI_start( EventSet_kernel );
00446    if ( retval != PAPI_OK ) {
00447       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00448    }
00449 
00450    do_flops( NUM_FLOPS );
00451 
00452    retval = PAPI_stop( EventSet_kernel, kernel_values );
00453    if ( retval != PAPI_OK ) {
00454       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00455    }
00456 
00457    if ( !TESTS_QUIET ) {
00458      printf("\t\t%s count = %lld\n",instructions_event,kernel_values[0]);
00459    }
00460 
00461 
00462    /*********************************/
00463    /* Kernel Domain, User Event     */
00464    /*********************************/
00465 
00466    retval = PAPI_create_eventset(&EventSet_kernel_user);
00467    if (retval != PAPI_OK) {
00468       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00469    }
00470 
00471 
00472    retval = PAPI_add_named_event(EventSet_kernel_user, user_event);
00473    if (retval != PAPI_OK) {
00474       if ( !TESTS_QUIET ) {
00475      fprintf(stderr,"Error trying to add %s\n",user_event);
00476       }
00477       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00478    }
00479 
00480    retval = PAPI_start( EventSet_kernel_user );
00481    if ( retval != PAPI_OK ) {
00482       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00483    }
00484 
00485    do_flops( NUM_FLOPS );
00486 
00487    retval = PAPI_stop( EventSet_kernel_user, kernel_user_values );
00488    if ( retval != PAPI_OK ) {
00489       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00490    }
00491 
00492    if ( !TESTS_QUIET ) {
00493      printf("\t\t%s count = %lld\n",user_event,kernel_user_values[0]);
00494    }
00495 
00496    /*********************************/
00497    /* Kernel Domain, Kernel Event   */
00498    /*********************************/
00499 
00500    retval = PAPI_create_eventset(&EventSet_kernel_kernel);
00501    if (retval != PAPI_OK) {
00502       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00503    }
00504 
00505 
00506    retval = PAPI_add_named_event(EventSet_kernel_kernel, kernel_event);
00507    if (retval != PAPI_OK) {
00508       if ( !TESTS_QUIET ) {
00509      fprintf(stderr,"Error trying to add %s\n",user_event);
00510       }
00511       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00512    }
00513 
00514    retval = PAPI_start( EventSet_kernel_kernel );
00515    if ( retval != PAPI_OK ) {
00516       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00517    }
00518 
00519    do_flops( NUM_FLOPS );
00520 
00521    retval = PAPI_stop( EventSet_kernel_kernel, kernel_kernel_values );
00522    if ( retval != PAPI_OK ) {
00523       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00524    }
00525 
00526    if ( !TESTS_QUIET ) {
00527      printf("\t\t%s count = %lld\n",kernel_event,kernel_kernel_values[0]);
00528    }
00529 
00530    /*****************************************/
00531    /* Kernel Domain, user and Kernel Event  */
00532    /*****************************************/
00533 
00534    retval = PAPI_create_eventset(&EventSet_kernel_user_kernel);
00535    if (retval != PAPI_OK) {
00536       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00537    }
00538 
00539 
00540    retval = PAPI_add_named_event(EventSet_kernel_user_kernel, user_kernel_event);
00541    if (retval != PAPI_OK) {
00542       if ( !TESTS_QUIET ) {
00543      fprintf(stderr,"Error trying to add %s\n",user_kernel_event);
00544       }
00545       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00546    }
00547 
00548    retval = PAPI_start( EventSet_kernel_user_kernel );
00549    if ( retval != PAPI_OK ) {
00550       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00551    }
00552 
00553    do_flops( NUM_FLOPS );
00554 
00555    retval = PAPI_stop( EventSet_kernel_user_kernel, kernel_user_kernel_values );
00556    if ( retval != PAPI_OK ) {
00557       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00558    }
00559 
00560    if ( !TESTS_QUIET ) {
00561      printf("\t\t%s count = %lld\n",user_kernel_event,kernel_user_kernel_values[0]);
00562    }
00563 
00564    /*********************************/
00565    /* All Domain, Default Event  */
00566    /*********************************/
00567 
00568    if (!TESTS_QUIET) {
00569       printf("\tPAPI_DOM_ALL Domain\n");
00570    }
00571 
00572    retval=PAPI_set_cmp_domain(PAPI_DOM_ALL, 0);
00573 
00574    retval = PAPI_create_eventset(&EventSet_all);
00575    if (retval != PAPI_OK) {
00576       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00577    }
00578 
00579 
00580    retval = PAPI_add_named_event(EventSet_all, instructions_event);
00581    if (retval != PAPI_OK) {
00582       if ( !TESTS_QUIET ) {
00583      fprintf(stderr,"Error trying to add %s\n",instructions_event);
00584       }
00585       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00586    }
00587 
00588    retval = PAPI_start( EventSet_all );
00589    if ( retval != PAPI_OK ) {
00590       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00591    }
00592 
00593    do_flops( NUM_FLOPS );
00594 
00595    retval = PAPI_stop( EventSet_all, all_values );
00596    if ( retval != PAPI_OK ) {
00597       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00598    }
00599 
00600    if ( !TESTS_QUIET ) {
00601      printf("\t\t%s count = %lld\n",instructions_event,all_values[0]);
00602    }
00603 
00604 
00605    /*********************************/
00606    /* All Domain, User Event        */
00607    /*********************************/
00608 
00609    retval = PAPI_create_eventset(&EventSet_all_user);
00610    if (retval != PAPI_OK) {
00611       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00612    }
00613 
00614 
00615    retval = PAPI_add_named_event(EventSet_all_user, user_event);
00616    if (retval != PAPI_OK) {
00617       if ( !TESTS_QUIET ) {
00618      fprintf(stderr,"Error trying to add %s\n",user_event);
00619       }
00620       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00621    }
00622 
00623    retval = PAPI_start( EventSet_all_user );
00624    if ( retval != PAPI_OK ) {
00625       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00626    }
00627 
00628    do_flops( NUM_FLOPS );
00629 
00630    retval = PAPI_stop( EventSet_all_user, all_user_values );
00631    if ( retval != PAPI_OK ) {
00632       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00633    }
00634 
00635    if ( !TESTS_QUIET ) {
00636      printf("\t\t%s count = %lld\n",user_event,all_user_values[0]);
00637    }
00638 
00639    /*********************************/
00640    /* All Domain, Kernel Event      */
00641    /*********************************/
00642 
00643    retval = PAPI_create_eventset(&EventSet_all_kernel);
00644    if (retval != PAPI_OK) {
00645       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00646    }
00647 
00648 
00649    retval = PAPI_add_named_event(EventSet_all_kernel, kernel_event);
00650    if (retval != PAPI_OK) {
00651       if ( !TESTS_QUIET ) {
00652      fprintf(stderr,"Error trying to add %s\n",user_event);
00653       }
00654       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00655    }
00656 
00657    retval = PAPI_start( EventSet_all_kernel );
00658    if ( retval != PAPI_OK ) {
00659       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00660    }
00661 
00662    do_flops( NUM_FLOPS );
00663 
00664    retval = PAPI_stop( EventSet_all_kernel, all_kernel_values );
00665    if ( retval != PAPI_OK ) {
00666       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00667    }
00668 
00669    if ( !TESTS_QUIET ) {
00670      printf("\t\t%s count = %lld\n",kernel_event,all_kernel_values[0]);
00671    }
00672 
00673    /*****************************************/
00674    /* All Domain, user and Kernel Event     */
00675    /*****************************************/
00676 
00677    retval = PAPI_create_eventset(&EventSet_all_user_kernel);
00678    if (retval != PAPI_OK) {
00679       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00680    }
00681 
00682 
00683    retval = PAPI_add_named_event(EventSet_all_user_kernel, user_kernel_event);
00684    if (retval != PAPI_OK) {
00685       if ( !TESTS_QUIET ) {
00686      fprintf(stderr,"Error trying to add %s\n",user_kernel_event);
00687       }
00688       test_fail(__FILE__, __LINE__, "adding instructions event ",retval);
00689    }
00690 
00691    retval = PAPI_start( EventSet_all_user_kernel );
00692    if ( retval != PAPI_OK ) {
00693       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00694    }
00695 
00696    do_flops( NUM_FLOPS );
00697 
00698    retval = PAPI_stop( EventSet_all_user_kernel, all_user_kernel_values );
00699    if ( retval != PAPI_OK ) {
00700       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00701    }
00702 
00703    if ( !TESTS_QUIET ) {
00704      printf("\t\t%s count = %lld\n",user_kernel_event,all_user_kernel_values[0]);
00705    }
00706 
00707    /**************/
00708    /* Validation */
00709    /**************/
00710 
00711    //TODO
00712 
00713    test_pass( __FILE__, NULL, 0 );
00714 
00715    return 0;
00716 }

Here is the call graph for this function:


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1