aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed_cpustatus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/gnunet-service-testbed_cpustatus.c')
-rw-r--r--src/testbed/gnunet-service-testbed_cpustatus.c117
1 files changed, 0 insertions, 117 deletions
diff --git a/src/testbed/gnunet-service-testbed_cpustatus.c b/src/testbed/gnunet-service-testbed_cpustatus.c
index b659b5dc3..f3df9a96e 100644
--- a/src/testbed/gnunet-service-testbed_cpustatus.c
+++ b/src/testbed/gnunet-service-testbed_cpustatus.c
@@ -398,114 +398,6 @@ ABORT_KSTAT:
398 } 398 }
399#endif 399#endif
400 400
401#if MINGW
402 /* Win NT? */
403 if (GNNtQuerySystemInformation)
404 {
405 static double dLastKernel;
406 static double dLastIdle;
407 static double dLastUser;
408 double dKernel;
409 double dIdle;
410 double dUser;
411 double dDiffKernel;
412 double dDiffIdle;
413 double dDiffUser;
414 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION theInfo;
415
416 if (GNNtQuerySystemInformation(SystemProcessorPerformanceInformation,
417 &theInfo,
418 sizeof(theInfo), NULL) == NO_ERROR)
419 {
420 /* PORT-ME MINGW: Multi-processor? */
421 dKernel = Li2Double(theInfo.KernelTime);
422 dIdle = Li2Double(theInfo.IdleTime);
423 dUser = Li2Double(theInfo.UserTime);
424 dDiffKernel = dKernel - dLastKernel;
425 dDiffIdle = dIdle - dLastIdle;
426 dDiffUser = dUser - dLastUser;
427
428 if (((dDiffKernel + dDiffUser) > 0) &&
429 (dLastIdle + dLastKernel + dLastUser > 0))
430 currentCPULoad =
431 100.0 - (dDiffIdle / (dDiffKernel + dDiffUser)) * 100.0;
432 else
433 currentCPULoad = -1; /* don't know (yet) */
434
435 dLastKernel = dKernel;
436 dLastIdle = dIdle;
437 dLastUser = dUser;
438
439 currentIOLoad = -1; /* FIXME-MINGW */
440 return GNUNET_OK;
441 }
442 else
443 {
444 /* only warn once, if there is a problem with
445 NtQuery..., we're going to hit it frequently... */
446 static int once;
447 if (once == 0)
448 {
449 once = 1;
450 GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
451 "Cannot query the CPU usage (Windows NT).\n");
452 }
453 return GNUNET_SYSERR;
454 }
455 }
456 else
457 { /* Win 9x */
458 HKEY hKey;
459 DWORD dwDataSize, dwType, dwDummy;
460
461 /* Start query */
462 if (RegOpenKeyEx(HKEY_DYN_DATA,
463 "PerfStats\\StartSrv",
464 0, KEY_ALL_ACCESS, &hKey) != ERROR_SUCCESS)
465 {
466 /* only warn once */
467 static int once = 0;
468 if (once == 0)
469 {
470 once = 1;
471 GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
472 "Cannot query the CPU usage (Win 9x)\n");
473 }
474 }
475
476 RegOpenKeyEx(HKEY_DYN_DATA,
477 "PerfStats\\StartStat", 0, KEY_ALL_ACCESS, &hKey);
478 dwDataSize = sizeof(dwDummy);
479 RegQueryValueEx(hKey,
480 "KERNEL\\CPUUsage",
481 NULL, &dwType, (LPBYTE)&dwDummy, &dwDataSize);
482 RegCloseKey(hKey);
483
484 /* Get CPU usage */
485 RegOpenKeyEx(HKEY_DYN_DATA,
486 "PerfStats\\StatData", 0, KEY_ALL_ACCESS, &hKey);
487 dwDataSize = sizeof(currentCPULoad);
488 RegQueryValueEx(hKey,
489 "KERNEL\\CPUUsage",
490 NULL, &dwType, (LPBYTE)&currentCPULoad, &dwDataSize);
491 RegCloseKey(hKey);
492 currentIOLoad = -1; /* FIXME-MINGW! */
493
494 /* Stop query */
495 RegOpenKeyEx(HKEY_DYN_DATA,
496 "PerfStats\\StopStat", 0, KEY_ALL_ACCESS, &hKey);
497 RegOpenKeyEx(HKEY_DYN_DATA,
498 "PerfStats\\StopSrv", 0, KEY_ALL_ACCESS, &hKey);
499 dwDataSize = sizeof(dwDummy);
500 RegQueryValueEx(hKey,
501 "KERNEL\\CPUUsage",
502 NULL, &dwType, (LPBYTE)&dwDummy, &dwDataSize);
503 RegCloseKey(hKey);
504
505 return GNUNET_OK;
506 }
507#endif
508
509 /* loadaverage not defined and no platform 401 /* loadaverage not defined and no platform
510 specific alternative defined 402 specific alternative defined
511 => default: error 403 => default: error
@@ -695,12 +587,6 @@ GST_stats_init(const struct GNUNET_CONFIGURATION_Handle *cfg)
695 char *fn; 587 char *fn;
696 size_t len; 588 size_t len;
697 589
698#if MINGW
699 GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
700 "Load statistics logging now available for windows\n");
701 return; /* No logging on windows for now :( */
702#endif
703
704 if (GNUNET_OK != 590 if (GNUNET_OK !=
705 GNUNET_CONFIGURATION_get_value_filename(cfg, "testbed", 591 GNUNET_CONFIGURATION_get_value_filename(cfg, "testbed",
706 "STATS_DIR", &stats_dir)) 592 "STATS_DIR", &stats_dir))
@@ -747,9 +633,6 @@ GST_stats_init(const struct GNUNET_CONFIGURATION_Handle *cfg)
747void 633void
748GST_stats_destroy() 634GST_stats_destroy()
749{ 635{
750#if MINGW
751 return;
752#endif
753 if (NULL == bw) 636 if (NULL == bw)
754 return; 637 return;
755#ifdef LINUX 638#ifdef LINUX