2714 }
2715
2716
2717 // Simple ctor/dtor wrapper for accounting & timer chores around concurrent
2718 // phases.
2719 class CMSPhaseAccounting: public StackObj {
2720 public:
2721 CMSPhaseAccounting(CMSCollector *collector,
2722 const char *title);
2723 ~CMSPhaseAccounting();
2724
2725 private:
2726 CMSCollector *_collector;
2727 const char *_title;
2728 GCTraceConcTime(Info, gc) _trace_time;
2729
2730 public:
2731 // Not MT-safe; so do not pass around these StackObj's
2732 // where they may be accessed by other threads.
2733 jlong wallclock_millis() {
2734 return TimeHelper::counter_to_millis(os::elapsed_counter() - _trace_time.start_time());
2735 }
2736 };
2737
2738 CMSPhaseAccounting::CMSPhaseAccounting(CMSCollector *collector,
2739 const char *title) :
2740 _collector(collector), _title(title), _trace_time(title) {
2741
2742 _collector->resetYields();
2743 _collector->resetTimer();
2744 _collector->startTimer();
2745 }
2746
2747 CMSPhaseAccounting::~CMSPhaseAccounting() {
2748 _collector->stopTimer();
2749 log_debug(gc)("Concurrent active time: %.3fms", TimeHelper::counter_to_seconds(_collector->timerTicks()));
2750 log_trace(gc)(" (CMS %s yielded %d times)", _title, _collector->yields());
2751 }
2752
2753 // CMS work
2754
|
2714 }
2715
2716
2717 // Simple ctor/dtor wrapper for accounting & timer chores around concurrent
2718 // phases.
2719 class CMSPhaseAccounting: public StackObj {
2720 public:
2721 CMSPhaseAccounting(CMSCollector *collector,
2722 const char *title);
2723 ~CMSPhaseAccounting();
2724
2725 private:
2726 CMSCollector *_collector;
2727 const char *_title;
2728 GCTraceConcTime(Info, gc) _trace_time;
2729
2730 public:
2731 // Not MT-safe; so do not pass around these StackObj's
2732 // where they may be accessed by other threads.
2733 jlong wallclock_millis() {
2734 return (jlong)TimeHelper::counter_to_millis(os::elapsed_counter() - _trace_time.start_time());
2735 }
2736 };
2737
2738 CMSPhaseAccounting::CMSPhaseAccounting(CMSCollector *collector,
2739 const char *title) :
2740 _collector(collector), _title(title), _trace_time(title) {
2741
2742 _collector->resetYields();
2743 _collector->resetTimer();
2744 _collector->startTimer();
2745 }
2746
2747 CMSPhaseAccounting::~CMSPhaseAccounting() {
2748 _collector->stopTimer();
2749 log_debug(gc)("Concurrent active time: %.3fms", TimeHelper::counter_to_seconds(_collector->timerTicks()));
2750 log_trace(gc)(" (CMS %s yielded %d times)", _title, _collector->yields());
2751 }
2752
2753 // CMS work
2754
|