RFR: 8315149: Add hsperf counters for CPU time of internal GC threads [v2]

Man Cao manc at openjdk.org
Wed Sep 6 21:59:42 UTC 2023


On Wed, 30 Aug 2023 22:58:41 GMT, Jonathan Joo <jjoo at openjdk.org> wrote:

>> 8315149: Add hsperf counters for CPU time of internal GC threads
>
> Jonathan Joo has updated the pull request incrementally with one additional commit since the last revision:
> 
>   address dholmes@ comments

src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp line 171:

> 169:   // the primary thread is started last and stopped first, so it will not risk
> 170:   // reading CPU time of a terminated worker thread.
> 171:   assert(Thread::current() == _threads[0],

This assert could be changed to call `assert_current_thread_is_primary_refinement_thread()`.

src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp line 85:

> 83:     if (UsePerfData && os::is_thread_cpu_time_supported() && is_primary()) {
> 84:       _cr->update_concurrent_refine_threads_cpu_time();
> 85:     }

There are two classes for primary thread and secondary refinement thread: `G1PrimaryConcurrentRefineThread` and `G1SecondaryConcurrentRefineThread`. It is probably cleaner to move this part inside `G1PrimaryConcurrentRefineThread` and add a virtual method in `G1ConcurrentRefineThread`. We can get rid of the `is_primary()` check as well.


class G1ConcurrentRefineThread {
   virtual void possibly_update_threads_cpu_time() {};
}

void G1PrimaryConcurrentRefineThread::possibly_update_threads_cpu_time() {
  if (UsePerfData && os::is_thread_cpu_time_supported()) {
    _cr->update_concurrent_refine_threads_cpu_time();
  }
}

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15082#discussion_r1317853674
PR Review Comment: https://git.openjdk.org/jdk/pull/15082#discussion_r1317862507


More information about the hotspot-dev mailing list