PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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.

24 {
25  long long s,s1, e, e1;
26  int retval;
27 
28 
29  /****************************************************************************
30  * This part initializes the library and compares the version number of the *
31  * header file, to the version of the library, if these don't match then it *
32  * is likely that PAPI won't work correctly.If there is an error, retval *
33  * keeps track of the version number. *
34  ****************************************************************************/
35 
37  {
38  printf("Library initialization error! \n");
39  exit(1);
40  }
41 
42  /* Here you get initial cycles and time */
43  /* No error checking is done here because this function call is always
44  successful */
45 
46  s = PAPI_get_virt_cyc();
47 
49 
50  /*Here you get final cycles and time */
51  e = PAPI_get_virt_cyc();
52 
53  s1= PAPI_get_virt_usec();
54 
56 
57  e1= PAPI_get_virt_usec();
58 
59  printf("Virtual cycles : %lld\nVirtual time(ms): %lld\n",e-s,e1-s1);
60 
61  /* clean up */
62  PAPI_shutdown();
63 
64  exit(0);
65 }
long long PAPI_get_virt_usec(void)
Definition: papi.c:6298
long long PAPI_get_virt_cyc(void)
Definition: papi.c:6226
#define printf
Definition: papi_test.h:125
int your_slow_code()
Definition: PAPI_flips.c:63
int PAPI_library_init(int version)
Definition: papi.c:497
void PAPI_shutdown(void)
Definition: papi.c:4400
s
Definition: iozone.c:20289
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:223
void exit()

Here is the call graph for this function:

int your_slow_code ( )

Definition at line 13 of file PAPI_get_virt_cyc.c.

14 {
15 
16  for(i=1; i<200000; i++)
17  {
18  tmp= (tmp+i)/2;
19  }
20  return 0;
21 }
int i
Definition: fileop.c:140
long long tmp
Definition: iozone.c:12031

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.