PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vmware.c
Go to the documentation of this file.
1 /****************************/
2 /* THIS IS OPEN SOURCE CODE */
3 /****************************/
4 
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdlib.h>
26 #include <stdint.h>
27 
28 #include <unistd.h>
29 #include <dlfcn.h>
30 
31 /* Headers required by PAPI */
32 #include "papi.h"
33 #include "papi_internal.h"
34 #include "papi_vector.h"
35 #include "papi_memory.h"
36 
37 #define VMWARE_MAX_COUNTERS 256
38 
39 #define VMWARE_CPU_LIMIT_MHZ 0
40 #define VMWARE_CPU_RESERVATION_MHZ 1
41 #define VMWARE_CPU_SHARES 2
42 #define VMWARE_CPU_STOLEN_MS 3
43 #define VMWARE_CPU_USED_MS 4
44 #define VMWARE_ELAPSED_MS 5
45 
46 #define VMWARE_MEM_ACTIVE_MB 6
47 #define VMWARE_MEM_BALLOONED_MB 7
48 #define VMWARE_MEM_LIMIT_MB 8
49 #define VMWARE_MEM_MAPPED_MB 9
50 #define VMWARE_MEM_OVERHEAD_MB 10
51 #define VMWARE_MEM_RESERVATION_MB 11
52 #define VMWARE_MEM_SHARED_MB 12
53 #define VMWARE_MEM_SHARES 13
54 #define VMWARE_MEM_SWAPPED_MB 14
55 #define VMWARE_MEM_TARGET_SIZE_MB 15
56 #define VMWARE_MEM_USED_MB 16
57 
58 #define VMWARE_HOST_CPU_MHZ 17
59 
60 /* The following 3 require VMWARE_PSEUDO_PERFORMANCE env_var to be set. */
61 
62 #define VMWARE_HOST_TSC 18
63 #define VMWARE_ELAPSED_TIME 19
64 #define VMWARE_ELAPSED_APPARENT 20
65 
66 /* Begin PAPI definitions */
68 
69 
71 
73 struct _vmware_register {
74  unsigned int selector;
77 };
78 
86 };
87 
89  struct _vmware_register ra_bits;
90 };
91 
92 
93 inline uint64_t rdpmc(int c)
94 {
95  uint32_t low, high;
96  __asm__ __volatile__("rdpmc" : "=a" (low), "=d" (high) : "c" (c));
97  return (uint64_t)high << 32 | (uint64_t)low;
98 }
99 
100 
101 
102 #ifdef VMGUESTLIB
103 /* Headers required by VMware */
104 #include "vmGuestLib.h"
105 
106 /* Functions to dynamically load from the GuestLib library. */
107 char const * (*GuestLib_GetErrorText)(VMGuestLibError);
108 VMGuestLibError (*GuestLib_OpenHandle)(VMGuestLibHandle*);
109 VMGuestLibError (*GuestLib_CloseHandle)(VMGuestLibHandle);
110 VMGuestLibError (*GuestLib_UpdateInfo)(VMGuestLibHandle handle);
111 VMGuestLibError (*GuestLib_GetSessionId)(VMGuestLibHandle handle, VMSessionId *id);
112 VMGuestLibError (*GuestLib_GetCpuReservationMHz)(VMGuestLibHandle handle, uint32 *cpuReservationMHz);
113 VMGuestLibError (*GuestLib_GetCpuLimitMHz)(VMGuestLibHandle handle, uint32 *cpuLimitMHz);
114 VMGuestLibError (*GuestLib_GetCpuShares)(VMGuestLibHandle handle, uint32 *cpuShares);
115 VMGuestLibError (*GuestLib_GetCpuUsedMs)(VMGuestLibHandle handle, uint64 *cpuUsedMs);
116 VMGuestLibError (*GuestLib_GetHostProcessorSpeed)(VMGuestLibHandle handle, uint32 *mhz);
117 VMGuestLibError (*GuestLib_GetMemReservationMB)(VMGuestLibHandle handle, uint32 *memReservationMB);
118 VMGuestLibError (*GuestLib_GetMemLimitMB)(VMGuestLibHandle handle, uint32 *memLimitMB);
119 VMGuestLibError (*GuestLib_GetMemShares)(VMGuestLibHandle handle, uint32 *memShares);
120 VMGuestLibError (*GuestLib_GetMemMappedMB)(VMGuestLibHandle handle, uint32 *memMappedMB);
121 VMGuestLibError (*GuestLib_GetMemActiveMB)(VMGuestLibHandle handle, uint32 *memActiveMB);
122 VMGuestLibError (*GuestLib_GetMemOverheadMB)(VMGuestLibHandle handle, uint32 *memOverheadMB);
123 VMGuestLibError (*GuestLib_GetMemBalloonedMB)(VMGuestLibHandle handle, uint32 *memBalloonedMB);
124 VMGuestLibError (*GuestLib_GetMemSwappedMB)(VMGuestLibHandle handle, uint32 *memSwappedMB);
125 VMGuestLibError (*GuestLib_GetMemSharedMB)(VMGuestLibHandle handle, uint32 *memSharedMB);
126 VMGuestLibError (*GuestLib_GetMemSharedSavedMB)(VMGuestLibHandle handle, uint32 *memSharedSavedMB);
127 VMGuestLibError (*GuestLib_GetMemUsedMB)(VMGuestLibHandle handle, uint32 *memUsedMB);
128 VMGuestLibError (*GuestLib_GetElapsedMs)(VMGuestLibHandle handle, uint64 *elapsedMs);
129 VMGuestLibError (*GuestLib_GetResourcePoolPath)(VMGuestLibHandle handle, size_t *bufferSize, char *pathBuffer);
130 VMGuestLibError (*GuestLib_GetCpuStolenMs)(VMGuestLibHandle handle, uint64 *cpuStolenMs);
131 VMGuestLibError (*GuestLib_GetMemTargetSizeMB)(VMGuestLibHandle handle, uint64 *memTargetSizeMB);
132 VMGuestLibError (*GuestLib_GetHostNumCpuCores)(VMGuestLibHandle handle, uint32 *hostNumCpuCores);
133 VMGuestLibError (*GuestLib_GetHostCpuUsedMs)(VMGuestLibHandle handle, uint64 *hostCpuUsedMs);
134 VMGuestLibError (*GuestLib_GetHostMemSwappedMB)(VMGuestLibHandle handle, uint64 *hostMemSwappedMB);
135 VMGuestLibError (*GuestLib_GetHostMemSharedMB)(VMGuestLibHandle handle, uint64 *hostMemSharedMB);
136 VMGuestLibError (*GuestLib_GetHostMemUsedMB)(VMGuestLibHandle handle, uint64 *hostMemUsedMB);
137 VMGuestLibError (*GuestLib_GetHostMemPhysMB)(VMGuestLibHandle handle, uint64 *hostMemPhysMB);
138 VMGuestLibError (*GuestLib_GetHostMemPhysFreeMB)(VMGuestLibHandle handle, uint64 *hostMemPhysFreeMB);
139 VMGuestLibError (*GuestLib_GetHostMemKernOvhdMB)(VMGuestLibHandle handle, uint64 *hostMemKernOvhdMB);
140 VMGuestLibError (*GuestLib_GetHostMemMappedMB)(VMGuestLibHandle handle, uint64 *hostMemMappedMB);
141 VMGuestLibError (*GuestLib_GetHostMemUnmappedMB)(VMGuestLibHandle handle, uint64 *hostMemUnmappedMB);
142 
143 
144 static void *dlHandle = NULL;
145 
146 
147 /*
148  * Macro to load a single GuestLib function from the shared library.
149  */
150 
151 #define LOAD_ONE_FUNC(funcname) \
152 do { \
153 funcname = dlsym(dlHandle, "VM" #funcname); \
154 if ((dlErrStr = dlerror()) != NULL) { \
155 fprintf(stderr, "Failed to load \'%s\': \'%s\'\n", \
156 #funcname, dlErrStr); \
157 return FALSE; \
158 } \
159 } while (0)
160 
161 #endif
162 
168 };
169 
174 #ifdef VMGUESTLIB
175  VMGuestLibHandle glHandle;
176 #endif
177 };
178 
179 
180 
181 
182 
183 
184 /*
185  *-----------------------------------------------------------------------------
186  *
187  * LoadFunctions --
188  *
189  * Load the functions from the shared library.
190  *
191  * Results:
192  * TRUE on success
193  * FALSE on failure
194  *
195  * Side effects:
196  * None
197  *
198  * Credit: VMware
199  *-----------------------------------------------------------------------------
200  */
201 
202 static int
204 {
205 
206 #ifdef VMGUESTLIB
207  /*
208  * First, try to load the shared library.
209  */
210 
211  /* Attempt to guess if we were statically linked to libc, if so bail */
212  if ( _dl_non_dynamic_init != NULL ) {
213  strncpy(_vmware_vector.cmp_info.disabled_reason, "The VMware component does not support statically linking of libc.", PAPI_MAX_STR_LEN);
214  return PAPI_ENOSUPP;
215  }
216 
217  char const *dlErrStr;
218  char filename[BUFSIZ];
219 
220  sprintf(filename,"%s","libvmGuestLib.so");
221  dlHandle = dlopen(filename, RTLD_NOW);
222  if (!dlHandle) {
223  dlErrStr = dlerror();
224  fprintf(stderr, "dlopen of %s failed: \'%s\'\n", filename,
225  dlErrStr);
226 
227  sprintf(filename,"%s/lib/lib64/libvmGuestLib.so",VMWARE_INCDIR);
228  dlHandle = dlopen(filename, RTLD_NOW);
229  if (!dlHandle) {
230  dlErrStr = dlerror();
231  fprintf(stderr, "dlopen of %s failed: \'%s\'\n", filename,
232  dlErrStr);
233 
234  sprintf(filename,"%s/lib/lib32/libvmGuestLib.so",VMWARE_INCDIR);
235  dlHandle = dlopen(filename, RTLD_NOW);
236  if (!dlHandle) {
237  dlErrStr = dlerror();
238  fprintf(stderr, "dlopen of %s failed: \'%s\'\n", filename,
239  dlErrStr);
240  return PAPI_ECMP;
241  }
242  }
243  }
244 
245  /* Load all the individual library functions. */
246  LOAD_ONE_FUNC(GuestLib_GetErrorText);
247  LOAD_ONE_FUNC(GuestLib_OpenHandle);
248  LOAD_ONE_FUNC(GuestLib_CloseHandle);
249  LOAD_ONE_FUNC(GuestLib_UpdateInfo);
250  LOAD_ONE_FUNC(GuestLib_GetSessionId);
251  LOAD_ONE_FUNC(GuestLib_GetCpuReservationMHz);
252  LOAD_ONE_FUNC(GuestLib_GetCpuLimitMHz);
253  LOAD_ONE_FUNC(GuestLib_GetCpuShares);
254  LOAD_ONE_FUNC(GuestLib_GetCpuUsedMs);
255  LOAD_ONE_FUNC(GuestLib_GetHostProcessorSpeed);
256  LOAD_ONE_FUNC(GuestLib_GetMemReservationMB);
257  LOAD_ONE_FUNC(GuestLib_GetMemLimitMB);
258  LOAD_ONE_FUNC(GuestLib_GetMemShares);
259  LOAD_ONE_FUNC(GuestLib_GetMemMappedMB);
260  LOAD_ONE_FUNC(GuestLib_GetMemActiveMB);
261  LOAD_ONE_FUNC(GuestLib_GetMemOverheadMB);
262  LOAD_ONE_FUNC(GuestLib_GetMemBalloonedMB);
263  LOAD_ONE_FUNC(GuestLib_GetMemSwappedMB);
264  LOAD_ONE_FUNC(GuestLib_GetMemSharedMB);
265  LOAD_ONE_FUNC(GuestLib_GetMemSharedSavedMB);
266  LOAD_ONE_FUNC(GuestLib_GetMemUsedMB);
267  LOAD_ONE_FUNC(GuestLib_GetElapsedMs);
268  LOAD_ONE_FUNC(GuestLib_GetResourcePoolPath);
269  LOAD_ONE_FUNC(GuestLib_GetCpuStolenMs);
270  LOAD_ONE_FUNC(GuestLib_GetMemTargetSizeMB);
271  LOAD_ONE_FUNC(GuestLib_GetHostNumCpuCores);
272  LOAD_ONE_FUNC(GuestLib_GetHostCpuUsedMs);
273  LOAD_ONE_FUNC(GuestLib_GetHostMemSwappedMB);
274  LOAD_ONE_FUNC(GuestLib_GetHostMemSharedMB);
275  LOAD_ONE_FUNC(GuestLib_GetHostMemUsedMB);
276  LOAD_ONE_FUNC(GuestLib_GetHostMemPhysMB);
277  LOAD_ONE_FUNC(GuestLib_GetHostMemPhysFreeMB);
278  LOAD_ONE_FUNC(GuestLib_GetHostMemKernOvhdMB);
279  LOAD_ONE_FUNC(GuestLib_GetHostMemMappedMB);
280  LOAD_ONE_FUNC(GuestLib_GetHostMemUnmappedMB);
281 #endif
282  return PAPI_OK;
283 }
284 
285 
286 
290 static int num_events = 0;
291 static int use_pseudo=0;
292 static int use_guestlib=0;
293 
294 /************************************************************************/
295 /* Below is the actual "hardware implementation" of our VMWARE counters */
296 /************************************************************************/
297 
301 static long long
302 _vmware_hardware_read( struct _vmware_context *context, int starting)
303 {
304 
305  int i;
306 
307  if (use_pseudo) {
308  context->values[VMWARE_HOST_TSC]=rdpmc(0x10000);
309  context->values[VMWARE_ELAPSED_TIME]=rdpmc(0x10001);
310  context->values[VMWARE_ELAPSED_APPARENT]=rdpmc(0x10002);
311  }
312 
313 
314 #ifdef VMGUESTLIB
315  static VMSessionId sessionId = 0;
316  VMSessionId tmpSession;
317  uint32_t temp32;
318  uint64_t temp64;
319  VMGuestLibError glError;
320 
321  if (use_guestlib) {
322 
323  glError = GuestLib_UpdateInfo(context->glHandle);
324  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
325  fprintf(stderr,"UpdateInfo failed: %s\n",
326  GuestLib_GetErrorText(glError));
327  return PAPI_ECMP;
328  }
329 
330  /* Retrieve and check the session ID */
331  glError = GuestLib_GetSessionId(context->glHandle, &tmpSession);
332  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
333  fprintf(stderr, "Failed to get session ID: %s\n",
334  GuestLib_GetErrorText(glError));
335  return PAPI_ECMP;
336  }
337 
338  if (tmpSession == 0) {
339  fprintf(stderr, "Error: Got zero sessionId from GuestLib\n");
340  return PAPI_ECMP;
341  }
342 
343  if (sessionId == 0) {
344  sessionId = tmpSession;
345  } else if (tmpSession != sessionId) {
346  sessionId = tmpSession;
347  }
348 
349  glError = GuestLib_GetCpuLimitMHz(context->glHandle,&temp32);
350  context->values[VMWARE_CPU_LIMIT_MHZ]=temp32;
351  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
352  fprintf(stderr,"Failed to get CPU limit: %s\n",
353  GuestLib_GetErrorText(glError));
354  return PAPI_ECMP;
355  }
356 
357  glError = GuestLib_GetCpuReservationMHz(context->glHandle,&temp32);
358  context->values[VMWARE_CPU_RESERVATION_MHZ]=temp32;
359  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
360  fprintf(stderr,"Failed to get CPU reservation: %s\n",
361  GuestLib_GetErrorText(glError));
362  return PAPI_ECMP;
363  }
364 
365  glError = GuestLib_GetCpuShares(context->glHandle,&temp32);
366  context->values[VMWARE_CPU_SHARES]=temp32;
367  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
368  fprintf(stderr,"Failed to get cpu shares: %s\n",
369  GuestLib_GetErrorText(glError));
370  return PAPI_ECMP;
371  }
372 
373  glError = GuestLib_GetCpuStolenMs(context->glHandle,&temp64);
374  context->values[VMWARE_CPU_STOLEN_MS]=temp64;
375  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
376  if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION) {
377  context->values[VMWARE_CPU_STOLEN_MS]=0;
378  fprintf(stderr, "Skipping CPU stolen, not supported...\n");
379  } else {
380  fprintf(stderr, "Failed to get CPU stolen: %s\n",
381  GuestLib_GetErrorText(glError));
382  return PAPI_ECMP;
383  }
384  }
385 
386  glError = GuestLib_GetCpuUsedMs(context->glHandle,&temp64);
387  context->values[VMWARE_CPU_USED_MS]=temp64;
388  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
389  fprintf(stderr, "Failed to get used ms: %s\n",
390  GuestLib_GetErrorText(glError));
391  return PAPI_ECMP;
392  }
393 
394  glError = GuestLib_GetElapsedMs(context->glHandle, &temp64);
395  context->values[VMWARE_ELAPSED_MS]=temp64;
396  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
397  fprintf(stderr, "Failed to get elapsed ms: %s\n",
398  GuestLib_GetErrorText(glError));
399  return PAPI_ECMP;
400  }
401 
402  glError = GuestLib_GetMemActiveMB(context->glHandle, &temp32);
403  context->values[VMWARE_MEM_ACTIVE_MB]=temp32;
404  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
405  fprintf(stderr, "Failed to get active mem: %s\n",
406  GuestLib_GetErrorText(glError));
407  return PAPI_ECMP;
408  }
409 
410  glError = GuestLib_GetMemBalloonedMB(context->glHandle, &temp32);
411  context->values[VMWARE_MEM_BALLOONED_MB]=temp32;
412  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
413  fprintf(stderr, "Failed to get ballooned mem: %s\n",
414  GuestLib_GetErrorText(glError));
415  return PAPI_ECMP;
416  }
417 
418  glError = GuestLib_GetMemLimitMB(context->glHandle, &temp32);
419  context->values[VMWARE_MEM_LIMIT_MB]=temp32;
420  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
421  fprintf(stderr,"Failed to get mem limit: %s\n",
422  GuestLib_GetErrorText(glError));
423  return PAPI_ECMP;
424  }
425 
426  glError = GuestLib_GetMemMappedMB(context->glHandle, &temp32);
427  context->values[VMWARE_MEM_MAPPED_MB]=temp32;
428  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
429  fprintf(stderr, "Failed to get mapped mem: %s\n",
430  GuestLib_GetErrorText(glError));
431  return PAPI_ECMP;
432  }
433 
434  glError = GuestLib_GetMemOverheadMB(context->glHandle, &temp32);
435  context->values[VMWARE_MEM_OVERHEAD_MB]=temp32;
436  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
437  fprintf(stderr, "Failed to get overhead mem: %s\n",
438  GuestLib_GetErrorText(glError));
439  return PAPI_ECMP;
440  }
441 
442  glError = GuestLib_GetMemReservationMB(context->glHandle, &temp32);
443  context->values[VMWARE_MEM_RESERVATION_MB]=temp32;
444  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
445  fprintf(stderr, "Failed to get mem reservation: %s\n",
446  GuestLib_GetErrorText(glError));
447  return PAPI_ECMP;
448  }
449 
450  glError = GuestLib_GetMemSharedMB(context->glHandle, &temp32);
451  context->values[VMWARE_MEM_SHARED_MB]=temp32;
452  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
453  fprintf(stderr, "Failed to get swapped mem: %s\n",
454  GuestLib_GetErrorText(glError));
455  return PAPI_ECMP;
456  }
457 
458  glError = GuestLib_GetMemShares(context->glHandle, &temp32);
459  context->values[VMWARE_MEM_SHARES]=temp32;
460  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
461  if (glError == VMGUESTLIB_ERROR_NOT_AVAILABLE) {
462  context->values[VMWARE_MEM_SHARES]=0;
463  fprintf(stderr, "Skipping mem shares, not supported...\n");
464  } else {
465  fprintf(stderr, "Failed to get mem shares: %s\n",
466  GuestLib_GetErrorText(glError));
467  return PAPI_ECMP;
468  }
469  }
470 
471  glError = GuestLib_GetMemSwappedMB(context->glHandle, &temp32);
472  context->values[VMWARE_MEM_SWAPPED_MB]=temp32;
473  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
474  fprintf(stderr, "Failed to get swapped mem: %s\n",
475  GuestLib_GetErrorText(glError));
476  return PAPI_ECMP;
477  }
478 
479  glError = GuestLib_GetMemTargetSizeMB(context->glHandle, &temp64);
480  context->values[VMWARE_MEM_TARGET_SIZE_MB]=temp64;
481  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
482  if (glError == VMGUESTLIB_ERROR_UNSUPPORTED_VERSION) {
483  context->values[VMWARE_MEM_TARGET_SIZE_MB]=0;
484  fprintf(stderr, "Skipping target mem size, not supported...\n");
485  } else {
486  fprintf(stderr, "Failed to get target mem size: %s\n",
487  GuestLib_GetErrorText(glError));
488  return PAPI_ECMP;
489  }
490  }
491 
492  glError = GuestLib_GetMemUsedMB(context->glHandle, &temp32);
493  context->values[VMWARE_MEM_USED_MB]=temp32;
494  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
495  fprintf(stderr, "Failed to get swapped mem: %s\n",
496  GuestLib_GetErrorText(glError));
497  return PAPI_ECMP;
498  }
499 
500  glError = GuestLib_GetHostProcessorSpeed(context->glHandle, &temp32);
501  context->values[VMWARE_HOST_CPU_MHZ]=temp32;
502  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
503  fprintf(stderr, "Failed to get host proc speed: %s\n",
504  GuestLib_GetErrorText(glError));
505  return PAPI_ECMP;
506  }
507  }
508 
509 #endif
510 
511  if (starting) {
512 
513  for(i=0;i<VMWARE_MAX_COUNTERS;i++) {
514  context->start_values[i]=context->values[i];
515  }
516 
517  }
518 
519  return PAPI_OK;
520 }
521 
522 /********************************************************************/
523 /* Below are the functions required by the PAPI component interface */
524 /********************************************************************/
525 
527 int
529 {
530  (void) ctx;
531 
532 
533 #ifdef VMGUESTLIB
534 
535  struct _vmware_context *context;
536  VMGuestLibError glError;
537 
538  context=(struct _vmware_context *)ctx;
539 
540  if (use_guestlib) {
541  glError = GuestLib_OpenHandle(&(context->glHandle));
542  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
543  fprintf(stderr,"OpenHandle failed: %s\n",
544  GuestLib_GetErrorText(glError));
545  return PAPI_ECMP;
546  }
547  }
548 
549 #endif
550 
551  return PAPI_OK;
552 }
553 
554 
559 int
561 {
562 
563  (void) cidx;
564 
565  int result;
566 
567  SUBDBG( "_vmware_init_component..." );
568 
569  /* Initialize and try to load the VMware library */
570  /* Try to load the library. */
571  result=LoadFunctions();
572 
573  if (result!=PAPI_OK) {
574  strncpy(_vmware_vector.cmp_info.disabled_reason,
575  "GuestLibTest: Failed to load shared library",
577  return PAPI_ECMP;
578  }
579 
580  /* we know in advance how many events we want */
581  /* for actual hardware this might have to be determined dynamically */
582 
583  /* Allocate memory for the our event table */
584  _vmware_native_table = ( struct _vmware_native_event_entry * )
585  calloc( VMWARE_MAX_COUNTERS, sizeof ( struct _vmware_native_event_entry ));
586  if ( _vmware_native_table == NULL ) {
587  return PAPI_ENOMEM;
588  }
589 
590 
591 #ifdef VMGUESTLIB
592 
593  /* Detect if GuestLib works */
594  {
595 
596  VMGuestLibError glError;
597  VMGuestLibHandle glHandle;
598 
599  use_guestlib=0;
600 
601  /* try to open */
602  glError = GuestLib_OpenHandle(&glHandle);
603  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
604  fprintf(stderr,"OpenHandle failed: %s\n",
605  GuestLib_GetErrorText(glError));
606  }
607  else {
608  /* open worked, try to update */
609  glError = GuestLib_UpdateInfo(glHandle);
610  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
611  fprintf(stderr,"UpdateInfo failed: %s\n",
612  GuestLib_GetErrorText(glError));
613  }
614  else {
615  /* update worked, things work! */
616  use_guestlib=1;
617  }
618  /* shut things down */
619  glError = GuestLib_CloseHandle(glHandle);
620  }
621 
622  }
623 
624 
625 
626  if (use_guestlib) {
627 
628  /* fill in the event table parameters */
629  strcpy( _vmware_native_table[num_events].name,
630  "CPU_LIMIT" );
631  strncpy( _vmware_native_table[num_events].description,
632  "Retrieves the upper limit of processor use in MHz "
633  "available to the virtual machine.",
635  strcpy( _vmware_native_table[num_events].units,"MHz");
636  _vmware_native_table[num_events].which_counter=
638  _vmware_native_table[num_events].report_difference=0;
639  num_events++;
640 
641  strcpy( _vmware_native_table[num_events].name,
642  "CPU_RESERVATION" );
643  strncpy( _vmware_native_table[num_events].description,
644  "Retrieves the minimum processing power in MHz "
645  "reserved for the virtual machine.",
647  strcpy( _vmware_native_table[num_events].units,"MHz");
648  _vmware_native_table[num_events].which_counter=
650  _vmware_native_table[num_events].report_difference=0;
651  num_events++;
652 
653  strcpy( _vmware_native_table[num_events].name,
654  "CPU_SHARES" );
655  strncpy( _vmware_native_table[num_events].description,
656  "Retrieves the number of CPU shares allocated "
657  "to the virtual machine.",
659  strcpy( _vmware_native_table[num_events].units,"shares");
660  _vmware_native_table[num_events].which_counter=
662  _vmware_native_table[num_events].report_difference=0;
663  num_events++;
664 
665  strcpy( _vmware_native_table[num_events].name,
666  "CPU_STOLEN" );
667  strncpy( _vmware_native_table[num_events].description,
668  "Retrieves the number of milliseconds that the "
669  "virtual machine was in a ready state (able to "
670  "transition to a run state), but was not scheduled to run.",
672  strcpy( _vmware_native_table[num_events].units,"ms");
673  _vmware_native_table[num_events].which_counter=
675  _vmware_native_table[num_events].report_difference=0;
676  num_events++;
677 
678  strcpy( _vmware_native_table[num_events].name,
679  "CPU_USED" );
680  strncpy( _vmware_native_table[num_events].description,
681  "Retrieves the number of milliseconds during which "
682  "the virtual machine has used the CPU. This value "
683  "includes the time used by the guest operating system "
684  "and the time used by virtualization code for tasks for "
685  "this virtual machine. You can combine this value with "
686  "the elapsed time (VMWARE_ELAPSED) to estimate the "
687  "effective virtual machine CPU speed. This value is a "
688  "subset of elapsedMs.",
690  strcpy( _vmware_native_table[num_events].units,"ms");
691  _vmware_native_table[num_events].which_counter=
693  _vmware_native_table[num_events].report_difference=1;
694  num_events++;
695 
696  strcpy( _vmware_native_table[num_events].name,
697  "ELAPSED" );
698  strncpy( _vmware_native_table[num_events].description,
699  "Retrieves the number of milliseconds that have passed "
700  "in the virtual machine since it last started running on "
701  "the server. The count of elapsed time restarts each time "
702  "the virtual machine is powered on, resumed, or migrated "
703  "using VMotion. This value counts milliseconds, regardless "
704  "of whether the virtual machine is using processing power "
705  "during that time. You can combine this value with the CPU "
706  "time used by the virtual machine (VMWARE_CPU_USED) to "
707  "estimate the effective virtual machine xCPU speed. "
708  "cpuUsedMS is a subset of this value.",
710  strcpy( _vmware_native_table[num_events].units,"ms");
711  _vmware_native_table[num_events].which_counter=
713  _vmware_native_table[num_events].report_difference=1;
714  num_events++;
715 
716  strcpy( _vmware_native_table[num_events].name,
717  "MEM_ACTIVE" );
718  strncpy( _vmware_native_table[num_events].description,
719  "Retrieves the amount of memory the virtual machine is "
720  "actively using in MB - Its estimated working set size.",
722  strcpy( _vmware_native_table[num_events].units,"MB");
723  _vmware_native_table[num_events].which_counter=
725  _vmware_native_table[num_events].report_difference=0;
726  num_events++;
727 
728  strcpy( _vmware_native_table[num_events].name,
729  "MEM_BALLOONED" );
730  strncpy( _vmware_native_table[num_events].description,
731  "Retrieves the amount of memory that has been reclaimed "
732  "from this virtual machine by the vSphere memory balloon "
733  "driver (also referred to as the 'vmemctl' driver) in MB.",
735  strcpy( _vmware_native_table[num_events].units,"MB");
736  _vmware_native_table[num_events].which_counter=
738  _vmware_native_table[num_events].report_difference=0;
739  num_events++;
740 
741  strcpy( _vmware_native_table[num_events].name,
742  "MEM_LIMIT" );
743  strncpy( _vmware_native_table[num_events].description,
744  "Retrieves the upper limit of memory that is available "
745  "to the virtual machine in MB.",
747  strcpy( _vmware_native_table[num_events].units,"MB");
748  _vmware_native_table[num_events].which_counter=
750  _vmware_native_table[num_events].report_difference=0;
751  num_events++;
752 
753  strcpy( _vmware_native_table[num_events].name,
754  "MEM_MAPPED" );
755  strncpy( _vmware_native_table[num_events].description,
756  "Retrieves the amount of memory that is allocated to "
757  "the virtual machine in MB. Memory that is ballooned, "
758  "swapped, or has never been accessed is excluded.",
760  strcpy( _vmware_native_table[num_events].units,"MB");
761  _vmware_native_table[num_events].which_counter=
763  _vmware_native_table[num_events].report_difference=0;
764  num_events++;
765 
766  strcpy( _vmware_native_table[num_events].name,
767  "MEM_OVERHEAD" );
768  strncpy( _vmware_native_table[num_events].description,
769  "Retrieves the amount of 'overhead' memory associated "
770  "with this virtual machine that is currently consumed "
771  "on the host system in MB. Overhead memory is additional "
772  "memory that is reserved for data structures required by "
773  "the virtualization layer.",
775  strcpy( _vmware_native_table[num_events].units,"MB");
776  _vmware_native_table[num_events].which_counter=
778  _vmware_native_table[num_events].report_difference=0;
779  num_events++;
780 
781  strcpy( _vmware_native_table[num_events].name,
782  "MEM_RESERVATION" );
783  strncpy( _vmware_native_table[num_events].description,
784  "Retrieves the minimum amount of memory that is "
785  "reserved for the virtual machine in MB.",
787  strcpy( _vmware_native_table[num_events].units,"MB");
788  _vmware_native_table[num_events].which_counter=
790  _vmware_native_table[num_events].report_difference=0;
791  num_events++;
792 
793  strcpy( _vmware_native_table[num_events].name,
794  "MEM_SHARED" );
795  strncpy( _vmware_native_table[num_events].description,
796  "Retrieves the amount of physical memory associated "
797  "with this virtual machine that is copy-on-write (COW) "
798  "shared on the host in MB.",
800  strcpy( _vmware_native_table[num_events].units,"MB");
801  _vmware_native_table[num_events].which_counter=
803  _vmware_native_table[num_events].report_difference=0;
804  num_events++;
805 
806  strcpy( _vmware_native_table[num_events].name,
807  "MEM_SHARES" );
808  strncpy( _vmware_native_table[num_events].description,
809  "Retrieves the number of memory shares allocated to "
810  "the virtual machine.",
812  strcpy( _vmware_native_table[num_events].units,"shares");
813  _vmware_native_table[num_events].which_counter=
815  _vmware_native_table[num_events].report_difference=0;
816  num_events++;
817 
818  strcpy( _vmware_native_table[num_events].name,
819  "MEM_SWAPPED" );
820  strncpy( _vmware_native_table[num_events].description,
821  "Retrieves the amount of memory that has been reclaimed "
822  "from this virtual machine by transparently swapping "
823  "guest memory to disk in MB.",
825  strcpy( _vmware_native_table[num_events].units,"MB");
826  _vmware_native_table[num_events].which_counter=
828  _vmware_native_table[num_events].report_difference=0;
829  num_events++;
830 
831  strcpy( _vmware_native_table[num_events].name,
832  "MEM_TARGET_SIZE" );
833  strncpy( _vmware_native_table[num_events].description,
834  "Retrieves the size of the target memory allocation "
835  "for this virtual machine in MB.",
837  strcpy( _vmware_native_table[num_events].units,"MB");
838  _vmware_native_table[num_events].which_counter=
840  _vmware_native_table[num_events].report_difference=0;
841  num_events++;
842 
843  strcpy( _vmware_native_table[num_events].name,
844  "MEM_USED" );
845  strncpy( _vmware_native_table[num_events].description,
846  "Retrieves the estimated amount of physical host memory "
847  "currently consumed for this virtual machine's "
848  "physical memory.",
850  strcpy( _vmware_native_table[num_events].units,"MB");
851  _vmware_native_table[num_events].which_counter=
853  _vmware_native_table[num_events].report_difference=0;
854  num_events++;
855 
856  strcpy( _vmware_native_table[num_events].name,
857  "HOST_CPU" );
858  strncpy( _vmware_native_table[num_events].description,
859  "Retrieves the speed of the ESX system's physical "
860  "CPU in MHz.",
862  strcpy( _vmware_native_table[num_events].units,"MHz");
863  _vmware_native_table[num_events].which_counter=
865  _vmware_native_table[num_events].report_difference=0;
866  num_events++;
867  }
868 
869 #endif
870 
871  /* For VMWare Pseudo Performance Counters */
872  if ( getenv( "PAPI_VMWARE_PSEUDOPERFORMANCE" ) ) {
873 
874  use_pseudo=1;
875 
876  strcpy( _vmware_native_table[num_events].name,
877  "HOST_TSC" );
878  strncpy( _vmware_native_table[num_events].description,
879  "Physical host TSC",
881  strcpy( _vmware_native_table[num_events].units,"cycles");
882  _vmware_native_table[num_events].which_counter=
884  _vmware_native_table[num_events].report_difference=1;
885  num_events++;
886 
887  strcpy( _vmware_native_table[num_events].name,
888  "ELAPSED_TIME" );
889  strncpy( _vmware_native_table[num_events].description,
890  "Elapsed real time in ns.",
892  strcpy( _vmware_native_table[num_events].units,"ns");
893  _vmware_native_table[num_events].which_counter=
895  _vmware_native_table[num_events].report_difference=1;
896  num_events++;
897 
898  strcpy( _vmware_native_table[num_events].name,
899  "ELAPSED_APPARENT" );
900  strncpy( _vmware_native_table[num_events].description,
901  "Elapsed apparent time in ns.",
903  strcpy( _vmware_native_table[num_events].units,"ns");
904  _vmware_native_table[num_events].which_counter=
906  _vmware_native_table[num_events].report_difference=1;
907  num_events++;
908  }
909 
910  if (num_events==0) {
911  strncpy(_vmware_vector.cmp_info.disabled_reason,
912  "VMware SDK not installed, and PAPI_VMWARE_PSEUDOPERFORMANCE not set",
914  return PAPI_ECMP;
915  }
916 
917  _vmware_vector.cmp_info.num_native_events = num_events;
918 
919  return PAPI_OK;
920 }
921 
923 int
925 {
926  (void) ctl;
927 
928  return PAPI_OK;
929 }
930 
935 int
936 _vmware_ntv_enum_events( unsigned int *EventCode, int modifier )
937 {
938 
939  switch ( modifier ) {
940  /* return EventCode of first event */
941  case PAPI_ENUM_FIRST:
942  if (num_events==0) return PAPI_ENOEVNT;
943  *EventCode = 0;
944  return PAPI_OK;
945  break;
946  /* return EventCode of passed-in Event */
947  case PAPI_ENUM_EVENTS:{
948  int index = *EventCode;
949 
950  if ( index < num_events - 1 ) {
951  *EventCode = *EventCode + 1;
952  return PAPI_OK;
953  } else {
954  return PAPI_ENOEVNT;
955  }
956  break;
957  }
958  default:
959  return PAPI_EINVAL;
960  }
961  return PAPI_EINVAL;
962 }
963 
964 int
965 _vmware_ntv_code_to_info(unsigned int EventCode, PAPI_event_info_t *info)
966 {
967 
968  int index = EventCode;
969 
970  if ( ( index < 0) || (index >= num_events )) return PAPI_ENOEVNT;
971 
972  strncpy( info->symbol, _vmware_native_table[index].name,
973  sizeof(info->symbol));
974 
975  strncpy( info->long_descr, _vmware_native_table[index].description,
976  sizeof(info->symbol));
977 
978  strncpy( info->units, _vmware_native_table[index].units,
979  sizeof(info->units));
980 
981  return PAPI_OK;
982 }
983 
984 
990 int
991 _vmware_ntv_code_to_name( unsigned int EventCode, char *name, int len )
992 {
993  int index = EventCode;
994 
995  if ( index >= 0 && index < num_events ) {
996  strncpy( name, _vmware_native_table[index].name, len );
997  }
998  return PAPI_OK;
999 }
1000 
1006 int
1007 _vmware_ntv_code_to_descr( unsigned int EventCode, char *name, int len )
1008 {
1009  int index = EventCode;
1010 
1011  if ( index >= 0 && index < num_events ) {
1012  strncpy( name, _vmware_native_table[index].description, len );
1013  }
1014  return PAPI_OK;
1015 }
1016 
1018 int
1020  NativeInfo_t *native,
1021  int count,
1022  hwd_context_t *ctx )
1023 {
1024  (void) ctx;
1025 
1026  struct _vmware_control_state *control;
1027 
1028  int i, index;
1029 
1030  control=(struct _vmware_control_state *)ctl;
1031 
1032  for ( i = 0; i < count; i++ ) {
1033  index = native[i].ni_event;
1034  control->which_counter[i]=_vmware_native_table[index].which_counter;
1035  native[i].ni_position = i;
1036  }
1037  control->num_events=count;
1038 
1039  return PAPI_OK;
1040 }
1041 
1043 int
1045 {
1046  struct _vmware_context *context;
1047  (void) ctl;
1048 
1049  context=(struct _vmware_context *)ctx;
1050 
1051  _vmware_hardware_read( context, 1 );
1052 
1053  return PAPI_OK;
1054 }
1055 
1057 int
1059 {
1060 
1061  struct _vmware_context *context;
1062  (void) ctl;
1063 
1064  context=(struct _vmware_context *)ctx;
1065 
1066  _vmware_hardware_read( context, 0 );
1067 
1068  return PAPI_OK;
1069 }
1070 
1072 int
1074  hwd_control_state_t *ctl,
1075  long_long **events, int flags )
1076 {
1077 
1078  struct _vmware_context *context;
1079  struct _vmware_control_state *control;
1080 
1081  (void) flags;
1082  int i;
1083 
1084  context=(struct _vmware_context *)ctx;
1085  control=(struct _vmware_control_state *)ctl;
1086 
1087  _vmware_hardware_read( context, 0 );
1088 
1089  for (i=0; i<control->num_events; i++) {
1090 
1091  if (_vmware_native_table[
1092  _vmware_native_table[control->which_counter[i]].which_counter].
1093  report_difference) {
1094  control->value[i]=context->values[control->which_counter[i]]-
1095  context->start_values[control->which_counter[i]];
1096  } else {
1097  control->value[i]=context->values[control->which_counter[i]];
1098  }
1099  // printf("%d %d %lld-%lld=%lld\n",i,control->which_counter[i],
1100  // context->values[control->which_counter[i]],
1101  // context->start_values[control->which_counter[i]],
1102  // control->value[i]);
1103 
1104  }
1105 
1106  *events = control->value;
1107 
1108  return PAPI_OK;
1109 }
1110 
1112 /* otherwise, the updated state is written to ESI->hw_start */
1113 int
1115 {
1116  (void) ctx;
1117  (void) ctrl;
1118  (void) events;
1119  SUBDBG( "_vmware_write... %p %p", ctx, ctrl );
1120  /* FIXME... this should actually carry out the write, though */
1121  /* this is non-trivial as which counter being written has to be */
1122  /* determined somehow. */
1123  return PAPI_OK;
1124 }
1125 
1127 int
1129 {
1130  (void) ctx;
1131  (void) ctl;
1132 
1133  return PAPI_OK;
1134 }
1135 
1137 int
1139 {
1140  (void) ctx;
1141 
1142 #ifdef VMGUESTLIB
1143  VMGuestLibError glError;
1144  struct _vmware_context *context;
1145 
1146  context=(struct _vmware_context *)ctx;
1147 
1148  if (use_guestlib) {
1149  glError = GuestLib_CloseHandle(context->glHandle);
1150  if (glError != VMGUESTLIB_ERROR_SUCCESS) {
1151  fprintf(stderr, "Failed to CloseHandle: %s\n",
1152  GuestLib_GetErrorText(glError));
1153  return PAPI_ECMP;
1154  }
1155  }
1156 #endif
1157 
1158  return PAPI_OK;
1159 }
1160 
1162 int
1164 {
1165 
1166 #ifdef VMGUESTLIB
1167  if (dlclose(dlHandle)) {
1168  fprintf(stderr, "dlclose failed\n");
1169  return EXIT_FAILURE;
1170  }
1171 #endif
1172 
1173  return PAPI_OK;
1174 }
1175 
1176 
1182 int
1184 {
1185 
1186  (void) ctx;
1187  (void) code;
1188  (void) option;
1189 
1190  SUBDBG( "_vmware_ctl..." );
1191 
1192  return PAPI_OK;
1193 }
1194 
1204 int
1206 {
1207  (void) ctl;
1208 
1209  int found = 0;
1210  SUBDBG( "_vmware_set_domain..." );
1211  if ( PAPI_DOM_USER & domain ) {
1212  SUBDBG( " PAPI_DOM_USER " );
1213  found = 1;
1214  }
1215  if ( PAPI_DOM_KERNEL & domain ) {
1216  SUBDBG( " PAPI_DOM_KERNEL " );
1217  found = 1;
1218  }
1219  if ( PAPI_DOM_OTHER & domain ) {
1220  SUBDBG( " PAPI_DOM_OTHER " );
1221  found = 1;
1222  }
1223  if ( PAPI_DOM_ALL & domain ) {
1224  SUBDBG( " PAPI_DOM_ALL " );
1225  found = 1;
1226  }
1227  if ( !found ) {
1228  return ( PAPI_EINVAL );
1229  }
1230  return PAPI_OK;
1231 }
1232 
1234 papi_vector_t _vmware_vector = {
1235  .cmp_info = {
1236  /* default component information (unspecified values are initialized to 0) */
1237  .name = "vmware",
1238  .short_name = "vmware",
1239  .description = "Provide support for VMware vmguest and pseudo counters",
1240  .version = "5.0",
1241  .num_mpx_cntrs = VMWARE_MAX_COUNTERS,
1242  .num_cntrs = VMWARE_MAX_COUNTERS,
1243  .default_domain = PAPI_DOM_USER,
1244  .available_domains = PAPI_DOM_USER,
1245  .default_granularity = PAPI_GRN_THR,
1246  .available_granularities = PAPI_GRN_THR,
1247  .hardware_intr_sig = PAPI_INT_SIGNAL,
1248 
1249  /* component specific cmp_info initializations */
1250  .fast_real_timer = 0,
1251  .fast_virtual_timer = 0,
1252  .attach = 0,
1253  .attach_must_ptrace = 0,
1254  },
1255  /* sizes of framework-opaque component-private structures */
1256  .size = {
1257  .context = sizeof ( struct _vmware_context ),
1258  .control_state = sizeof ( struct _vmware_control_state ),
1259  .reg_value = sizeof ( struct _vmware_register ),
1260  .reg_alloc = sizeof ( struct _vmware_reg_alloc ),
1261  }
1262  ,
1263  /* function pointers in this component */
1264  .init_thread = _vmware_init,
1265  .init_component = _vmware_init_component,
1266  .init_control_state = _vmware_init_control_state,
1267  .start = _vmware_start,
1268  .stop = _vmware_stop,
1269  .read = _vmware_read,
1270  .write = _vmware_write,
1271  .shutdown_thread = _vmware_shutdown_thread,
1272  .shutdown_component = _vmware_shutdown_component,
1273  .ctl = _vmware_ctl,
1274 
1275  .update_control_state = _vmware_update_control_state,
1276  .set_domain = _vmware_set_domain,
1277  .reset = _vmware_reset,
1278 
1279  .ntv_enum_events = _vmware_ntv_enum_events,
1280  .ntv_code_to_name = _vmware_ntv_code_to_name,
1281  .ntv_code_to_descr = _vmware_ntv_code_to_descr,
1282  .ntv_code_to_info = _vmware_ntv_code_to_info,
1283 
1284 };
1285 
int _vmware_ntv_code_to_name(unsigned int EventCode, char *name, int len)
Definition: vmware.c:991
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:625
#define PAPI_HUGE_STR_LEN
Definition: fpapi.h:42
sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n")
#define PAPI_ENOMEM
Definition: fpapi.h:107
#define VMWARE_MEM_OVERHEAD_MB
Definition: vmware.c:50
int _vmware_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: vmware.c:1058
char * getenv()
#define VMWARE_MEM_TARGET_SIZE_MB
Definition: vmware.c:55
long long flags
Definition: iozone.c:12330
#define VMWARE_MEM_SHARES
Definition: vmware.c:53
#define PAPI_MAX_STR_LEN
Definition: fpapi.h:43
#define PAPI_DOM_ALL
Definition: fpapi.h:25
#define PAPI_MIN_STR_LEN
Definition: fpapi.h:41
#define PAPI_ENOEVNT
Definition: fpapi.h:112
static int num_events
int _vmware_ntv_enum_events(unsigned int *EventCode, int modifier)
Definition: vmware.c:936
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:964
Definition: vmware.c:80
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:961
int _vmware_set_domain(hwd_control_state_t *ctl, int domain)
Definition: vmware.c:1205
#define VMWARE_ELAPSED_APPARENT
Definition: vmware.c:64
#define VMWARE_ELAPSED_MS
Definition: vmware.c:44
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
#define PAPI_DOM_OTHER
Definition: fpapi.h:23
#define VMWARE_CPU_USED_MS
Definition: vmware.c:43
int _vmware_init_control_state(hwd_control_state_t *ctl)
Definition: vmware.c:924
#define PAPI_DOM_KERNEL
Definition: fpapi.h:22
void
Definition: iozone.c:18627
return PAPI_EINVAL
Definition: linux-nvml.c:408
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
double c
Definition: multiplex.c:22
#define VMWARE_MEM_SWAPPED_MB
Definition: vmware.c:54
int _vmware_init_thread(hwd_context_t *ctx)
Definition: vmware.c:528
static struct _vmware_native_event_entry * _vmware_native_table
Definition: vmware.c:288
Return codes and api definitions.
int _vmware_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
Definition: vmware.c:1007
int _vmware_write(hwd_context_t *ctx, hwd_control_state_t *ctrl, long_long events[])
Definition: vmware.c:1114
long long values[VMWARE_MAX_COUNTERS]
Definition: vmware.c:172
#define VMWARE_HOST_CPU_MHZ
Definition: vmware.c:58
char disabled_reason[PAPI_MAX_STR_LEN]
Definition: papi.h:632
#define VMWARE_CPU_RESERVATION_MHZ
Definition: vmware.c:40
void(* _dl_non_dynamic_init)(void)
Definition: linux-cuda.c:41
int i
Definition: fileop.c:140
#define PAPI_ENOSUPP
Definition: fpapi.h:123
int _vmware_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
Definition: vmware.c:1183
int _vmware_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long_long **events, int flags)
Definition: vmware.c:1073
#define VMWARE_ELAPSED_TIME
Definition: vmware.c:63
#define VMWARE_MEM_LIMIT_MB
Definition: vmware.c:48
long long found
Definition: libasync.c:735
static long long _vmware_hardware_read(struct _vmware_context *context, int starting)
Definition: vmware.c:302
static int cidx
Definition: event_info.c:40
#define PAPI_ECMP
Definition: fpapi.h:109
int report_difference
Definition: vmware.c:85
int which_counter
Definition: vmware.c:84
static int native
Definition: event_info.c:39
int which_counter[VMWARE_MAX_COUNTERS]
Definition: vmware.c:166
__attribute__((constructor))
Definition: init_fini.c:12
#define VMWARE_CPU_LIMIT_MHZ
Definition: vmware.c:39
int _vmware_shutdown_component(void)
Definition: vmware.c:1163
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
int _vmware_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
Definition: vmware.c:1019
int _vmware_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: vmware.c:1044
char events[MAX_EVENTS][BUFSIZ]
#define VMWARE_MAX_COUNTERS
Definition: vmware.c:37
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:53
nvmlDevice_t handle
Definition: linux-nvml.c:399
uint32_t id
Definition: linux-cuda.c:293
int _vmware_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
Definition: vmware.c:1128
#define VMWARE_MEM_ACTIVE_MB
Definition: vmware.c:46
char description[PAPI_HUGE_STR_LEN]
Definition: vmware.c:82
#define VMWARE_HOST_TSC
Definition: vmware.c:62
strcpy(filename, default_filename)
#define VMWARE_MEM_BALLOONED_MB
Definition: vmware.c:47
int _vmware_ntv_code_to_info(unsigned int EventCode, PAPI_event_info_t *info)
Definition: vmware.c:965
static int use_guestlib
Definition: vmware.c:292
char * name
Definition: iozone.c:23648
char name[PAPI_MAX_STR_LEN]
Definition: vmware.c:81
#define VMWARE_MEM_SHARED_MB
Definition: vmware.c:52
struct _vmware_register ra_bits
Definition: vmware.c:89
#define long_long
Definition: papi.h:549
uint64_t rdpmc(int c)
Definition: vmware.c:93
static int LoadFunctions(void)
Definition: vmware.c:203
long long start_values[VMWARE_MAX_COUNTERS]
Definition: vmware.c:173
#define VMWARE_MEM_USED_MB
Definition: vmware.c:56
char units[PAPI_MIN_STR_LEN]
Definition: vmware.c:83
#define VMWARE_MEM_MAPPED_MB
Definition: vmware.c:49
papi_vector_t _vmware_vector
Definition: vmware.c:67
#define PAPI_DOM_USER
Definition: fpapi.h:21
int _vmware_init_component(int cidx)
Definition: vmware.c:560
int _vmware_shutdown_thread(hwd_context_t *ctx)
Definition: vmware.c:1138
#define VMWARE_CPU_SHARES
Definition: vmware.c:41
#define VMWARE_CPU_STOLEN_MS
Definition: vmware.c:42
#define VMWARE_MEM_RESERVATION_MB
Definition: vmware.c:51
char units[PAPI_MIN_STR_LEN]
Definition: papi.h:970
#define PAPI_GRN_THR
Definition: fpapi.h:67
static int use_pseudo
Definition: vmware.c:291
long long value[VMWARE_MAX_COUNTERS]
Definition: vmware.c:165