PAPI_get_virt_cyc.c File Reference

Include dependency graph for PAPI_get_virt_cyc.c:

Go to the source code of this file.

Functions

int your_slow_code ()
int main ()

Variables

int i
double tmp

Function Documentation

int main (  ) 

Definition at line 23 of file PAPI_get_virt_cyc.c.

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

Here is the call graph for this function:

int your_slow_code (  ) 

Definition at line 13 of file PAPI_get_virt_cyc.c.

00014 {
00015 
00016    for(i=1; i<200000; i++)
00017    {
00018       tmp= (tmp+i)/2;
00019    }
00020    return 0;
00021 }


Variable Documentation

int i

Definition at line 10 of file PAPI_get_virt_cyc.c.

double tmp

Definition at line 11 of file PAPI_get_virt_cyc.c.


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1