< prev index next >

src/hotspot/share/runtime/memprofiler.cpp

Print this page
rev 47862 : imported patch 10.07.open.rebase_20171110.dcubed
rev 47866 : robinw CR: Fix some inefficient code, update some comments, fix some indents, and add some 'const' specifiers.


  35 #include "runtime/mutexLocker.hpp"
  36 #include "runtime/os.hpp"
  37 #include "runtime/task.hpp"
  38 #include "runtime/thread.inline.hpp"
  39 #include "runtime/threadSMR.hpp"
  40 #include "runtime/vmThread.hpp"
  41 
  42 #ifndef PRODUCT
  43 
  44 // --------------------------------------------------------
  45 // MemProfilerTask
  46 
  47 class MemProfilerTask : public PeriodicTask {
  48  public:
  49   MemProfilerTask(int interval_time) : PeriodicTask(interval_time) {}
  50   void task();
  51 };
  52 
  53 
  54 void MemProfilerTask::task() {
  55   // Get thread lock to provide mutual exclusion, and so we can iterate safely over the thread list.
  56   MutexLocker mu(Threads_lock);
  57   MemProfiler::do_trace();
  58 }
  59 
  60 
  61 //----------------------------------------------------------
  62 // Implementation of MemProfiler
  63 
  64 MemProfilerTask* MemProfiler::_task   = NULL;
  65 FILE*            MemProfiler::_log_fp = NULL;
  66 
  67 
  68 bool MemProfiler::is_active() {
  69   return _task != NULL;
  70 }
  71 
  72 
  73 void MemProfiler::engage() {
  74   const char *log_name = "mprofile.log";
  75   if (!is_active()) {
  76     // Create log file




  35 #include "runtime/mutexLocker.hpp"
  36 #include "runtime/os.hpp"
  37 #include "runtime/task.hpp"
  38 #include "runtime/thread.inline.hpp"
  39 #include "runtime/threadSMR.hpp"
  40 #include "runtime/vmThread.hpp"
  41 
  42 #ifndef PRODUCT
  43 
  44 // --------------------------------------------------------
  45 // MemProfilerTask
  46 
  47 class MemProfilerTask : public PeriodicTask {
  48  public:
  49   MemProfilerTask(int interval_time) : PeriodicTask(interval_time) {}
  50   void task();
  51 };
  52 
  53 
  54 void MemProfilerTask::task() {


  55   MemProfiler::do_trace();
  56 }
  57 
  58 
  59 //----------------------------------------------------------
  60 // Implementation of MemProfiler
  61 
  62 MemProfilerTask* MemProfiler::_task   = NULL;
  63 FILE*            MemProfiler::_log_fp = NULL;
  64 
  65 
  66 bool MemProfiler::is_active() {
  67   return _task != NULL;
  68 }
  69 
  70 
  71 void MemProfiler::engage() {
  72   const char *log_name = "mprofile.log";
  73   if (!is_active()) {
  74     // Create log file


< prev index next >