< prev index next >

src/hotspot/os/linux/os_perf_linux.cpp

Print this page

 486  private:
 487   CPUPerfCounters _counters;
 488 
 489   int cpu_load(int which_logical_cpu, double* cpu_load);
 490   int context_switch_rate(double* rate);
 491   int cpu_load_total_process(double* cpu_load);
 492   int cpu_loads_process(double* pjvmUserLoad, double* pjvmKernelLoad, double* psystemTotalLoad);
 493 
 494  public:
 495   CPUPerformance();
 496   bool initialize();
 497   ~CPUPerformance();
 498 };
 499 
 500 CPUPerformanceInterface::CPUPerformance::CPUPerformance() {
 501   _counters.nProcs = os::active_processor_count();
 502   _counters.cpus = NULL;
 503 }
 504 
 505 bool CPUPerformanceInterface::CPUPerformance::initialize() {
 506   size_t tick_array_size = (_counters.nProcs +1) * sizeof(os::Linux::CPUPerfTicks);
 507   _counters.cpus = (os::Linux::CPUPerfTicks*)NEW_C_HEAP_ARRAY(char, tick_array_size, mtInternal);
 508   if (NULL == _counters.cpus) {
 509     return false;
 510   }
 511   memset(_counters.cpus, 0, tick_array_size);
 512 
 513   // For the CPU load total
 514   os::Linux::get_tick_information(&_counters.cpus[_counters.nProcs], -1);
 515 
 516   // For each CPU
 517   for (int i = 0; i < _counters.nProcs; i++) {
 518     os::Linux::get_tick_information(&_counters.cpus[i], i);
 519   }
 520   // For JVM load
 521   get_jvm_ticks(&_counters.jvmTicks);
 522 
 523   // initialize context switch system
 524   // the double is only for init
 525   double init_ctx_switch_rate;
 526   perf_context_switch_rate(&init_ctx_switch_rate);
 527 
 528   return true;
 529 }
 530 
 531 CPUPerformanceInterface::CPUPerformance::~CPUPerformance() {

 486  private:
 487   CPUPerfCounters _counters;
 488 
 489   int cpu_load(int which_logical_cpu, double* cpu_load);
 490   int context_switch_rate(double* rate);
 491   int cpu_load_total_process(double* cpu_load);
 492   int cpu_loads_process(double* pjvmUserLoad, double* pjvmKernelLoad, double* psystemTotalLoad);
 493 
 494  public:
 495   CPUPerformance();
 496   bool initialize();
 497   ~CPUPerformance();
 498 };
 499 
 500 CPUPerformanceInterface::CPUPerformance::CPUPerformance() {
 501   _counters.nProcs = os::active_processor_count();
 502   _counters.cpus = NULL;
 503 }
 504 
 505 bool CPUPerformanceInterface::CPUPerformance::initialize() {
 506   size_t array_entry_count = _counters.nProcs + 1;
 507   _counters.cpus = NEW_C_HEAP_ARRAY(os::Linux::CPUPerfTicks, array_entry_count, mtInternal);
 508   if (NULL == _counters.cpus) {
 509     return false;
 510   }
 511   memset(_counters.cpus, 0, array_entry_count * sizeof(*_counters.cpus));
 512 
 513   // For the CPU load total
 514   os::Linux::get_tick_information(&_counters.cpus[_counters.nProcs], -1);
 515 
 516   // For each CPU
 517   for (int i = 0; i < _counters.nProcs; i++) {
 518     os::Linux::get_tick_information(&_counters.cpus[i], i);
 519   }
 520   // For JVM load
 521   get_jvm_ticks(&_counters.jvmTicks);
 522 
 523   // initialize context switch system
 524   // the double is only for init
 525   double init_ctx_switch_rate;
 526   perf_context_switch_rate(&init_ctx_switch_rate);
 527 
 528   return true;
 529 }
 530 
 531 CPUPerformanceInterface::CPUPerformance::~CPUPerformance() {
< prev index next >