1PAPI_get_virt_cyc(3) PAPI PAPI_get_virt_cyc(3)
2
3
4
6 PAPI_get_virt_cyc - get virtual time counter value in clock cycles
7
8 PAPI_get_virt_usec - get virtual time counter values in microseconds
9
10
12 C Interface
13 #include <papi.h>
14 long_long PAPI_get_virt_cyc(void);
15 long_long PAPI_get_virt_usec(void);
16 Fortran Interface
17 #include fpapi.h
18 PAPIF_get_virt_usec(C_LONG_LONG time)
19 PAPIF_get_virt_cyc(C_LONG_LONG virt_cyc)
20
21
23 Both of these functions return the total number of virtual units from
24 some arbitrary starting point. Virtual units accrue every time the
25 process is running in user-mode on behalf of the process. Like the real
26 time counters, these are guaranteed to exist on every platform PAPI
27 supports. However on some platforms, the resolution can be as bad as
28 1/Hz as defined by the operating system.
29
30
32 The functions returns PAPI_ECNFLCT if there is no master event set.
33 This will happen if the library has not been initialized, or for
34 threaded applications, if there has been no thread id function defined
35 by the PAPI_thread_init function.
36
37 For threaded applications, if there has not yet been any thread spe‐
38 cific master event created for the current thread, and if the alloca‐
39 tion of such an event set fails, the call will return PAPI_ENOMEMor‐
40 PAPI_ESYS.
41
42
44 s = PAPI_get_virt_cyc();
45 your_slow_code();
46 e = PAPI_get_virt_cyc();
47 printf("Process has run for cycles: %lld\n",e-s);
48
49
51 These functions have no known bugs.
52
53
55 PAPI_library_init(3), PAPI_get_real_usec(3), PAPI_get_real_cyc(3),
56 PAPI(3), PAPIF(3)
57
58
59
60PAPI Programmer's Reference September, 2004 PAPI_get_virt_cyc(3)