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

22 {
23  long long s,s1, e, e1;
24  int retval;
25 
26 
27  /****************************************************************************
28  * This part initializes the library and compares the version number of the *
29  * header file, to the version of the library, if these don't match then it *
30  * is likely that PAPI won't work correctly.If there is an error, retval *
31  * keeps track of the version number. *
32  ****************************************************************************/
33 
35  {
36  printf("Library initialization error! \n");
37  exit(1);
38  }
39 
40  /* Here you get initial cycles and time */
41  /* No error checking is done here because this function call is always
42  successful */
43 
44  s = PAPI_get_real_cyc();
45 
47 
48  /*Here you get final cycles and time */
49  e = PAPI_get_real_cyc();
50 
51  s1= PAPI_get_real_usec();
52 
54 
55  e1= PAPI_get_real_usec();
56 
57  printf("Wallclock cycles : %lld\nWallclock time(ms): %lld\n",e-s,e1-s1);
58 
59  /* clean up */
60  PAPI_shutdown();
61 
62  exit(0);
63 }
#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
long long PAPI_get_real_usec(void)
Definition: papi.c:6190
long long PAPI_get_real_cyc(void)
Definition: papi.c:6143
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 10 of file PAPI_get_real_cyc.c.

11 {
12  int i,tmp;
13 
14  for(i=1; i<20000; i++)
15  {
16  tmp=(tmp+100)/i;
17  }
18  return 0;
19 }
int i
Definition: fileop.c:140
long long tmp
Definition: iozone.c:12031