src/hotspot/share/runtime/os_perf.hpp
changeset 50879 d90c3cbf13df
parent 50380 bec342339138
child 53244 9807daeb47c4
equal deleted inserted replaced
50878:fb7800b66c92 50879:d90c3cbf13df
    23  */
    23  */
    24 
    24 
    25 #ifndef SHARE_VM_RUNTIME_OS_PERF_HPP
    25 #ifndef SHARE_VM_RUNTIME_OS_PERF_HPP
    26 #define SHARE_VM_RUNTIME_OS_PERF_HPP
    26 #define SHARE_VM_RUNTIME_OS_PERF_HPP
    27 
    27 
       
    28 #include "memory/allocation.hpp"
    28 #include "utilities/macros.hpp"
    29 #include "utilities/macros.hpp"
    29 #include "memory/allocation.hpp"
       
    30 #include "utilities/globalDefinitions.hpp"
       
    31 
    30 
    32 #define FUNCTIONALITY_NOT_IMPLEMENTED -8
    31 #define FUNCTIONALITY_NOT_IMPLEMENTED -8
    33 
    32 
    34 class EnvironmentVariable : public CHeapObj<mtInternal> {
    33 class EnvironmentVariable : public CHeapObj<mtInternal> {
    35  public:
    34  public:
   192       FREE_C_HEAP_ARRAY(char, _command_line);
   191       FREE_C_HEAP_ARRAY(char, _command_line);
   193     }
   192     }
   194   }
   193   }
   195 };
   194 };
   196 
   195 
       
   196 class NetworkInterface : public ResourceObj {
       
   197  private:
       
   198   char* _name;
       
   199   uint64_t _bytes_in;
       
   200   uint64_t _bytes_out;
       
   201   NetworkInterface* _next;
       
   202 
       
   203   NetworkInterface(); // no impl
       
   204   NetworkInterface(const NetworkInterface& rhs); // no impl
       
   205   NetworkInterface& operator=(const NetworkInterface& rhs); // no impl
       
   206  public:
       
   207   NetworkInterface(const char* name, uint64_t bytes_in, uint64_t bytes_out, NetworkInterface* next) :
       
   208   _name(NULL),
       
   209   _bytes_in(bytes_in),
       
   210   _bytes_out(bytes_out),
       
   211   _next(next) {
       
   212     assert(name != NULL, "invariant");
       
   213     const size_t length = strlen(name);
       
   214     assert(allocated_on_res_area(), "invariant");
       
   215     _name = NEW_RESOURCE_ARRAY(char, length + 1);
       
   216     strncpy(_name, name, length + 1);
       
   217     assert(strncmp(_name, name, length) == 0, "invariant");
       
   218   }
       
   219 
       
   220   NetworkInterface* next() const {
       
   221     return _next;
       
   222   }
       
   223 
       
   224   const char* get_name() const {
       
   225     return _name;
       
   226   }
       
   227 
       
   228   uint64_t get_bytes_out() const {
       
   229     return _bytes_out;
       
   230   }
       
   231 
       
   232   uint64_t get_bytes_in() const {
       
   233     return _bytes_in;
       
   234   }
       
   235 };
       
   236 
   197 class CPUInformationInterface : public CHeapObj<mtInternal> {
   237 class CPUInformationInterface : public CHeapObj<mtInternal> {
   198  private:
   238  private:
   199   CPUInformation* _cpu_info;
   239   CPUInformation* _cpu_info;
   200  public:
   240  public:
   201   CPUInformationInterface();
   241   CPUInformationInterface();
   232 
   272 
   233   // information about system processes
   273   // information about system processes
   234   int system_processes(SystemProcess** system_procs, int* const no_of_sys_processes) const;
   274   int system_processes(SystemProcess** system_procs, int* const no_of_sys_processes) const;
   235 };
   275 };
   236 
   276 
       
   277 class NetworkPerformanceInterface : public CHeapObj<mtInternal> {
       
   278  private:
       
   279   class NetworkPerformance;
       
   280   NetworkPerformance* _impl;
       
   281   NetworkPerformanceInterface(const NetworkPerformanceInterface& rhs); // no impl
       
   282   NetworkPerformanceInterface& operator=(const NetworkPerformanceInterface& rhs); // no impl
       
   283  public:
       
   284   NetworkPerformanceInterface();
       
   285   bool initialize();
       
   286   ~NetworkPerformanceInterface();
       
   287   int network_utilization(NetworkInterface** network_interfaces) const;
       
   288 };
       
   289 
   237 #endif // SHARE_VM_RUNTIME_OS_PERF_HPP
   290 #endif // SHARE_VM_RUNTIME_OS_PERF_HPP