PAPI_get_real_cyc.c File Reference

Include dependency graph for PAPI_get_real_cyc.c:

Go to the source code of this file.

Functions

int your_slow_code ()
int main ()

Function Documentation

int main (  ) 

Definition at line 21 of file PAPI_get_real_cyc.c.

00022 {
00023    long long s,s1, e, e1;
00024    int retval;
00025 
00026 
00027    /****************************************************************************
00028    *  This part initializes the library and compares the version number of the *
00029    * header file, to the version of the library, if these don't match then it  *
00030    * is likely that PAPI won't work correctly.If there is an error, retval     *
00031    * keeps track of the version number.                                        *
00032    ****************************************************************************/
00033 
00034    if((retval = PAPI_library_init(PAPI_VER_CURRENT)) != PAPI_VER_CURRENT )
00035    {
00036       printf("Library initialization error! \n");
00037       exit(1);
00038    }
00039         
00040    /* Here you get initial cycles and time */
00041    /* No error checking is done here because this function call is always 
00042       successful */
00043 
00044    s = PAPI_get_real_cyc();
00045 
00046    your_slow_code();
00047   
00048    /*Here you get final cycles and time    */
00049    e = PAPI_get_real_cyc();
00050 
00051    s1= PAPI_get_real_usec();
00052 
00053    your_slow_code();
00054 
00055    e1= PAPI_get_real_usec();
00056 
00057    printf("Wallclock cycles  : %lld\nWallclock time(ms): %lld\n",e-s,e1-s1);
00058 
00059    /* clean up */
00060    PAPI_shutdown();
00061 
00062    exit(0);
00063 }

Here is the call graph for this function:

int your_slow_code (  ) 

Definition at line 10 of file PAPI_get_real_cyc.c.

00011 {
00012    int i,tmp;
00013 
00014    for(i=1; i<20000; i++)
00015    {
00016       tmp=(tmp+100)/i;
00017    }
00018    return 0;
00019 }


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1