From jbechberger at openjdk.org Sun Jun 1 07:13:00 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Sun, 1 Jun 2025 07:13:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v25] In-Reply-To: References: Message-ID: <2nYqo0wpUrLLJV9iDRLwj5xjV06waCzu8Ma8YSAToIY=.1059ee96-77f8-47e6-8797-3f2b47783311@github.com> On Sat, 31 May 2025 10:37:29 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Remove debug printf > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.hpp line 139: > >> 137: >> 138: // Trigger sampling while a thread is not in a safepoint, from a seperate thread >> 139: static void trigger_is_thread_in_native_stackwalking(); > > Is it sampling that is triggered? Sampling refers to the asynchronous signal received from the operating system (OS). > > You are asking for the sampler thread to process already taken JFR Sample Requests in the queue, right? Yes and I like your implied name better. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2118819169 From jbechberger at openjdk.org Sun Jun 1 07:17:02 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Sun, 1 Jun 2025 07:17:02 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v25] In-Reply-To: References: Message-ID: On Sat, 31 May 2025 10:09:15 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Remove debug printf > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.hpp line 36: > >> 34: #if defined(LINUX) >> 35: >> 36: #include "memory/padded.hpp" > > What is padded? If not, this should go. Good catch. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2118820425 From jbechberger at openjdk.org Sun Jun 1 07:22:58 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Sun, 1 Jun 2025 07:22:58 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v24] In-Reply-To: <-QiSWEqppeW60aedVbLA3WTmnba7Fry53Qr86wE2EPs=.7a6327ce-7ef0-4b1c-bc68-0421ba3fd46f@github.com> References: <-QiSWEqppeW60aedVbLA3WTmnba7Fry53Qr86wE2EPs=.7a6327ce-7ef0-4b1c-bc68-0421ba3fd46f@github.com> Message-ID: On Fri, 30 May 2025 09:19:47 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/metadata/metadata.xml line 975: >> >>> 973: >>> 974: >>> 975: > >> I'm not a reviewer, but I just wanted to comment something I noticed. >> The JEP document says CPUTimeSampleLos'**t**', but the implementation says CPUTimeSampleLos'**s**'. Which one is correct? >> A sentence from the JEP document: >> >> Another new event,?`jdk.CPUTimeSampleLost`, is emitted when samples are lost ... > > Thanks for catching this mistake. I'll fix it this afternoon. I fixed it by changing the JEP. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2118825477 From jbechberger at openjdk.org Sun Jun 1 07:26:19 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Sun, 1 Jun 2025 07:26:19 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - Refactoring - Remove convoluted native trace logic ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/3a10d552..439763a3 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=25 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=24-25 Stats: 56 lines in 5 files changed: 3 ins; 27 del; 26 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Sun Jun 1 13:04:00 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 13:04:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 42: > 40: #include "runtime/javaThread.hpp" > 41: #include "runtime/osThread.hpp" > 42: #include "runtime/safepointMechanism.hpp" Not needed, since you have the .inline.hpp src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 102: > 100: > 101: u4 JfrCPUTimeTraceQueue::size() const { > 102: return Atomic::load(&_head); Is this read from multiple threads? In that case, load_acquire(). src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 200: > 198: void sample_thread(JfrSampleRequest& request, void* ucontext, JavaThread* jt, JfrThreadLocal* tl); > 199: > 200: // sample all threads that are in native state (and requested to be sampled) We are not really "sampling", but processing their queues, no? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119128911 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119129239 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119129708 From mgronlun at openjdk.org Sun Jun 1 13:08:00 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 13:08:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 367: > 365: JfrCPUTimeSampleRequest& request = queue.at(i); > 366: JfrStackTrace stacktrace; > 367: traceid tid = JfrThreadLocal::thread_id(thread); Check the tid as a function of the JfrSampleRequest, like we do in JFR Cooperative Sampling. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119130991 From mgronlun at openjdk.org Sun Jun 1 13:12:01 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 13:12:01 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 413: > 411: } > 412: if (Atomic::load(&count) % 1000 == 0) { > 413: log_info(jfr)("CPU thread sampler sent %zu events, lost %d, biased %zu\n", Atomic::load(&count), Atomic::load(&_lost_samples_sum), Atomic::load(&biased_count)); put this logging under jfr+debug or log+trace please ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119137014 From egahlin at openjdk.org Sun Jun 1 13:12:00 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Sun, 1 Jun 2025 13:12:00 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events In-Reply-To: References: Message-ID: On Sat, 31 May 2025 20:13:01 GMT, Markus Gr?nlund wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java event, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > src/jdk.jfr/share/classes/jdk/jfr/Throttle.java line 39: > >> 37: * example, {@code "100/s"}). >> 38: *

>> 39: * If the event class annotated with {@code Throttle} are filtered by other > > "is filtered" Will fix > src/jdk.jfr/share/classes/jdk/jfr/internal/ClassInspector.java line 148: > >> 146: return true; >> 147: } >> 148: if (superClass != null) { > > Does this also need to search superClass's super? The annotation is inherited so superClass's super will be included. > src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 256: > >> 254: // } >> 255: getEventConfiguration(codeBuilder); >> 256: codeBuilder.aload(0); > > Can issue a dup() here if you want to avoid the second aload(0). I don't think it will work because the result of the first getField (startTime) will be on the stack, when we issue the next getField (duration). > src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 257: > >> 255: getEventConfiguration(codeBuilder); >> 256: codeBuilder.aload(0); >> 257: getfield(codeBuilder, eventClassDesc, ImplicitFields.FIELD_START_TIME); > > In native,we use the endTime for duration events? Is there a need to synchronize the two? The duration is added later, in throttle. There is no this.endTime field to read here. > src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 590: > >> 588: private void setDuration(CodeBuilder codeBuilder, Consumer expression) { >> 589: codeBuilder.aload(0); >> 590: expression.accept(codeBuilder); > > dont know what expression.accept() does, but does it really consume the this pointer? I see its pushed again (aload(0)) if its throttled below? We need "this" on stack before the arguments are loaded in expression which is to be used at the end of the method by putfield > src/jdk.jfr/share/classes/jdk/jfr/internal/event/EventConfiguration.java line 59: > >> 57: // static boolean shouldThrottleCommit(long timestamp) >> 58: public boolean shouldThrottleCommit(long timestamp) { >> 59: return throttler.sample(timestamp); > > Can we assert on isEnabled? Between the time of the enabled() check and this method, the state may change, so it could lead to false positives in testing. > src/jdk.jfr/share/classes/jdk/jfr/internal/settings/Throttler.java line 62: > >> 60: // Not synchronized in fast path, but uses volatile reads. >> 61: public boolean sample(long ticks) { >> 62: if (disabled) { > > This volatile load is somewhat disappointing. Do you think it is needed? What happens if it is read without happens-before? It just creates an event that will most likely get discarded by the recorder engine on reset (if its set on setting update). If it's set to disabled, then the recorder engine has most likely stopped already, so the event will be discarded. Event settings are set with no visibility guarantees as to exact when they apply, so it should not really matter when it goes to disabled. I think we can skip it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119136217 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119135926 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119135820 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119134807 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119134400 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119132932 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119136976 From mgronlun at openjdk.org Sun Jun 1 13:23:00 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 13:23:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 557: > 555: if (!check_state(jt) || > 556: jt->is_JfrRecorder_thread()) { > 557: queue.increment_lost_samples(); is_JfrRecorder_thread() will not appear here since it's excluded and would have returned nullptr from get_java_thread_if_valid(). src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 558: > 556: jt->is_JfrRecorder_thread()) { > 557: queue.increment_lost_samples(); > 558: tl->set_do_async_processing_of_cpu_time_jfr_requests(false); Why is this restored here? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119142346 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119142510 From jbechberger at openjdk.org Sun Jun 1 13:43:58 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Sun, 1 Jun 2025 13:43:58 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 13:19:48 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Refactoring >> - Remove convoluted native trace logic > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 558: > >> 556: jt->is_JfrRecorder_thread()) { >> 557: queue.increment_lost_samples(); >> 558: tl->set_do_async_processing_of_cpu_time_jfr_requests(false); > > Why is this restored here? Because I shouldn't sample if the thread isn't in native state anymore. The thread is probably sampled anyway on the outgoing safepoint. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119157906 From mgronlun at openjdk.org Sun Jun 1 15:07:00 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 15:07:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 362: > 360: drain_enqueued_requests(now, tl, jt, current); > 361: #ifdef LINUX > 362: if (tl->has_cpu_time_jfr_requests()) { You are having all threads traverse over this lock, even though the cpu time sampler is disabled by default. Can it be improved? src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 604: > 602: > 603: bool JfrThreadLocal::has_cpu_time_jfr_requests() { > 604: return Atomic::load(&_has_cpu_time_jfr_requests); Atomic::load_acquire() src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 620: > 618: > 619: bool JfrThreadLocal::wants_async_processing_of_cpu_time_jfr_requests() { > 620: return Atomic::load(&_do_async_processing_of_cpu_time_jfr_requests); Atomic::load_acquire() ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119242319 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119243305 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119243393 From jbechberger at openjdk.org Sun Jun 1 15:07:00 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Sun, 1 Jun 2025 15:07:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: <62JxxY-xn3fwz0PnhcnIH6DOWBQUPIq_fhDD_7YrSmA=.bfbb317a-403e-4826-a3ed-c364882e821b@github.com> On Sun, 1 Jun 2025 15:01:06 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Refactoring >> - Remove convoluted native trace logic > > src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 362: > >> 360: drain_enqueued_requests(now, tl, jt, current); >> 361: #ifdef LINUX >> 362: if (tl->has_cpu_time_jfr_requests()) { > > You are having all threads traverse over this lock, even though the cpu time sampler is disabled by default. Can it be improved? Not without allocating in the signal handler ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119243238 From mgronlun at openjdk.org Sun Jun 1 15:27:06 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 15:27:06 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 332: > 330: JavaThread* jt = tlh.list()->thread_at(i); > 331: JfrThreadLocal* tl = jt->jfr_thread_local(); > 332: if (tl != nullptr && tl->wants_async_processing_of_cpu_time_jfr_requests()) { tl is never nullptr. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 344: > 342: > 343: // equals operator for JfrSampleRequest > 344: inline bool operator==(const JfrSampleRequest& lhs, const JfrSampleRequest& rhs) { Can be removed. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 574: > 572: > 573: if (queue.enqueue(request)) { > 574: tl->set_has_cpu_time_jfr_requests(true); This should only need to be set when enqueuing the first entry. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 581: > 579: > 580: if (jt->thread_state() == _thread_in_native && > 581: queue.size() > queue.capacity() * 2 / 3) { Is this logic still valid? You are only asking for a async processing depending on the load factor of the queue? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 586: > 584: JfrCPUTimeThreadSampling::trigger_async_processing_of_cpu_time_jfr_requests(); > 585: } else { > 586: tl->set_do_async_processing_of_cpu_time_jfr_requests(false); Was it true before and needed a reset? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119250661 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119250887 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119248176 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119248824 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119249381 From jbechberger at openjdk.org Sun Jun 1 15:27:06 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Sun, 1 Jun 2025 15:27:06 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 15:18:52 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Refactoring >> - Remove convoluted native trace logic > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 574: > >> 572: >> 573: if (queue.enqueue(request)) { >> 574: tl->set_has_cpu_time_jfr_requests(true); > > This should only need to be set when enqueuing the first entry. You're right > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 581: > >> 579: >> 580: if (jt->thread_state() == _thread_in_native && >> 581: queue.size() > queue.capacity() * 2 / 3) { > > Is this logic still valid? You are only asking for a async processing depending on the load factor of the queue? Yes, so I only start the thread walking if necessary ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119248709 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119250511 From mgronlun at openjdk.org Sun Jun 1 15:35:01 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 15:35:01 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 536: > 534: } > 535: > 536: volatile size_t count__ = 0; unused? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119258988 From jbechberger at openjdk.org Sun Jun 1 15:39:00 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Sun, 1 Jun 2025 15:39:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: <6Idy8j9wbNr9udYMhsW0BQmhb8dQvc_p20vCYtg5kZc=.6380eee6-bd1b-45d0-bca8-c8068e59bd36@github.com> On Sun, 1 Jun 2025 15:32:08 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Refactoring >> - Remove convoluted native trace logic > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 536: > >> 534: } >> 535: >> 536: volatile size_t count__ = 0; > > unused? Yes. > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 586: > >> 584: JfrCPUTimeThreadSampling::trigger_async_processing_of_cpu_time_jfr_requests(); >> 585: } else { >> 586: tl->set_do_async_processing_of_cpu_time_jfr_requests(false); > > Was it true before and needed a reset? I could check this before setting ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119260755 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119261558 From mgronlun at openjdk.org Sun Jun 1 15:43:06 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 15:43:06 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: <66tRvhjE2LrwccsAYmRycS6QLF2KdRg-XHfk-scr-wg=.c7f269f0-301a-4da3-ae54-7f6bc7a440b1@github.com> On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 587: > 585: } > 586: > 587: bool JfrThreadLocal::acquire_cpu_time_jfr_native_lock() { It appears that the lock state 'NATIVE' is redundant; an asynchronous request for queue drainage only requires the dequeue lock state. NATIVE can be removed to simplify the lock protocol. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119268003 From mgronlun at openjdk.org Sun Jun 1 18:12:58 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 18:12:58 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 15:24:17 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Refactoring >> - Remove convoluted native trace logic > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 344: > >> 342: >> 343: // equals operator for JfrSampleRequest >> 344: inline bool operator==(const JfrSampleRequest& lhs, const JfrSampleRequest& rhs) { > > Can be removed. Unless you still want to try the ljf JfrSampleRequest optimization for the native ljf, which I kind of like now that I understand it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119386104 From mgronlun at openjdk.org Sun Jun 1 18:13:00 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 18:13:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 15:23:06 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 581: >> >>> 579: >>> 580: if (jt->thread_state() == _thread_in_native && >>> 581: queue.size() > queue.capacity() * 2 / 3) { >> >> Is this logic still valid? You are only asking for async processing assistance depending on the load factor of the queue? > > Yes, so I only start the thread walking if necessary I see. With a bounded queue as used in this solution, it can work quite nicely, that is, if the thread is actually on CPU in native, and just not waiting - if waiting (which is most likely) then pending requests could take a long time to be sent to consumers. I also understand better the optimization you tried as part of async walk in native and frames. Also quite nice, to walk from the last JfrSampleRequest and do equals to "batch" the top JFR sample requests that are the same (i,.e taken for the ljf). Maybe you can retry that again, but then you need to save the sid AND the tid to be reused for the top equal requests (you only need stacktrace.record_inner() for one request). Its a nice optimization. >> src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 362: >> >>> 360: drain_enqueued_requests(now, tl, jt, current); >>> 361: #ifdef LINUX >>> 362: if (tl->has_cpu_time_jfr_requests()) { >> >> You are having all threads traverse over this test, even though the cpu time sampler is disabled by default. Can it be improved? > > Not without allocating in the signal handler How so? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119385303 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119389715 From mgronlun at openjdk.org Sun Jun 1 18:25:00 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 18:25:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 250: > 248: } > 249: > 250: biased = true; Perhaps set on entry, and only keep the single biased = false below? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119396997 From mgronlun at openjdk.org Sun Jun 1 18:31:58 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 18:31:58 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 18:22:10 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Refactoring >> - Remove convoluted native trace logic > > src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 250: > >> 248: } >> 249: >> 250: biased = true; > > Perhaps set on entry, and only keep the single biased = false below? Also, note you have a direct hit in line 221--222 above - it's biased = false. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119404072 From mgronlun at openjdk.org Sun Jun 1 19:05:53 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 19:05:53 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events In-Reply-To: References: Message-ID: On Fri, 30 May 2025 22:30:25 GMT, Erik Gahlin wrote: > Could I have review of an enhancement that adds rate-limited sampling to Java event, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik src/jdk.jfr/share/classes/jdk/jfr/internal/settings/Throttler.java line 130: > 128: } > 129: > 130: private long amortizedDebt(ThrottlerWindow expired) { amortizeDept (in the present) - like this is the value we will be using to amortize (in the future) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119457164 From mgronlun at openjdk.org Sun Jun 1 19:10:51 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 19:10:51 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events In-Reply-To: References: Message-ID: On Fri, 30 May 2025 22:30:25 GMT, Erik Gahlin wrote: > Could I have review of an enhancement that adds rate-limited sampling to Java event, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik src/jdk.jfr/share/classes/jdk/jfr/internal/settings/Throttler.java line 148: > 146: return nextGeometric(adjustBoundary(projectProbability), randomGenerator.nextDouble()); > 147: } > 148: double projectPopulationSize(ThrottlerWindow expired) { not private? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119459623 From mgronlun at openjdk.org Sun Jun 1 19:18:54 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 19:18:54 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events In-Reply-To: References: Message-ID: On Fri, 30 May 2025 22:30:25 GMT, Erik Gahlin wrote: > Could I have review of an enhancement that adds rate-limited sampling to Java event, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik src/jdk.jfr/share/classes/jdk/jfr/internal/settings/Throttler.java line 142: > 140: private long deriveSamplingInterval(double sampleSize, ThrottlerWindow expired) { > 141: double populationSize = projectPopulationSize(expired); > 142: if (adjustBoundary(populationSize) <= adjustBoundary(sampleSize)) { Do you need all these adjustBoundary() calls? It only checks if a double value is 0 or 1. Population and sample sizes will be much larger. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119471003 From mgronlun at openjdk.org Sun Jun 1 19:25:51 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Sun, 1 Jun 2025 19:25:51 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events In-Reply-To: References: Message-ID: On Fri, 30 May 2025 22:30:25 GMT, Erik Gahlin wrote: > Could I have review of an enhancement that adds rate-limited sampling to Java event, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik src/jdk.jfr/share/classes/jdk/jfr/internal/settings/ThrottlerWindow.java line 49: > 47: measuredPopulationSize.set(0); > 48: endTicks = JVM.counterTime() + > 49: JVMSupport.nanosToTicks(1_000_000L * parameters.windowDurationMillis); indent to make it clear it assigns. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119475462 From egahlin at openjdk.org Sun Jun 1 20:56:50 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Sun, 1 Jun 2025 20:56:50 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v2] In-Reply-To: References: Message-ID: > Could I have review of an enhancement that adds rate-limited sampling to Java event, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: Some reviewer feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25559/files - new: https://git.openjdk.org/jdk/pull/25559/files/73943e7a..d0097506 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=00-01 Stats: 10 lines in 3 files changed: 1 ins; 1 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/25559.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25559/head:pull/25559 PR: https://git.openjdk.org/jdk/pull/25559 From egahlin at openjdk.org Sun Jun 1 21:10:52 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Sun, 1 Jun 2025 21:10:52 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v2] In-Reply-To: References: Message-ID: On Sat, 31 May 2025 21:20:17 GMT, Markus Gr?nlund wrote: >> Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: >> >> Some reviewer feedback > > src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 261: > >> 259: getfield(codeBuilder, eventClassDesc, ImplicitFields.FIELD_DURATION); >> 260: Bytecode.invokevirtual(codeBuilder, TYPE_EVENT_CONFIGURATION, METHOD_THROTTLE); >> 261: int result = codeBuilder.allocateLocal(TypeKind.LONG); > > Do we really need to store the result in a local? Can't we just dup it on the expression stack and store it directly into the field after another aload, or dup? Perhaps dup twice to then issue the mask operation? We could do an aload(0) at the beginning, before getEventConfiguration(codeBuilder), to have "this" for putfield(duration) later, but then we would need to do a getfield(this.duration) to have it on the stack for the mask. We can't do a dup() on duration because we need "this" on the stack to store it in this.duration. I thought using a local variable would be faster than accessing this.duration. It also reduces the chance of the value being changed by another thread. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2119593028 From egahlin at openjdk.org Sun Jun 1 21:49:51 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Sun, 1 Jun 2025 21:49:51 GMT Subject: RFR: 8356698: JFR: @Contextual In-Reply-To: References: Message-ID: <15zlaAo42KfRzTTaIwKcXlhLsKeEkQQwQVnBBCWt5eU=.c90b11b8-b4cb-42c1-9c21-8f18bf7fe1b2@github.com> On Sat, 31 May 2025 18:58:29 GMT, Markus Gr?nlund wrote: >> Could I have a review of a new annotation that can be used to annotate a field as contextual. >> >> Testing: jdk/jdk/jfr + tier1 >> >> Thanks >> Erik > > src/jdk.jfr/share/classes/jdk/jfr/events/MethodTraceEvent.java line 39: > >> 37: public final class MethodTraceEvent extends AbstractJDKEvent { >> 38: >> 39: @Contextual > > Should the MethodTraceEvent's method field really have this annotation? Or is it a remnant from testing? I think it can be useful if a contextual GUI is created where users can drill down into tables and see all events that occur during a method call. For example, if you want to troubleshoot a slow login: $ java -XX:StartFlightRecording:method-trace=LoginService::login ... | Context Types |----------------------------------- | Order::id | **MethodTrace::method** (selected) | Trace::span | Trace::name |Context Values |----------------------------------- | **LoginService::login(String, String)** (selected) Start Time | Event Type | Duration --------------|-----------------------|------------- 20:05:02.45 | jdk.JavaMonitorEnter | 25 ms 20:05:03.12 | jdbc.ExecuteQuery | 2 s ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25249#discussion_r2119629183 From dholmes at openjdk.org Mon Jun 2 04:35:02 2025 From: dholmes at openjdk.org (David Holmes) Date: Mon, 2 Jun 2025 04:35:02 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 07:26:19 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Refactoring > - Remove convoluted native trace logic Just some drive-by comments mainly on your acquire/release usage. I'm not at all clear what memory accesses you are trying to coordinate with those. src/hotspot/share/jfr/jni/jfrJniMethod.cpp line 176: > 174: JfrEventSetting::set_enabled(JfrCPUTimeSampleEvent, rate > 0); > 175: JfrCPUTimeThreadSampling::set_rate(rate, autoadapt == JNI_TRUE); > 176: return JNI_TRUE; What is the point of having a boolean return type if you always return true? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 59: > 57: Thread* raw_thread = Thread::current_or_null_safe(); > 58: JavaThread* jt; > 59: if (raw_thread == nullptr || !raw_thread->is_Java_thread()) { // this can happen due to the high level of parralelism Suggestion: if (raw_thread == nullptr || !raw_thread->is_Java_thread()) { // this can happen due to the high level of parallelism src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 119: > 117: _data = new_data; > 118: _capacity = capacity; > 119: } I assume there is a lock protecting this so it happens atomically? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 122: > 120: > 121: bool JfrCPUTimeTraceQueue::is_full() const { > 122: return Atomic::load_acquire(&_head) >= _capacity; I don't see why acquire semantics would be needed here. Also how can it be > capacity? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 126: > 124: > 125: bool JfrCPUTimeTraceQueue::is_empty() const { > 126: return Atomic::load_acquire(&_head) == 0; Acquire semantics are definitely not needed here. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 130: > 128: > 129: s4 JfrCPUTimeTraceQueue::lost_samples() const { > 130: return Atomic::load_acquire(&_lost_samples); Again acquire semantics seem highly dubious here - what loads are you synchronizing with? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 139: > 137: > 138: u4 JfrCPUTimeTraceQueue::get_and_reset_lost_samples() { > 139: s4 lost_samples = Atomic::load_acquire(&_lost_samples); Again acquire semantics seem highly dubious here - what loads are you synchronizing with? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 151: > 149: set_capacity(capacity); > 150: } > 151: } Seems an odd definition - typically `ensure_capacity` will grow a data structure to ensure it has sufficient capacity, and if already larger than needed that is fine. Suggestion `change_capacity`, or more traditionally `resize`? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 237: > 235: > 236: void JfrCPUTimeThreadSampler::trigger_async_processing_of_cpu_time_jfr_requests() { > 237: Atomic::release_store(&_is_async_processing_of_cpu_time_jfr_requests_triggered, true); What prior stores are you ensuring should be visible by using release semantics here? ------------- PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2886627655 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119983062 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119983911 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120016607 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120011705 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120012200 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120014449 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120014541 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120020174 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120021034 From dholmes at openjdk.org Mon Jun 2 04:35:02 2025 From: dholmes at openjdk.org (David Holmes) Date: Mon, 2 Jun 2025 04:35:02 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v5] In-Reply-To: References: <6hGNW2D3_VuD-2WN0eTLYdEJoNu_9rPLu-dH-InGSK4=.64de8bc8-a98f-400f-a5e3-885dbd84d901@github.com> Message-ID: <7wOUvZZtjrX3TpgT9JQLm-8qTAax6PrXtfHwMJpNX4M=.13a7c6cc-e037-4108-b392-7ff30d279c05@github.com> On Mon, 26 May 2025 06:29:03 GMT, Johannes Bechberger wrote: >> Also, is raw_thread == nullptr even possible? For the same reasons. > > `!raw_thread->is_Java_thread()` I found it during testing. What thread was it, and how did it reach this code? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2119984783 From kbarrett at openjdk.org Mon Jun 2 05:48:59 2025 From: kbarrett at openjdk.org (Kim Barrett) Date: Mon, 2 Jun 2025 05:48:59 GMT Subject: RFR: 8358205: Remove unused JFR array allocation code In-Reply-To: <4iPujAp0lL_pVhcjlfMX42dIqE7Aw5X8FZr2k5cSFGo=.139bdd20-c798-4335-9ebd-cf0748e7d339@github.com> References: <4iPujAp0lL_pVhcjlfMX42dIqE7Aw5X8FZr2k5cSFGo=.139bdd20-c798-4335-9ebd-cf0748e7d339@github.com> Message-ID: On Fri, 30 May 2025 18:10:07 GMT, Coleen Phillimore wrote: > The JFR code is using ObjArray->allocate() directly rather than going through oopFactory. In Valhalla, the oopFactory code is being changed to account for new array shapes and attributes, so all code should call that instead. Turns out this function is unused, so this change removes it. Tested with tier1-7 with a ShouldNotReachHere(), then jdk/jfr tests with the removal. Looks good. ------------- Marked as reviewed by kbarrett (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25553#pullrequestreview-2886834584 From jbechberger at openjdk.org Mon Jun 2 08:44:01 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 08:44:01 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 13:01:23 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Refactoring >> - Remove convoluted native trace logic > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 200: > >> 198: void sample_thread(JfrSampleRequest& request, void* ucontext, JavaThread* jt, JfrThreadLocal* tl); >> 199: >> 200: // sample all threads that are in native state (and requested to be sampled) > > We are not really "sampling", but processing their queues, no? You're correct. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120450563 From jbechberger at openjdk.org Mon Jun 2 08:47:01 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 08:47:01 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: <3d549Fxkhzd6v0fAVFEBOcxZ7hBKI1ZAUafLClp7Npw=.70183618-7dbf-4e05-bcc8-fd1216741c66@github.com> On Sun, 1 Jun 2025 13:05:44 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Refactoring >> - Remove convoluted native trace logic > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 367: > >> 365: JfrCPUTimeSampleRequest& request = queue.at(i); >> 366: JfrStackTrace stacktrace; >> 367: traceid tid = JfrThreadLocal::thread_id(thread); > > Check the tid as a function of the JfrSampleRequest, like we do in JFR Cooperative Sampling. You mean ` const traceid tid = in_continuation ? tl->vthread_id_with_epoch_update(jt) : JfrThreadLocal::jvm_thread_id(jt);`? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120458307 From jbechberger at openjdk.org Mon Jun 2 08:53:02 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 08:53:02 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: <3d549Fxkhzd6v0fAVFEBOcxZ7hBKI1ZAUafLClp7Npw=.70183618-7dbf-4e05-bcc8-fd1216741c66@github.com> References: <3d549Fxkhzd6v0fAVFEBOcxZ7hBKI1ZAUafLClp7Npw=.70183618-7dbf-4e05-bcc8-fd1216741c66@github.com> Message-ID: On Mon, 2 Jun 2025 08:44:01 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 367: >> >>> 365: JfrCPUTimeSampleRequest& request = queue.at(i); >>> 366: JfrStackTrace stacktrace; >>> 367: traceid tid = JfrThreadLocal::thread_id(thread); >> >> Check the tid as a function of the JfrSampleRequest, like we do in JFR Cooperative Sampling. > > You mean ` const traceid tid = in_continuation ? tl->vthread_id_with_epoch_update(jt) : JfrThreadLocal::jvm_thread_id(jt);`? I implemented this in this function now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120473792 From jbechberger at openjdk.org Mon Jun 2 08:57:04 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 08:57:04 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 13:41:44 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 558: >> >>> 556: jt->is_JfrRecorder_thread()) { >>> 557: queue.increment_lost_samples(); >>> 558: tl->set_do_async_processing_of_cpu_time_jfr_requests(false); >> >> Why is this restored here? > > Because I shouldn't sample if the thread isn't in native state anymore. The thread is probably sampled anyway on the outgoing safepoint. But you might be right, I removed it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120481274 From jbechberger at openjdk.org Mon Jun 2 09:01:05 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 09:01:05 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 18:10:15 GMT, Markus Gr?nlund wrote: >> Not without allocating in the signal handler > > How so? Because we need to add the threads from the signal handler. So any kind of growing array or set would not work, especially if we want to remove the threads from within the signal handler again. This is certainly an area of future optimization, albeit this doesn't seem to have any measurable performance impact in my renaissance benchmark runs. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120492743 From vyazici at openjdk.org Mon Jun 2 09:02:56 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Mon, 2 Jun 2025 09:02:56 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v2] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 20:56:50 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java event, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Some reviewer feedback src/jdk.jfr/share/classes/jdk/jfr/internal/settings/Throttler.java line 30: > 28: import java.util.concurrent.locks.ReentrantLock; > 29: import jdk.jfr.internal.PlatformEventType; > 30: public final class Throttler { **Disclaimer:** I am a passer-by and I don't possess a deep JFR experience. Throttling (aka. rate limiting) is a pretty much non-trivial functionality. Shall we - Revamp the JavaDoc and document the used algorithm? - Have a dedicated test for `Throttler`? (I see that the newly added `TestThrottle` tests `@Throttle`, hence it also covers `Throttler`. Though there I could not see any verification based on the time[stamp] of events.) ### References - Resilience4j: - [AtomicRateLimiter](https://github.com/resilience4j/resilience4j/blob/master/resilience4j-ratelimiter/src/main/java/io/github/resilience4j/ratelimiter/internal/AtomicRateLimiter.java) - [AtomicRateLimiterTest](https://github.com/resilience4j/resilience4j/blob/master/resilience4j-ratelimiter/src/test/java/io/github/resilience4j/ratelimiter/internal/AtomicRateLimiterTest.java) - Guava: - [RateLimiter](https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/RateLimiter.java) - [RateLimiterTest](https://github.com/google/guava/blob/master/guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2120496703 From jbechberger at openjdk.org Mon Jun 2 09:05:02 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 09:05:02 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 18:00:55 GMT, Markus Gr?nlund wrote: >> Yes, so I only start the thread walking if necessary > > I see. With a bounded queue as used in this solution, it can work quite nicely, that is, if the thread is actually on CPU in native, and just not waiting - if waiting (which is most likely) then pending requests could take a long time to be sent to consumers. > > I also understand better the optimization you tried as part of async walk in native and frames. Also quite nice, to walk from the last JfrSampleRequest and do equals to "batch" the top JFR sample requests that are the same (i,.e taken for the ljf). Maybe you can retry that again, but then you need to save the sid AND the tid to be reused for the top equal requests (you only need stacktrace.record_inner() for one request). Its a nice optimization. The problem is when in between queue processing a new JFR chunk is started. This caused problems before. I would leave these kinds of optimizations for later. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120501728 From jbechberger at openjdk.org Mon Jun 2 09:09:04 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 09:09:04 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 18:03:15 GMT, Markus Gr?nlund wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 344: >> >>> 342: >>> 343: // equals operator for JfrSampleRequest >>> 344: inline bool operator==(const JfrSampleRequest& lhs, const JfrSampleRequest& rhs) { >> >> Can be removed. > > Unless you still want to try the ljf JfrSampleRequest optimization for the native ljf, which I kind of like now that I understand it. As I said, it's a great optimization. But it needs some work. I therefore remove this method for now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120511048 From jbechberger at openjdk.org Mon Jun 2 09:28:01 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 09:28:01 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 04:28:02 GMT, David Holmes wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Refactoring >> - Remove convoluted native trace logic > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 119: > >> 117: _data = new_data; >> 118: _capacity = capacity; >> 119: } > > I assume there is a lock protecting this so it happens atomically? This happens before the signal handler is attached to thread. So it does happen before any parallelism is introduced on thread creation. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120557327 From egahlin at openjdk.org Mon Jun 2 10:02:53 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Mon, 2 Jun 2025 10:02:53 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v2] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 08:59:57 GMT, Volkan Yazici wrote: >> Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: >> >> Some reviewer feedback > > src/jdk.jfr/share/classes/jdk/jfr/internal/settings/Throttler.java line 30: > >> 28: import java.util.concurrent.locks.ReentrantLock; >> 29: import jdk.jfr.internal.PlatformEventType; >> 30: public final class Throttler { > > **Disclaimer:** I am a passer-by and I don't possess a deep JFR experience. > > Throttling (aka. rate limiting) is a pretty much non-trivial functionality. Shall we > > - Revamp the JavaDoc and document the used algorithm? > - Have a dedicated test for `Throttler`? (I see that the newly added `TestThrottle` tests `@Throttle`, hence it also covers `Throttler`. Though there I could not see any verification based on the time[stamp] of events.) > > ### References > > - Resilience4j: > - [AtomicRateLimiter](https://github.com/resilience4j/resilience4j/blob/master/resilience4j-ratelimiter/src/main/java/io/github/resilience4j/ratelimiter/internal/AtomicRateLimiter.java) > - [AtomicRateLimiterTest](https://github.com/resilience4j/resilience4j/blob/master/resilience4j-ratelimiter/src/test/java/io/github/resilience4j/ratelimiter/internal/AtomicRateLimiterTest.java) > - Guava: > - [RateLimiter](https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/RateLimiter.java) > - [RateLimiterTest](https://github.com/google/guava/blob/master/guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java) I don't think we want to write the algorithm in the specification. It would make it harder for us to make adjustments in the future. The contract is x events per time unit without details on how JFR adapts the sampling. The algorithm is the same one used by the jdk.ObjectAllocationSample event, which has been in use since JDK 16, but implemented in native code and with a gtest: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/jfr/support/jfrAdaptiveSampler.cpp The code in the PR is a method per method port of that code. It's hard to write stable tests that include timestamps. We have tried that in the past for other settings/events, but it only resulted in false positives. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2120643350 From mgronlun at openjdk.org Mon Jun 2 10:08:52 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 10:08:52 GMT Subject: RFR: 8356698: JFR: @Contextual In-Reply-To: <15zlaAo42KfRzTTaIwKcXlhLsKeEkQQwQVnBBCWt5eU=.c90b11b8-b4cb-42c1-9c21-8f18bf7fe1b2@github.com> References: <15zlaAo42KfRzTTaIwKcXlhLsKeEkQQwQVnBBCWt5eU=.c90b11b8-b4cb-42c1-9c21-8f18bf7fe1b2@github.com> Message-ID: On Sun, 1 Jun 2025 21:46:23 GMT, Erik Gahlin wrote: > I think it can be useful if a contextual GUI is created where users can drill down into tables and see all events that occur during a method call. For example, if you want to troubleshoot a slow login: > > ``` > $ java -XX:StartFlightRecording:method-trace=LoginService::login ... > ``` > > Context Types > Order::id > **MethodTrace::method** (selected) > Trace::id > Trace::name > Start Time Duration Context Values > 20:05:02.10 5.0 s **LoginService::login(String, String)** (selected) > 20:05:08.10 80 ms **LoginService::login(String, String)** > 20:05:10.10 75 ms **LoginService::login(String, String)** > Start Time Event Name Duration > 20:05:02.45 Java Monitor Enter 25 ms > 20:05:03.12 JDBC Execute Query 4.7 s > > or some other known aspect of the program that has been problematic in the past and now have been annotated, for example: > > ``` > $ java -XX:StartFlightRecording:method-trace=@com.example.UpdateOrder ... > ``` I could not agree more. A GUI picking up these innovations, making them conveniently accessible and easily understandable to the end user would be fantastic. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25249#discussion_r2120658143 From mgronlun at openjdk.org Mon Jun 2 10:14:52 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 10:14:52 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v2] In-Reply-To: References: Message-ID: On Sun, 1 Jun 2025 13:07:50 GMT, Erik Gahlin wrote: >> src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 256: >> >>> 254: // } >>> 255: getEventConfiguration(codeBuilder); >>> 256: codeBuilder.aload(0); >> >> Can issue a dup() here if you want to avoid the second aload(0). > > I don't think it will work because the result of the first getField (startTime) will be on the stack, when we issue the next getField (duration). No big deal, we can look into the details later. >> src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 261: >> >>> 259: getfield(codeBuilder, eventClassDesc, ImplicitFields.FIELD_DURATION); >>> 260: Bytecode.invokevirtual(codeBuilder, TYPE_EVENT_CONFIGURATION, METHOD_THROTTLE); >>> 261: int result = codeBuilder.allocateLocal(TypeKind.LONG); >> >> Do we really need to store the result in a local? Can't we just dup it on the expression stack and store it directly into the field after another aload, or dup? Perhaps dup twice to then issue the mask operation? > > We could do an aload(0) at the beginning, before getEventConfiguration(codeBuilder), to have "this" for putfield(duration) later, but then we would need to do a getfield(this.duration) to have it on the stack for the mask. > > We can't do a dup() on duration because we need "this" on the stack to store it in this.duration. I thought using a local variable would be faster than accessing this.duration. It also reduces the chance of the value being changed by another thread. No big deal, we can look into this later if the need arises. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2120675164 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2120676832 From mgronlun at openjdk.org Mon Jun 2 10:21:50 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 10:21:50 GMT Subject: RFR: 8358205: Remove unused JFR array allocation code In-Reply-To: <4iPujAp0lL_pVhcjlfMX42dIqE7Aw5X8FZr2k5cSFGo=.139bdd20-c798-4335-9ebd-cf0748e7d339@github.com> References: <4iPujAp0lL_pVhcjlfMX42dIqE7Aw5X8FZr2k5cSFGo=.139bdd20-c798-4335-9ebd-cf0748e7d339@github.com> Message-ID: On Fri, 30 May 2025 18:10:07 GMT, Coleen Phillimore wrote: > The JFR code is using ObjArray->allocate() directly rather than going through oopFactory. In Valhalla, the oopFactory code is being changed to account for new array shapes and attributes, so all code should call that instead. Turns out this function is unused, so this change removes it. Tested with tier1-7 with a ShouldNotReachHere(), then jdk/jfr tests with the removal. Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25553#pullrequestreview-2887708018 From shade at openjdk.org Mon Jun 2 11:25:36 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 2 Jun 2025 11:25:36 GMT Subject: RFR: 8358318: JFR: Tighten up PlatformTracer initialization Message-ID: Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need. Additional testing: - [x] Linux x86_64 server fastdebug, `jdk_jfr` ------------- Commit messages: - Fix Changes: https://git.openjdk.org/jdk/pull/25584/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25584&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8358318 Stats: 21 lines in 2 files changed: 15 ins; 5 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25584.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25584/head:pull/25584 PR: https://git.openjdk.org/jdk/pull/25584 From mgronlun at openjdk.org Mon Jun 2 11:26:00 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 11:26:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: <45mCuuxToelhOdhbJlap5NCUMfgDBrVGIUDGJHAk2Rg=.1dd9d5a6-f2b5-4214-8815-d0a9f0cbddbb@github.com> On Mon, 2 Jun 2025 08:58:28 GMT, Johannes Bechberger wrote: >> How so? > > Because we need to add the threads from the signal handler. So any kind of growing array or set would not work, especially if we want to remove the threads from within the signal handler again. > > This is certainly an area of future optimization, albeit this doesn't seem to have any measurable performance impact in my renaissance benchmark runs. I don't understand what allocation has to do with anything. I'm talking about code branch layout to avoid having to test "has_cpu_time_jfr_requests()" when we know it will be false by default. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120846868 From mgronlun at openjdk.org Mon Jun 2 11:28:59 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 11:28:59 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: <7Cy88EZJj1ZgHXaAoCY9m1PnB6UAGDJxgK9PI3BVYBQ=.a4fbad7a-19fa-4e1e-999e-8773d2fd7fb1@github.com> On Mon, 2 Jun 2025 09:02:05 GMT, Johannes Bechberger wrote: >> I see. With a bounded queue as used in this solution, it can work quite nicely, that is, if the thread is actually on CPU in native, and just not waiting - if waiting (which is most likely) then pending requests could take a long time to be sent to consumers. >> >> I also understand better the optimization you tried as part of async walk in native and frames. Also quite nice, to walk from the last JfrSampleRequest and do equals to "batch" the top JFR sample requests that are the same (i,.e taken for the ljf). Maybe you can retry that again, but then you need to save the sid AND the tid to be reused for the top equal requests (you only need stacktrace.record_inner() for one request). Its a nice optimization. > > The problem is when in between queue processing a new JFR chunk is started. This caused problems before. > > I would leave these kinds of optimizations for later. Then I would recommend you drain immediately when the thread is in native, not waiting for the queue to fill up to 2/3. The reason is because the solution is based on CPU time samples and most threads that are _thread_in_native are waiting (i.e. they will not get their queues filled while in native). I would recommend dropping the second clause about testing the queue size altogether. That way you will not get threads stuck with a lot of events a long time in native, not being delivered. Revive it later when you begin to attack the optimizations. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120855119 From jbechberger at openjdk.org Mon Jun 2 11:32:27 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 11:32:27 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v27] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - Tiny fixes - Minor changes ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/439763a3..6a83d759 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=26 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=25-26 Stats: 90 lines in 9 files changed: 24 ins; 29 del; 37 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Mon Jun 2 11:40:00 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 11:40:00 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: <45mCuuxToelhOdhbJlap5NCUMfgDBrVGIUDGJHAk2Rg=.1dd9d5a6-f2b5-4214-8815-d0a9f0cbddbb@github.com> References: <45mCuuxToelhOdhbJlap5NCUMfgDBrVGIUDGJHAk2Rg=.1dd9d5a6-f2b5-4214-8815-d0a9f0cbddbb@github.com> Message-ID: On Mon, 2 Jun 2025 11:22:45 GMT, Markus Gr?nlund wrote: >> Because we need to add the threads from the signal handler. So any kind of growing array or set would not work, especially if we want to remove the threads from within the signal handler again. >> >> This is certainly an area of future optimization, albeit this doesn't seem to have any measurable performance impact in my renaissance benchmark runs. > > I don't understand what allocation has to do with anything. I'm talking about code branch layout to avoid having to test "has_cpu_time_jfr_requests()" when we know it will be false by default. Ah. Sorry. Is it about reading the atomic boolean flag again? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120882396 From mgronlun at openjdk.org Mon Jun 2 11:40:02 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 11:40:02 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v27] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 11:32:27 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Tiny fixes > - Minor changes src/hotspot/share/runtime/thread.hpp line 59: > 57: class SafeThreadsListPtr; > 58: class ThreadClosure; > 59: class ThreadCrashProtection; Should not be needed. src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java line 276: > 274: * Set the maximum event emission rate for the CPU time sampler > 275: * > 276: * Setting rate to 0 turns off the CPU time method sampler. "CPU time method sampler" -> "CPU time sampler" ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120878701 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120882161 From egahlin at openjdk.org Mon Jun 2 11:46:53 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Mon, 2 Jun 2025 11:46:53 GMT Subject: RFR: 8358318: JFR: Tighten up PlatformTracer initialization In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 11:19:52 GMT, Aleksey Shipilev wrote: > Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need. > > Additional testing: > - [x] Linux x86_64 server fastdebug, `jdk_jfr` All event settings modifications happen with the "metadata" lock, so only one thread at a time can modify the state in MethodSetting. I think it's sufficient to remove volatile in that class. It's misleading. See: https://github.com/openjdk/jdk/blob/83cb0c6de5988de526545d0926c2c6ef60efc1c7/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java#L225 ------------- PR Comment: https://git.openjdk.org/jdk/pull/25584#issuecomment-2930235431 From jbechberger at openjdk.org Mon Jun 2 11:51:26 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 11:51:26 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v28] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with three additional commits since the last revision: - Remove header includes - Always trigger async processing - Remove one atomic read ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/6a83d759..e482ad37 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=27 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=26-27 Stats: 21 lines in 6 files changed: 3 ins; 6 del; 12 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Mon Jun 2 11:51:27 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 11:51:27 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v27] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 11:32:27 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Tiny fixes > - Minor changes src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 35: > 33: > 34: #include "jfr/recorder/jfrRecorder.hpp" > 35: #include "jfr/recorder/service/jfrRecorderService.hpp" The two includes above are not needed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120890097 From mgronlun at openjdk.org Mon Jun 2 11:51:27 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 11:51:27 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: <45mCuuxToelhOdhbJlap5NCUMfgDBrVGIUDGJHAk2Rg=.1dd9d5a6-f2b5-4214-8815-d0a9f0cbddbb@github.com> Message-ID: On Mon, 2 Jun 2025 11:37:23 GMT, Johannes Bechberger wrote: >> I don't understand what allocation has to do with anything. I'm talking about code branch layout to avoid having to test "has_cpu_time_jfr_requests()" when we know it will be false by default. > > Ah. Sorry. Is it about reading the atomic boolean flag again? Right. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120897042 From jbechberger at openjdk.org Mon Jun 2 11:51:27 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 11:51:27 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: <45mCuuxToelhOdhbJlap5NCUMfgDBrVGIUDGJHAk2Rg=.1dd9d5a6-f2b5-4214-8815-d0a9f0cbddbb@github.com> Message-ID: On Mon, 2 Jun 2025 11:43:54 GMT, Markus Gr?nlund wrote: >> Ah. Sorry. Is it about reading the atomic boolean flag again? > > Right. I pass it through now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120906973 From coleenp at openjdk.org Mon Jun 2 11:54:00 2025 From: coleenp at openjdk.org (Coleen Phillimore) Date: Mon, 2 Jun 2025 11:54:00 GMT Subject: RFR: 8358205: Remove unused JFR array allocation code In-Reply-To: <4iPujAp0lL_pVhcjlfMX42dIqE7Aw5X8FZr2k5cSFGo=.139bdd20-c798-4335-9ebd-cf0748e7d339@github.com> References: <4iPujAp0lL_pVhcjlfMX42dIqE7Aw5X8FZr2k5cSFGo=.139bdd20-c798-4335-9ebd-cf0748e7d339@github.com> Message-ID: On Fri, 30 May 2025 18:10:07 GMT, Coleen Phillimore wrote: > The JFR code is using ObjArray->allocate() directly rather than going through oopFactory. In Valhalla, the oopFactory code is being changed to account for new array shapes and attributes, so all code should call that instead. Turns out this function is unused, so this change removes it. Tested with tier1-7 with a ShouldNotReachHere(), then jdk/jfr tests with the removal. Thank you for reviewing, Kim and Markus. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25553#issuecomment-2930287718 From coleenp at openjdk.org Mon Jun 2 11:54:00 2025 From: coleenp at openjdk.org (Coleen Phillimore) Date: Mon, 2 Jun 2025 11:54:00 GMT Subject: Integrated: 8358205: Remove unused JFR array allocation code In-Reply-To: <4iPujAp0lL_pVhcjlfMX42dIqE7Aw5X8FZr2k5cSFGo=.139bdd20-c798-4335-9ebd-cf0748e7d339@github.com> References: <4iPujAp0lL_pVhcjlfMX42dIqE7Aw5X8FZr2k5cSFGo=.139bdd20-c798-4335-9ebd-cf0748e7d339@github.com> Message-ID: On Fri, 30 May 2025 18:10:07 GMT, Coleen Phillimore wrote: > The JFR code is using ObjArray->allocate() directly rather than going through oopFactory. In Valhalla, the oopFactory code is being changed to account for new array shapes and attributes, so all code should call that instead. Turns out this function is unused, so this change removes it. Tested with tier1-7 with a ShouldNotReachHere(), then jdk/jfr tests with the removal. This pull request has now been integrated. Changeset: c22af0c2 Author: Coleen Phillimore URL: https://git.openjdk.org/jdk/commit/c22af0c29ea89857c5cf57dd127b5c739130b2f1 Stats: 50 lines in 5 files changed: 0 ins; 45 del; 5 mod 8358205: Remove unused JFR array allocation code Reviewed-by: kbarrett, mgronlun ------------- PR: https://git.openjdk.org/jdk/pull/25553 From shade at openjdk.org Mon Jun 2 11:55:51 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 2 Jun 2025 11:55:51 GMT Subject: RFR: 8358318: JFR: Tighten up PlatformTracer initialization In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 11:19:52 GMT, Aleksey Shipilev wrote: > Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need. > > Additional testing: > - [x] Linux x86_64 server fastdebug, `jdk_jfr` Ah, cool, so no bug. I still think it is cleaner to do `PlatformTracer.ensureInitialized()`. I can drop the locking/volatile from there, if you think that is unnecessary. I'd prefer to keep it multi-thread safe to avoid future accidents, though. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25584#issuecomment-2930310946 From erwan.viollet at gmail.com Mon Jun 2 13:30:19 2025 From: erwan.viollet at gmail.com (Erwan Viollet) Date: Mon, 2 Jun 2025 15:30:19 +0200 Subject: JFR: Scrubbing sensitive information from events Message-ID: Hello, I am currently looking into how to remove sensitive information from JFR events. The main events that typically contain sensitive information: jdk.SystemProcess, jdk.InitialSystemProperty, jdk.JVMInformation. Passwords from command lines can typically be found in these events. Dropping these events altogether is not ideal, as we need them to make relevant performance recommendations to users (e.g. suggesting JVM or system setting adjustments). Dropping them or scrubbing them on the backend side (after the fact) requires decompressing and re-writing these events, which is wasteful in terms of both compute and storage. The approach is not perfect, as we still end up intaking and temporarily storing sensitive information. Ideally, we would like to be able to scrub or redact only the sensitive fields within these events (for example, using a simple regex or pattern-based rule), rather than dropping the whole event. We also want to avoid handling this only after the event has already been written to the JFR file, as that does not fully mitigate the risk of exposing sensitive data. At present, it appears there is no public API or supported mechanism to intercept or scrub JFR events in-process, before they are persisted. What would you think of an API accepting custom scrubbing patterns so that sensitive data never leaves the JVM in an unredacted state? Are there any plans or discussions in this area? I am fairly new to the JFR world, so it is likely that I missed previous discussions around this. Thank you, Best regards, Erwan Viollet, Profiling team, Datadog -------------- next part -------------- An HTML attachment was scrubbed... URL: From jbechberger at openjdk.org Mon Jun 2 13:50:49 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 13:50:49 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Fix bug related to async stack walking ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/e482ad37..09ca4fed Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=28 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=27-28 Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Mon Jun 2 14:52:03 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 14:52:03 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 13:50:49 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix bug related to async stack walking src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 349: > 347: const frame top_frame = thread->last_frame(); > 348: bool in_continuation = is_in_continuation(top_frame, thread); > 349: for (u4 i = 0; i < queue.size(); i++) { Realized this drainage is entirely wrong! You are not using the sample requests in the queue to build individual stack traces for events; instead, you are using the same top frame (the last Java frame) for all of them. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121391177 From mgronlun at openjdk.org Mon Jun 2 15:04:12 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 15:04:12 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 13:50:49 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix bug related to async stack walking src/hotspot/share/jfr/jfr.inline.hpp line 41: > 39: inline void Jfr::check_and_process_sample_request(JavaThread* jt) { > 40: JfrThreadLocal* tl = jt->jfr_thread_local(); > 41: bool has_cpu_time_sample_request = tl->has_cpu_time_jfr_requests(); Why this change? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 191: > 189: void sample_thread(JfrSampleRequest& request, void* ucontext, JavaThread* jt, JfrThreadLocal* tl); > 190: > 191: // process the queues for all threads that are in native state (and requested to be sampled) "requested to be processed" I guess. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 270: > 268: void JfrCPUTimeThreadSampler::enroll() { > 269: if (Atomic::cmpxchg(&_disenrolled, true, false)) { > 270: log_info(jfr)("Enrolling CPU thread sampler"); log_trace, please. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 279: > 277: void JfrCPUTimeThreadSampler::disenroll() { > 278: if (!Atomic::cmpxchg(&_disenrolled, false, true)) { > 279: log_info(jfr)("Disenrolling CPU thread sampler"); log_trace, please. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121414317 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121416556 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121426574 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121428073 From jbechberger at openjdk.org Mon Jun 2 15:04:13 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 15:04:13 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 14:57:47 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix bug related to async stack walking > > src/hotspot/share/jfr/jfr.inline.hpp line 41: > >> 39: inline void Jfr::check_and_process_sample_request(JavaThread* jt) { >> 40: JfrThreadLocal* tl = jt->jfr_thread_local(); >> 41: bool has_cpu_time_sample_request = tl->has_cpu_time_jfr_requests(); > > Why this change? So I don't read the ` tl->has_cpu_time_jfr_requests()` twice on the hot-path > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 349: > >> 347: const frame top_frame = thread->last_frame(); >> 348: bool in_continuation = is_in_continuation(top_frame, thread); >> 349: for (u4 i = 0; i < queue.size(); i++) { > > Realized this drainage is entirely wrong! > > You are not using the sample requests in the queue to build individual stack traces for events; instead, you are using the same top frame (the last Java frame) for all of them. Can I export compute_top_frame and use it here? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121424752 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121413413 From jbechberger at openjdk.org Mon Jun 2 15:04:13 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 2 Jun 2025 15:04:13 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 14:57:22 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 349: >> >>> 347: const frame top_frame = thread->last_frame(); >>> 348: bool in_continuation = is_in_continuation(top_frame, thread); >>> 349: for (u4 i = 0; i < queue.size(); i++) { >> >> Realized this drainage is entirely wrong! >> >> You are not using the sample requests in the queue to build individual stack traces for events; instead, you are using the same top frame (the last Java frame) for all of them. > > Can I export compute_top_frame and use it here? Or just create a `Jfr::drain_cpu_time_queue` method? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121426469 From mgronlun at openjdk.org Mon Jun 2 15:12:04 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 15:12:04 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: <_CAWRT6nKdljf9SDRnD-SfdXP9L9S6Y9f6I1nGB-4q8=.eb524157-7c00-4f01-8d8a-9e9c60ef4dc7@github.com> On Mon, 2 Jun 2025 15:01:39 GMT, Johannes Bechberger wrote: >> Can I export compute_top_frame and use it here? > > Or just create a `Jfr::drain_cpu_time_queue` method? Try to move the entire: void JfrCPUTimeThreadSampler::stackwalk_thread_in_native(JavaThread* thread) { } Into JfrThreadSampling.hpp / jfrThreadSampling.cpp - you can send your JfrCPUTimeThreadSampler events from there. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121456081 From mgronlun at openjdk.org Mon Jun 2 15:18:11 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 15:18:11 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 15:01:15 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/jfr.inline.hpp line 41: >> >>> 39: inline void Jfr::check_and_process_sample_request(JavaThread* jt) { >>> 40: JfrThreadLocal* tl = jt->jfr_thread_local(); >>> 41: bool has_cpu_time_sample_request = tl->has_cpu_time_jfr_requests(); >> >> Why this change? > > So I don't read the ` tl->has_cpu_time_jfr_requests()` twice on the hot-path Ok, for now. We should try to come up with a better split. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121466027 From mgronlun at openjdk.org Mon Jun 2 15:18:12 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 15:18:12 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: <_CAWRT6nKdljf9SDRnD-SfdXP9L9S6Y9f6I1nGB-4q8=.eb524157-7c00-4f01-8d8a-9e9c60ef4dc7@github.com> References: <_CAWRT6nKdljf9SDRnD-SfdXP9L9S6Y9f6I1nGB-4q8=.eb524157-7c00-4f01-8d8a-9e9c60ef4dc7@github.com> Message-ID: On Mon, 2 Jun 2025 15:09:30 GMT, Markus Gr?nlund wrote: >> Or just create a `Jfr::drain_cpu_time_queue` method? > > Try to move the entire: > > void JfrCPUTimeThreadSampler::stackwalk_thread_in_native(JavaThread* thread) { > } > > Into JfrThreadSampling.hpp / jfrThreadSampling.cpp - you can send your JfrCPUTimeThreadSampler events from there. Of course, rename the routine to something appropriate. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121469433 From mgronlun at openjdk.org Mon Jun 2 15:22:03 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 15:22:03 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 13:50:49 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix bug related to async stack walking src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 250: > 248: break; > 249: } else { > 250: biased = false; Not correct. There is a top_frame = *current - >biased = true below. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121482514 From liach at openjdk.org Mon Jun 2 15:30:54 2025 From: liach at openjdk.org (Chen Liang) Date: Mon, 2 Jun 2025 15:30:54 GMT Subject: RFR: 8358318: JFR: Tighten up PlatformTracer initialization In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 11:19:52 GMT, Aleksey Shipilev wrote: > Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need. > > Additional testing: > - [x] Linux x86_64 server fastdebug, `jdk_jfr` src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/PlatformTracer.java line 49: > 47: */ > 48: public final class PlatformTracer { > 49: private static volatile boolean INITIALIZED; Can we make this a static final field in a holder class, so we call `PlatformTracer::initialize` from that holder class's ``, and after initialization, the check to `INITIALIZED` field can be constant-folded instead of being a volatile read? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25584#discussion_r2121506115 From shade at openjdk.org Mon Jun 2 15:51:50 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 2 Jun 2025 15:51:50 GMT Subject: RFR: 8358318: JFR: Tighten up PlatformTracer initialization In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 15:27:52 GMT, Chen Liang wrote: >> Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need. >> >> Additional testing: >> - [x] Linux x86_64 server fastdebug, `jdk_jfr` > > src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/PlatformTracer.java line 49: > >> 47: */ >> 48: public final class PlatformTracer { >> 49: private static volatile boolean INITIALIZED; > > Can we make this a static final field in a holder class, so we call `PlatformTracer::initialize` from that holder class's ``, and after initialization, the check to `INITIALIZED` field can be constant-folded instead of being a volatile read? As @egahlin mentions, it might be unnecessary, as this code is supposed to run in single-thread mode, and we do not need `volatile` at all. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25584#discussion_r2121565935 From shade at openjdk.org Mon Jun 2 17:28:32 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 2 Jun 2025 17:28:32 GMT Subject: RFR: 8358318: JFR: Tighten up PlatformTracer initialization [v2] In-Reply-To: References: Message-ID: > Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need. > > Additional testing: > - [x] Linux x86_64 server fastdebug, `jdk_jfr` Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: - Unsynchronized fix - Merge branch 'master' into JDK-8358318-jfr-platform-tracer-init - Fix ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25584/files - new: https://git.openjdk.org/jdk/pull/25584/files/b5635420..0d8c05a1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25584&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25584&range=00-01 Stats: 534 lines in 32 files changed: 309 ins; 146 del; 79 mod Patch: https://git.openjdk.org/jdk/pull/25584.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25584/head:pull/25584 PR: https://git.openjdk.org/jdk/pull/25584 From mgronlun at openjdk.org Mon Jun 2 17:29:04 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 17:29:04 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 13:50:49 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix bug related to async stack walking src/hotspot/share/memory/resourceArea.hpp line 46: > 44: // A ResourceArea is an Arena that supports safe usage of ResourceMark. > 45: class ResourceArea: public Arena { > 46: Changes in this file are unrelated, so revert this entire file. src/hotspot/share/prims/forte.cpp line 575: > 573: extern "C" { > 574: JNIEXPORT > 575: void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) { Unrelated changes, please revert file. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121757461 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121757998 From shade at openjdk.org Mon Jun 2 17:28:32 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 2 Jun 2025 17:28:32 GMT Subject: RFR: 8358318: JFR: Tighten up PlatformTracer initialization In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 11:42:11 GMT, Erik Gahlin wrote: > All event settings modifications happen with the "metadata" lock, so only one thread at a time can modify the state in MethodSetting. I think it's sufficient to remove volatile in that class. It's misleading. See new commit. This drops `volatile`, looks generally cleaner, and avoids triggering analysis that complains about static field modifications from instance methods on top. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25584#issuecomment-2931689864 From egahlin at openjdk.org Mon Jun 2 17:38:53 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Mon, 2 Jun 2025 17:38:53 GMT Subject: RFR: 8358318: JFR: Tighten up PlatformTracer initialization [v2] In-Reply-To: References: Message-ID: <_jYL97zo2sr8OY28pn0LuEhgVusxdJ1orObaHu_LQEI=.cfb84b12-e2e6-4651-bd97-61b4186a8615@github.com> On Mon, 2 Jun 2025 17:28:32 GMT, Aleksey Shipilev wrote: >> Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need. >> >> Additional testing: >> - [x] Linux x86_64 server fastdebug, `jdk_jfr` > > Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: > > - Unsynchronized fix > - Merge branch 'master' into JDK-8358318-jfr-platform-tracer-init > - Fix Marked as reviewed by egahlin (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25584#pullrequestreview-2889374075 From egahlin at openjdk.org Mon Jun 2 18:25:00 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Mon, 2 Jun 2025 18:25:00 GMT Subject: Integrated: 8356698: JFR: @Contextual In-Reply-To: References: Message-ID: <37s8zcu35k8EmAme38VWPY1B0Q4lt3Ca1GL_Wojpqeg=.37664c94-1b9c-44fb-b5d0-cf075fc9a897@github.com> On Thu, 15 May 2025 12:46:54 GMT, Erik Gahlin wrote: > Could I have a review of a new annotation that can be used to annotate a field as contextual. > > Testing: jdk/jdk/jfr + tier1 > > Thanks > Erik This pull request has now been integrated. Changeset: 1373ceb7 Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/1373ceb7f3040a03ae142cfaab0f74894fc6a0a3 Stats: 706 lines in 6 files changed: 698 ins; 3 del; 5 mod 8356698: JFR: @Contextual Reviewed-by: mgronlun ------------- PR: https://git.openjdk.org/jdk/pull/25249 From vyazici at openjdk.org Mon Jun 2 18:39:33 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Mon, 2 Jun 2025 18:39:33 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: > Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`. > > `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357993 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to Hotspot. Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: Provide fallback for `stdin.encoding` ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25542/files - new: https://git.openjdk.org/jdk/pull/25542/files/d7751294..45bdc4fd Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25542&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25542&range=00-01 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/25542.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25542/head:pull/25542 PR: https://git.openjdk.org/jdk/pull/25542 From shade at openjdk.org Mon Jun 2 18:47:28 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 2 Jun 2025 18:47:28 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 13:50:49 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix bug related to async stack walking Scanned this briefly, would do another pass tomorrow. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 117: > 115: > 116: bool JfrCPUTimeTraceQueue::is_empty() const { > 117: return Atomic::load(&_head) == 0; Not entirely clear what is the memory semantics for accessing `_head`. Does it need to be acq/rel? If so, this one should be `::load_acquire`? src/hotspot/share/memory/resourceArea.hpp line 46: > 44: // A ResourceArea is an Arena that supports safe usage of ResourceMark. > 45: class ResourceArea: public Arena { > 46: All the changes in this file are unnecessary, please revert. src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java line 281: > 279: * @param autoadapt true if the rate should be adapted automatically > 280: */ > 281: public static native void setCPUThrottle(double rate, boolean autoadapt); Suggestion: public static native void setCPUThrottle(double rate, boolean autoAdapt); test/jdk/jdk/jfr/event/profiling/TestSamplingLongPeriod.java line 42: > 40: public class TestSamplingLongPeriod { > 41: > 42: static String sampleEvent = EventNames.ExecutionSample; Does not look necessary to change? ------------- PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2888004951 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121900364 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121610476 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121587105 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2121584954 From shade at openjdk.org Mon Jun 2 18:47:28 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 2 Jun 2025 18:47:28 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v24] In-Reply-To: References: <-QiSWEqppeW60aedVbLA3WTmnba7Fry53Qr86wE2EPs=.7a6327ce-7ef0-4b1c-bc68-0421ba3fd46f@github.com> Message-ID: On Sun, 1 Jun 2025 07:19:54 GMT, Johannes Bechberger wrote: >> Thanks for catching this mistake. I'll fix it this afternoon. > > I fixed it by changing the JEP. Hold on, shouldn't this really be "Lost"? @egahlin and @mgronlun need to chime in here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120893338 From shade at openjdk.org Mon Jun 2 18:47:30 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Mon, 2 Jun 2025 18:47:30 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v27] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 11:32:27 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Tiny fixes > - Minor changes src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 30: > 28: #include "runtime/orderAccess.hpp" > 29: #include "utilities/ticks.hpp" > 30: #include "jfr/periodic/sampling/jfrCPUTimeThreadSampler.hpp" Include order? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 60: > 58: assert(raw_thread->is_Java_thread(), "invariant"); > 59: JavaThread* jt; > 60: if ((jt = JavaThread::cast(raw_thread))->is_exiting()) { I see no point to be extra-smart with inline assignments here: Suggestion: JavaThread* jt = JavaThread::cast(raw_thread); if (jt->is_exiting()) { src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 115: > 113: JfrCPUTimeSampleRequest* new_data = JfrCHeapObj::new_array(capacity); > 114: JfrCHeapObj::free(_data, _capacity * sizeof(JfrCPUTimeSampleRequest)); > 115: _data = new_data; A bit of peak memory consumption improvement: don't have two things live at once. Plus, give the native allocator a chance to reuse the same location. Suggestion: JfrCHeapObj::free(_data, _capacity * sizeof(JfrCPUTimeSampleRequest)); _data = JfrCHeapObj::new_array(capacity); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120895107 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120897472 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2120909443 From cjplummer at openjdk.org Mon Jun 2 19:02:53 2025 From: cjplummer at openjdk.org (Chris Plummer) Date: Mon, 2 Jun 2025 19:02:53 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 18:39:33 GMT, Volkan Yazici wrote: >> Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`. >> >> `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357993 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to Hotspot. > > Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: > > Provide fallback for `stdin.encoding` src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CLHSDB.java line 111: > 109: > 110: Charset charset = Charset.forName(System.getProperty("stdin.encoding"), Charset.defaultCharset()); > 111: BufferedReader in = new BufferedReader(new InputStreamReader(System.in, charset)); Why in some cases are you special casing the the default charset as you do here, but in other cases you are not? Also, the CharSet.forName() API you are using here is new in 18, which means backports will need to address that. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25542#discussion_r2121939764 From vyazici at openjdk.org Mon Jun 2 19:41:52 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Mon, 2 Jun 2025 19:41:52 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 19:00:23 GMT, Chris Plummer wrote: > Why in some cases are you special casing the the default charset as you do here, but in other cases you are not? @plummercj, as requested in the parent ticket (i.e., [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893)), I added a fallback, except for tests. AFAICT, if `stdin.encoding` is either missing or contains an invalid value in a test, we ideally should fail the test. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25542#discussion_r2122007106 From mgronlun at openjdk.org Mon Jun 2 20:07:02 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 2 Jun 2025 20:07:02 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 13:50:49 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix bug related to async stack walking src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 49: > 47: > 48: static bool is_excluded(JavaThread* thread) { > 49: return thread->is_hidden_from_external_view() || thread->jfr_thread_local()->is_excluded(); I think I misled you saying that JfrRecorder_thread would be excluded by the above expression. That was true - but not anymore. Our exclusion test looks like: static inline bool is_excluded(JavaThread* jt) { assert(jt != nullptr, "invariant"); return jt->is_Compiler_thread() || jt->is_hidden_from_external_view() || jt->is_JfrRecorder_thread() || jt->jfr_thread_local()->is_excluded(); } I like you could fold jt->is_Compiler_thread() into jt->is_hidden_from_external_view() - good!. But can you please again list the condition jt->is_JfrRecorder_thread() ? Sorry, I forgot we had removed it from being considered excluded on the JfrThreadLocal level. Thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2122045043 From dholmes at openjdk.org Mon Jun 2 21:56:02 2025 From: dholmes at openjdk.org (David Holmes) Date: Mon, 2 Jun 2025 21:56:02 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 18:37:14 GMT, Aleksey Shipilev wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix bug related to async stack walking > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 117: > >> 115: >> 116: bool JfrCPUTimeTraceQueue::is_empty() const { >> 117: return Atomic::load(&_head) == 0; > > Not entirely clear what is the memory semantics for accessing `_head`. Does it need to be acq/rel? If so, this one should be `::load_acquire`? Many of the accesses to head do not appear to synchronize with anything and so do not need acquire semantics. But the overall concurrency properties of this code are very unclear to me. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2122228261 From cjplummer at openjdk.org Mon Jun 2 22:07:52 2025 From: cjplummer at openjdk.org (Chris Plummer) Date: Mon, 2 Jun 2025 22:07:52 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: <-rIQHptI3h_uZTew6KYZLXC--aq6_Sxoe5wg1Xe7xq8=.f41290f7-7c61-4849-80d6-e65cf47d8733@github.com> On Mon, 2 Jun 2025 18:39:33 GMT, Volkan Yazici wrote: >> Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`. >> >> `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357993 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to Hotspot. > > Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: > > Provide fallback for `stdin.encoding` Changes look good. Can you clarify your testing? ------------- Marked as reviewed by cjplummer (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25542#pullrequestreview-2890065248 From dholmes at openjdk.org Tue Jun 3 00:16:03 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 3 Jun 2025 00:16:03 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v26] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 09:24:53 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 119: >> >>> 117: _data = new_data; >>> 118: _capacity = capacity; >>> 119: } >> >> I assume there is a lock protecting this so it happens atomically? > > This happens before the signal handler is attached to thread. So it does happen before any parallelism is introduced on thread creation. I'm missing the big picture here unfortunately. This looks like it can get called repeatedly as needed to change capacity. Are you saying it only gets called once before we create the sampler thread? Is the concurrency model described somewhere? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2122365626 From dholmes at openjdk.org Tue Jun 3 00:28:05 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 3 Jun 2025 00:28:05 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: <_Q0iW6TuzM0P1qeE2XsMZbTx3lfCgW9QDEsf3-FlRYE=.b6707a06-3d91-4764-a8d8-7eaa76680584@github.com> On Mon, 2 Jun 2025 21:53:38 GMT, David Holmes wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 117: >> >>> 115: >>> 116: bool JfrCPUTimeTraceQueue::is_empty() const { >>> 117: return Atomic::load(&_head) == 0; >> >> Not entirely clear what is the memory semantics for accessing `_head`. Does it need to be acq/rel? If so, this one should be `::load_acquire`? > > Many of the accesses to head do not appear to synchronize with anything and so do not need acquire semantics. But the overall concurrency properties of this code are very unclear to me. To be clear, you only need acquire semantics here if after seeing the value 0 you need to access fields that were written before `_head` was set to 0. Similarly for most of the other access to `_head`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2122374152 From jbechberger at openjdk.org Tue Jun 3 06:58:03 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 06:58:03 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 13:50:49 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix bug related to async stack walking Regarding https://github.com/openjdk/jdk/pull/25302#discussion_r2119984783 raw_thread == nullptr This seems to happen rarely on (abrupt) shutdowns. I attached an hs_err file: [hs_err_pid1688961.log](https://github.com/user-attachments/files/20563594/hs_err_pid1688961.log) ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2933774229 From jbechberger at openjdk.org Tue Jun 3 07:05:47 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 07:05:47 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v30] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - Check for raw_thread == nullptr - Move async stackwalking to JFR ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/09ca4fed..bef52132 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=29 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=28-29 Stats: 89 lines in 3 files changed: 37 ins; 49 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Tue Jun 3 07:12:46 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 07:12:46 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v31] In-Reply-To: References: Message-ID: <_4vRA_P9_dLG022vs8ZinaZmqC48drRAwdOSiDG9Wjk=.25880197-6c87-4faf-8259-12d6c0f10f2e@github.com> > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with three additional commits since the last revision: - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp Co-authored-by: Aleksey Shipil?v - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp Co-authored-by: Aleksey Shipil?v - Small fixes ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/bef52132..c3dedefb Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=30 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=29-30 Stats: 17 lines in 4 files changed: 2 ins; 5 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Tue Jun 3 07:17:09 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 07:17:09 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 20:02:15 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix bug related to async stack walking > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 49: > >> 47: >> 48: static bool is_excluded(JavaThread* thread) { >> 49: return thread->is_hidden_from_external_view() || thread->jfr_thread_local()->is_excluded(); > > I think I misled you saying that JfrRecorder_thread would be excluded by the above expression. That was true - but not anymore. > > Our exclusion test looks like: > > static inline bool is_excluded(JavaThread* jt) { > assert(jt != nullptr, "invariant"); > return jt->is_Compiler_thread() || jt->is_hidden_from_external_view() || jt->is_JfrRecorder_thread() || jt->jfr_thread_local()->is_excluded(); > } > > I like you could fold jt->is_Compiler_thread() into jt->is_hidden_from_external_view() - good!. > > But can you please again list the condition jt->is_JfrRecorder_thread()? Sorry, I forgot we had removed it from being considered excluded on a per JfrThreadLocal level. Thanks. No problem. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2122934873 From dholmes at openjdk.org Tue Jun 3 07:39:02 2025 From: dholmes at openjdk.org (David Holmes) Date: Tue, 3 Jun 2025 07:39:02 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v31] In-Reply-To: <_4vRA_P9_dLG022vs8ZinaZmqC48drRAwdOSiDG9Wjk=.25880197-6c87-4faf-8259-12d6c0f10f2e@github.com> References: <_4vRA_P9_dLG022vs8ZinaZmqC48drRAwdOSiDG9Wjk=.25880197-6c87-4faf-8259-12d6c0f10f2e@github.com> Message-ID: On Tue, 3 Jun 2025 07:12:46 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with three additional commits since the last revision: > > - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp > > Co-authored-by: Aleksey Shipil?v > - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp > > Co-authored-by: Aleksey Shipil?v > - Small fixes > Regarding [#25302 (comment)](https://github.com/openjdk/jdk/pull/25302#discussion_r2119984783) > > ``` > raw_thread == nullptr > ``` > > This seems to happen rarely on (abrupt) shutdowns. I attached an hs_err file: [hs_err_pid1688961.log](https://github.com/user-attachments/files/20563594/hs_err_pid1688961.log) That is interesting. The signal appears to be being handled on an unattached thread during shutdown, and there is no stack left to show any VM involvement. Possibly we need to block the signal as part of thread termination, before we clear the current thread. ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2933916367 From jbechberger at openjdk.org Tue Jun 3 07:44:33 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 07:44:33 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v32] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - Remove includes and other lines - Fix is_excluded ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/c3dedefb..ab47f680 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=31 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=30-31 Stats: 25 lines in 17 files changed: 4 ins; 5 del; 16 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Tue Jun 3 07:44:34 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 07:44:34 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v31] In-Reply-To: <_4vRA_P9_dLG022vs8ZinaZmqC48drRAwdOSiDG9Wjk=.25880197-6c87-4faf-8259-12d6c0f10f2e@github.com> References: <_4vRA_P9_dLG022vs8ZinaZmqC48drRAwdOSiDG9Wjk=.25880197-6c87-4faf-8259-12d6c0f10f2e@github.com> Message-ID: On Tue, 3 Jun 2025 07:12:46 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with three additional commits since the last revision: > > - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp > > Co-authored-by: Aleksey Shipil?v > - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp > > Co-authored-by: Aleksey Shipil?v > - Small fixes We already do: void JfrCPUTimeThreadSampler::on_javathread_terminate(JavaThread* thread) { JfrThreadLocal* tl = thread->jfr_thread_local(); assert(tl != nullptr, "invariant"); timer_t* timer = tl->cpu_timer(); if (timer == nullptr) { return; // no timer was created for this thread } timer_delete(*timer); ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2933945034 From shade at openjdk.org Tue Jun 3 08:32:58 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Tue, 3 Jun 2025 08:32:58 GMT Subject: Integrated: 8358318: JFR: Tighten up PlatformTracer initialization In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 11:19:52 GMT, Aleksey Shipilev wrote: > Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need. > > Additional testing: > - [x] Linux x86_64 server fastdebug, `jdk_jfr` This pull request has now been integrated. Changeset: 8674f491 Author: Aleksey Shipilev URL: https://git.openjdk.org/jdk/commit/8674f49127d75d20c074fb8c4f0736bfe190f8b8 Stats: 18 lines in 2 files changed: 12 ins; 5 del; 1 mod 8358318: JFR: Tighten up PlatformTracer initialization Reviewed-by: egahlin ------------- PR: https://git.openjdk.org/jdk/pull/25584 From shade at openjdk.org Tue Jun 3 08:32:57 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Tue, 3 Jun 2025 08:32:57 GMT Subject: RFR: 8358318: JFR: Tighten up PlatformTracer initialization [v2] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 17:28:32 GMT, Aleksey Shipilev wrote: >> Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need. >> >> Additional testing: >> - [x] Linux x86_64 server fastdebug, `jdk_jfr` > > Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: > > - Unsynchronized fix > - Merge branch 'master' into JDK-8358318-jfr-platform-tracer-init > - Fix Thanks for review, here goes. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25584#issuecomment-2934117050 From jbechberger at openjdk.org Tue Jun 3 08:42:56 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 08:42:56 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v33] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Fix non Linux builds ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/ab47f680..ef9f9cd1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=32 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=31-32 Stats: 4 lines in 1 file changed: 2 ins; 2 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From vyazici at openjdk.org Tue Jun 3 09:26:05 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Tue, 3 Jun 2025 09:26:05 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: <-rIQHptI3h_uZTew6KYZLXC--aq6_Sxoe5wg1Xe7xq8=.f41290f7-7c61-4849-80d6-e65cf47d8733@github.com> References: <-rIQHptI3h_uZTew6KYZLXC--aq6_Sxoe5wg1Xe7xq8=.f41290f7-7c61-4849-80d6-e65cf47d8733@github.com> Message-ID: On Mon, 2 Jun 2025 22:04:56 GMT, Chris Plummer wrote: > Can you clarify your testing? @plummercj, green `tier1,2` results on 45bdc4fdaa1 are attached to the ticket. Would they suffice? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2934323998 From mgronlun at openjdk.org Tue Jun 3 09:47:09 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 09:47:09 GMT Subject: RFR: 8358429: JFR: minimize the time the Threads_lock is held for sampling Message-ID: Greetings, Before [JDK-8352251](https://bugs.openjdk.org/browse/JDK-8352251), the JFR Sampler Thread held onto the Threads_lock during the entire sampling period when iterating threads. This was for two purposes: 1. Having a non-Java thread sampler thread race through an ongoing safepoint, touching oops is generally not supported by most GCs. 2. Since the sampler thread is a non-Java thread, and a JavaThread to be sampled can be in thread state _thread_in_native, it means both threads are outside the safepoint protocol. JFR evolves its global epoch during a safepoint. With [JDK-8352251](https://bugs.openjdk.org/browse/JDK-8352251), things have improved much. The sampling parts performed by the non-Java sampler thread do not touch any oops for threads sampled in state _thread_in_Java. For sampling threads in native, the original issue persists (the sampler thread needs to capture the stack trace in the correct JFR epoch, and will also, in the case of virtual threads, need to touch oops). However, we can significantly reduce the time the Threads_lock is held for sampling. Testing: jdk_jfr, stress testing Thanks Markus ------------- Commit messages: - whitespace - description - 8358429 Changes: https://git.openjdk.org/jdk/pull/25602/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25602&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8358429 Stats: 165 lines in 4 files changed: 102 ins; 19 del; 44 mod Patch: https://git.openjdk.org/jdk/pull/25602.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25602/head:pull/25602 PR: https://git.openjdk.org/jdk/pull/25602 From erik.gahlin at oracle.com Tue Jun 3 09:50:17 2025 From: erik.gahlin at oracle.com (Erik Gahlin) Date: Tue, 3 Jun 2025 09:50:17 +0000 Subject: JFR: Scrubbing sensitive information from events In-Reply-To: References: Message-ID: We have discussed it, but we don't understand all the details. We are also unsure how to best expose it to the end user. Let's say there was a command line option -XX:FlightRecorder:scrub-file=. What would you fill that file with? I want examples that work on real data to understand how expressive the filters must be. Thanks Erik ________________________________ From: hotspot-jfr-dev on behalf of Erwan Viollet Sent: Monday, June 2, 2025 3:30 PM To: hotspot-jfr-dev at openjdk.org Subject: JFR: Scrubbing sensitive information from events Hello, I am currently looking into how to remove sensitive information from JFR events. The main events that typically contain sensitive information: jdk.SystemProcess, jdk.InitialSystemProperty, jdk.JVMInformation. Passwords from command lines can typically be found in these events. Dropping these events altogether is not ideal, as we need them to make relevant performance recommendations to users (e.g. suggesting JVM or system setting adjustments). Dropping them or scrubbing them on the backend side (after the fact) requires decompressing and re-writing these events, which is wasteful in terms of both compute and storage. The approach is not perfect, as we still end up intaking and temporarily storing sensitive information. Ideally, we would like to be able to scrub or redact only the sensitive fields within these events (for example, using a simple regex or pattern-based rule), rather than dropping the whole event. We also want to avoid handling this only after the event has already been written to the JFR file, as that does not fully mitigate the risk of exposing sensitive data. At present, it appears there is no public API or supported mechanism to intercept or scrub JFR events in-process, before they are persisted. What would you think of an API accepting custom scrubbing patterns so that sensitive data never leaves the JVM in an unredacted state? Are there any plans or discussions in this area? I am fairly new to the JFR world, so it is likely that I missed previous discussions around this. Thank you, Best regards, Erwan Viollet, Profiling team, Datadog -------------- next part -------------- An HTML attachment was scrubbed... URL: From shade at openjdk.org Tue Jun 3 10:33:52 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Tue, 3 Jun 2025 10:33:52 GMT Subject: RFR: 8356968: JFR: Compilation event should be enabled for all compilations by default In-Reply-To: References: Message-ID: On Thu, 15 May 2025 08:49:47 GMT, Aleksey Shipilev wrote: > In the field, we are using -XX:+PrintCompilation to track compiler performance. Alternatively, -Xlog:jit* prints the same. JFR has a the related jdk.Compilation event that gives us even richer diagnostics. Yet, that event is set at a very high threshold (1000ms), which skips almost all compilations! This threshold is set to such a high value from the beginning. > > It is fairly normal to have lots of compilations in 100+ ms range individually, and their sum impact is what we are after. Also, the compilations are normally quite rare, and there are a couple of thousands of compiles in most workloads, and they only happen sporadically. This means, the event count without any threshold is not high. > > Therefore, it would be convenient to make sure that basic Compilation event is enabled unconditionally, e.g. by dropping the default threshold to 0. > > See more logs in the bug itself. > > Additional testing: > - [x] Ad-hoc tests with printing compilation events > - [x] Linux x86_64 server fastdebug, `jdk_jfr` I think @iwanowww had an opinion on this :) ------------- PR Comment: https://git.openjdk.org/jdk/pull/25247#issuecomment-2934586864 From nbenalla at openjdk.org Tue Jun 3 11:16:03 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Tue, 3 Jun 2025 11:16:03 GMT Subject: RFR: 8346886: Add since checker test to jdk.management.jfr Message-ID: Please review this patch to add a new test to check `@since` tags in the `jdk.management.jfr` module. TIA ------------- Commit messages: - add new `@since` test Changes: https://git.openjdk.org/jdk/pull/25612/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25612&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8346886 Stats: 30 lines in 1 file changed: 30 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25612.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25612/head:pull/25612 PR: https://git.openjdk.org/jdk/pull/25612 From jbechberger at openjdk.org Tue Jun 3 11:32:18 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 11:32:18 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v31] In-Reply-To: References: <_4vRA_P9_dLG022vs8ZinaZmqC48drRAwdOSiDG9Wjk=.25880197-6c87-4faf-8259-12d6c0f10f2e@github.com> Message-ID: On Tue, 3 Jun 2025 07:36:06 GMT, David Holmes wrote: >> Johannes Bechberger has updated the pull request incrementally with three additional commits since the last revision: >> >> - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp >> >> Co-authored-by: Aleksey Shipil?v >> - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp >> >> Co-authored-by: Aleksey Shipil?v >> - Small fixes > >> Regarding [#25302 (comment)](https://github.com/openjdk/jdk/pull/25302#discussion_r2119984783) >> >> ``` >> raw_thread == nullptr >> ``` >> >> This seems to happen rarely on (abrupt) shutdowns. I attached an hs_err file: [hs_err_pid1688961.log](https://github.com/user-attachments/files/20563594/hs_err_pid1688961.log) > > That is interesting. The signal appears to be being handled on an unattached thread during shutdown, and there is no stack left to show any VM involvement. Possibly we need to block the signal as part of thread termination, before we clear the current thread. ? Regarding the acquire-release-semantics (cc @dholmes-ora): I currently use it, because it works and is fast enough. Using a weaker semantics is a good optimization, but I would abstain it for new due to time constraints. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2934793239 From jbechberger at openjdk.org Tue Jun 3 11:42:27 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 11:42:27 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v34] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - Use store-release semantics - Log error when timer_create fails ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/ef9f9cd1..93b5a189 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=33 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=32-33 Stats: 10 lines in 3 files changed: 1 ins; 1 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Tue Jun 3 12:12:53 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 12:12:53 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v35] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - Fix include order - Tiny refactoring ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/93b5a189..71611f1e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=34 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=33-34 Stats: 19 lines in 4 files changed: 8 ins; 10 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From egahlin at openjdk.org Tue Jun 3 12:19:04 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Tue, 3 Jun 2025 12:19:04 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v10] In-Reply-To: References: Message-ID: <8ESOaNI_qHLzLquiZT7RZR43lit-o8_5rTky1nJFjH4=.a81b8882-1470-4f76-8c9a-cdc2a7b50070@github.com> On Mon, 26 May 2025 15:42:57 GMT, Erik Gahlin wrote: >>> This is added automatically. If I add "(Experimental)" to the title, then I get "X (Experimental) (Experimental)" >> >> Sweet. >> >>> I'm unsure how to implement this using the SQL version that is used for the views >> >> I will see if I can create an example with some other events that show the syntax, and then you can fill in the CPU-Time events. > >> I will see if I can create an example with some other events that show the syntax, and then you can fill in the CPU-Time events. > > I have a Mac, so I could not try it with an actual recording, but something like this: > > [application.cpu-time-statistics] > label = "CPU Time Samples Statistics" > form = "COLUMN 'Successful Samples', 'Failed Samples', 'Total Samples', 'Lost Samples' > SELECT COUNT(S.startTime), COUNT(F.startTime), Count(A.startTime), SUM(L.lostSamples) > FROM > CPUTimeSample AS S, > CPUTimeSample AS F, > CPUTimeSample AS A, > CPUTimeSampleLoss AS L > WHERE > S.failed = 'false' AND > F.failed = 'true'" > > > I removed biased, because I wonder If we should have such a field? There can be many types of biases, and the implementation may change in the future. > Hold on, shouldn't this really be "Lost"? @egahlin and @mgronlun need to chime in here. Lost might be better. I wonder if `` is needed, instead of thread = true? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2934959447 From jbechberger at openjdk.org Tue Jun 3 12:19:05 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 12:19:05 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v10] In-Reply-To: <8ESOaNI_qHLzLquiZT7RZR43lit-o8_5rTky1nJFjH4=.a81b8882-1470-4f76-8c9a-cdc2a7b50070@github.com> References: <8ESOaNI_qHLzLquiZT7RZR43lit-o8_5rTky1nJFjH4=.a81b8882-1470-4f76-8c9a-cdc2a7b50070@github.com> Message-ID: <1JqKzjCGoZ9N_ez_gMKOlR1lbWPte0LkQS3bSb81ua0=.3c4c006b-18c0-4444-a867-8c774899b5b9@github.com> On Tue, 3 Jun 2025 12:15:06 GMT, Erik Gahlin wrote: > I wonder if is needed, instead of thread = true? We had these discussions before on the old PR and then decided to end up with eventThread (as the other events do to), ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2934963523 From mgronlun at openjdk.org Tue Jun 3 12:19:06 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 12:19:06 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v35] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 12:12:53 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Fix include order > - Tiny refactoring src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 67: > 65: } > 66: > 67: if (is_excluded(jt)) { I think move this before the jt->is_exiting() check - excluded is much much more common than exiting... ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2123633391 From mgronlun at openjdk.org Tue Jun 3 12:25:05 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 12:25:05 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v35] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 12:12:53 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Fix include order > - Tiny refactoring src/hotspot/share/jfr/support/jfrThreadLocal.hpp line 371: > 369: timer_t* cpu_timer() const; > 370: > 371: // The CPU time JFR lock has four different states: Only three different states now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2123651646 From jbechberger at openjdk.org Tue Jun 3 12:29:48 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 12:29:48 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v36] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - CPUTimeSampleLoss -> CPUTimeSamplesLost - Move is_excluded forward ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/71611f1e..a419daba Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=35 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=34-35 Stats: 13 lines in 7 files changed: 0 ins; 1 del; 12 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Tue Jun 3 12:35:54 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 12:35:54 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v37] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Fix tiny mistake ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/a419daba..44c37d17 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=36 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=35-36 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Tue Jun 3 12:35:55 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 12:35:55 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v35] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 12:12:53 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Fix include order > - Tiny refactoring src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 235: > 233: > 234: void JfrCPUTimeThreadSampler::on_javathread_create(JavaThread* thread) { > 235: if (thread->is_Compiler_thread()) { is_hidden_from_external_view() + is_JfrRecorderThread() instead? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2123668189 From jbechberger at openjdk.org Tue Jun 3 12:39:47 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 12:39:47 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v38] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Restrict threads for which timers are created ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/44c37d17..83b55f58 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=37 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=36-37 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Tue Jun 3 12:39:49 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 12:39:49 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v35] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 12:29:39 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: >> >> - Fix include order >> - Tiny refactoring > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 235: > >> 233: >> 234: void JfrCPUTimeThreadSampler::on_javathread_create(JavaThread* thread) { >> 235: if (thread->is_Compiler_thread()) { > > is_hidden_from_external_view() + is_JfrRecorderThread() instead? tl->is_excluded() is volatile and can change during runtime, so it's better to add a timer unconditionally there. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2123669984 From jbechberger at openjdk.org Tue Jun 3 12:39:49 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 12:39:49 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v35] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 12:30:18 GMT, Markus Gr?nlund wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 235: >> >>> 233: >>> 234: void JfrCPUTimeThreadSampler::on_javathread_create(JavaThread* thread) { >>> 235: if (thread->is_Compiler_thread()) { >> >> is_hidden_from_external_view() + is_JfrRecorderThread() instead? > > tl->is_excluded() is volatile and can change during runtime, so it's better to add a timer unconditionally there. why not just `is_excluded`? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2123673323 From mgronlun at openjdk.org Tue Jun 3 12:44:09 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 12:44:09 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v38] In-Reply-To: References: Message-ID: <23UojxlSZeRcCB38B1d2hDIcyXbgRnmbi8Vu3cfUmM4=.ba379d71-7bc7-4721-bda0-6d5f469a45f7@github.com> On Tue, 3 Jun 2025 12:39:47 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Restrict threads for which timers are created src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 63: > 61: assert(raw_thread->is_Java_thread(), "invariant"); > 62: JavaThread* jt = JavaThread::cast(raw_thread); > 63: if (is_excluded(jt)) { and now: if (is_excluded(jt) || jt->is_exiting()) { return nullptr; } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2123692657 From jbechberger at openjdk.org Tue Jun 3 12:47:48 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 12:47:48 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v39] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Tiny refactoring ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/83b55f58..2b8c6db4 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=38 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=37-38 Stats: 4 lines in 1 file changed: 0 ins; 3 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From egahlin at openjdk.org Tue Jun 3 12:50:49 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Tue, 3 Jun 2025 12:50:49 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: References: Message-ID: > Could I have review of an enhancement that adds rate-limited sampling to Java event, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: Fix adjust boundary ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25559/files - new: https://git.openjdk.org/jdk/pull/25559/files/d0097506..7fa2db19 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=01-02 Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/25559.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25559/head:pull/25559 PR: https://git.openjdk.org/jdk/pull/25559 From mgronlun at openjdk.org Tue Jun 3 12:51:13 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 12:51:13 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v38] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 12:39:47 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Restrict threads for which timers are created src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 327: > 325: JfrThreadLocal* tl = jt->jfr_thread_local(); > 326: if (tl->wants_async_processing_of_cpu_time_jfr_requests()) { > 327: if (!jt->has_last_Java_frame() || jt->thread_state() != _thread_in_native || !tl->try_acquire_cpu_time_jfr_dequeue_lock()) { I recommend this order for higher probability: 1. jt->thread_state() != _thread_in_native 2. !tl->try_acquire_cpu_time_jfr_dequeue_lock() 3. !jt->has_last_Java_frame() You need to restructure of course, to get the unlocking correct. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2123711980 From jbechberger at openjdk.org Tue Jun 3 13:00:06 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 13:00:06 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v40] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Reorder condition ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/2b8c6db4..56ce2b05 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=39 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=38-39 Stats: 6 lines in 1 file changed: 4 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Tue Jun 3 13:00:06 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 13:00:06 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v38] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 12:39:47 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Restrict threads for which timers are created src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 479: > 477: > 478: // Entry point for a thread that has been sampled in native code and has a pending JFR CPU time request. > 479: void JfrThreadSampling::process_cpu_time_request(JavaThread* jt, JfrThreadLocal* tl, Thread* current, bool lock) { Can you move this up to be co-located with "drain_enqueued_cpu_time_requests"? Thanks. src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.hpp line 40: > 38: public: > 39: static void process_sample_request(JavaThread* jt, bool has_cpu_time_sample_request); > 40: static void process_cpu_time_request(JavaThread* jt, JfrThreadLocal* tl, Thread* current, bool lock); Put this under private and add JfrCPUTimeThreadSampler as a friend (like above with JfrSamplerThread and "process_native_sample_requests" ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2123728400 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2123726144 From jbechberger at openjdk.org Tue Jun 3 13:33:29 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 13:33:29 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v41] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Make process_cpu_time_request private and move up ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/56ce2b05..7561d512 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=40 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=39-40 Stats: 17 lines in 2 files changed: 9 ins; 8 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Tue Jun 3 14:09:29 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Tue, 3 Jun 2025 14:09:29 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Rename autoadapt ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/7561d512..ae55610c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=41 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=40-41 Stats: 41 lines in 8 files changed: 0 ins; 0 del; 41 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Tue Jun 3 14:10:59 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 14:10:59 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: References: Message-ID: <8jbZNr-7dzvGRglSLxMcgr5WjmSrGRChJ8MQarUTkdo=.dc1c9dff-65da-4e75-a49c-9af112b26cc7@github.com> On Tue, 3 Jun 2025 12:50:49 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Fix adjust boundary Great stuff. We have now what amounts to a carbon-copy of the existing throttling implementation used in the JVM, mainly used by the jdk.ObjectAllocationSample event. (see hotspot/src/share/jfr/support/jfrAdaptiveSampler.cpp and hotspot/src/share/jfr/recorder/service/jfrEventThrottler.cpp). Smart work to write the Java implementation as a method-to-method comparison, which made it easier to review. Thanks Markus ------------- Marked as reviewed by mgronlun (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25559#pullrequestreview-2892579207 From egahlin at openjdk.org Tue Jun 3 14:36:07 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Tue, 3 Jun 2025 14:36:07 GMT Subject: RFR: 8358448: JFR: Incorrect time unit for MethodTiming event Message-ID: Could I have a review of a PR that fixes a regression introduced with [JDK-8047756](https://bugs.openjdk.org/projects/JDK/issues/JDK-8047756)? The default unit for `@Timespan` in Java is nanos, but it should be set to ticks. Prior to JDK-8047756, annotations were taken from native code, so ticks were used. Testing: 100 * test/jdk//jdk/jfr/event/tracing/TestMethodTimingEvent.java on Windows, Linux and MacOS test/jdk//jdk/jfr/* Thanks Erik ------------- Commit messages: - Initial Changes: https://git.openjdk.org/jdk/pull/25615/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25615&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8358448 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25615.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25615/head:pull/25615 PR: https://git.openjdk.org/jdk/pull/25615 From mgronlun at openjdk.org Tue Jun 3 14:49:51 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 14:49:51 GMT Subject: RFR: 8358448: JFR: Incorrect time unit for MethodTiming event In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 14:26:22 GMT, Erik Gahlin wrote: > Could I have a review of a PR that fixes a regression introduced with [JDK-8047756](https://bugs.openjdk.org/projects/JDK/issues/JDK-8047756)? > > The default unit for `@Timespan` in Java is nanos, but it should be set to ticks. Prior to JDK-8047756, annotations were taken from native code, so ticks were used. > > Testing: > 100 * test/jdk//jdk/jfr/event/tracing/TestMethodTimingEvent.java on Windows, Linux and MacOS > test/jdk//jdk/jfr/* > > Thanks > Erik Looks good. ------------- Marked as reviewed by mgronlun (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25615#pullrequestreview-2892825125 From ayang at openjdk.org Tue Jun 3 15:28:50 2025 From: ayang at openjdk.org (Albert Mingkun Yang) Date: Tue, 3 Jun 2025 15:28:50 GMT Subject: RFR: 8358448: JFR: Incorrect time unit for MethodTiming event In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 14:26:22 GMT, Erik Gahlin wrote: > Could I have a review of a PR that fixes a regression introduced with [JDK-8047756](https://bugs.openjdk.org/projects/JDK/issues/JDK-8047756)? > > The default unit for `@Timespan` in Java is nanos, but it should be set to ticks. Prior to JDK-8047756, annotations were taken from native code, so ticks were used. > > Testing: > 100 * test/jdk//jdk/jfr/event/tracing/TestMethodTimingEvent.java on Windows, Linux and MacOS > test/jdk//jdk/jfr/* > > Thanks > Erik Marked as reviewed by ayang (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25615#pullrequestreview-2893052614 From egahlin at openjdk.org Tue Jun 3 16:05:43 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Tue, 3 Jun 2025 16:05:43 GMT Subject: Integrated: 8358448: JFR: Incorrect time unit for MethodTiming event In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 14:26:22 GMT, Erik Gahlin wrote: > Could I have a review of a PR that fixes a regression introduced with [JDK-8047756](https://bugs.openjdk.org/projects/JDK/issues/JDK-8047756)? > > The default unit for `@Timespan` in Java is nanos, but it should be set to ticks. Prior to JDK-8047756, annotations were taken from native code, so ticks were used. > > Testing: > 100 * test/jdk//jdk/jfr/event/tracing/TestMethodTimingEvent.java on Windows, Linux and MacOS > test/jdk//jdk/jfr/* > > Thanks > Erik This pull request has now been integrated. Changeset: d7def20a Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/d7def20afa045a0bb154655b02e56346f7f51347 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod 8358448: JFR: Incorrect time unit for MethodTiming event Reviewed-by: mgronlun, ayang ------------- PR: https://git.openjdk.org/jdk/pull/25615 From mgronlun at openjdk.org Tue Jun 3 16:25:07 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 16:25:07 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v35] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 12:31:53 GMT, Johannes Bechberger wrote: >> tl->is_excluded() is volatile and can change during runtime, so it's better to add a timer unconditionally there. > > why not just `is_excluded`? because tl->is_excluded() can get included and excluded many times during runtime. Its not a static property. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2124366551 From cjplummer at openjdk.org Tue Jun 3 18:11:23 2025 From: cjplummer at openjdk.org (Chris Plummer) Date: Tue, 3 Jun 2025 18:11:23 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 18:39:33 GMT, Volkan Yazici wrote: >> Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`. >> >> `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357993 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to Hotspot. > > Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: > > Provide fallback for `stdin.encoding` > > Can you clarify your testing? > > @plummercj, green `tier1,2` results on [45bdc4f](https://github.com/openjdk/jdk/commit/45bdc4fdaa17d0e9579154578cb9e3917e62c5c5) are attached to the ticket. Would they suffice? That's not going to be sufficient. The nsk tests are not being run until tier5. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2936567479 From mgronlun at openjdk.org Tue Jun 3 18:16:24 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 18:16:24 GMT Subject: RFR: 8357671: JFR: Remove JfrTraceIdEpoch synchronizing Message-ID: <4FuUPlh3piGBRKq_6BggDdyQviABYNk66rTV97rYaTs=.227185d8-81a8-49eb-a7e8-e70ce6cbf2b0@github.com> Greetings, The JfrTraceIdEpoch::is_synchronizing() method and the field _synchronizing are remnants from the old days when we attempted to force CompilerThreads running in native mode into the correct epoch, which ultimately failed due to races. Removing all that old cruft. Also, reuse the existing epoch generation value for the string pool. Testing: jdk_jfr Thanks Markus ------------- Commit messages: - 8357671 Changes: https://git.openjdk.org/jdk/pull/25625/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25625&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8357671 Stats: 52 lines in 7 files changed: 1 ins; 29 del; 22 mod Patch: https://git.openjdk.org/jdk/pull/25625.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25625/head:pull/25625 PR: https://git.openjdk.org/jdk/pull/25625 From dcubed at openjdk.org Tue Jun 3 18:44:37 2025 From: dcubed at openjdk.org (Daniel D. Daugherty) Date: Tue, 3 Jun 2025 18:44:37 GMT Subject: Integrated: 8358539: ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java Message-ID: A trivial fix to ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java on all platforms. ------------- Commit messages: - 8358539: ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java Changes: https://git.openjdk.org/jdk/pull/25626/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25626&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8358539 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25626.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25626/head:pull/25626 PR: https://git.openjdk.org/jdk/pull/25626 From ayang at openjdk.org Tue Jun 3 18:44:37 2025 From: ayang at openjdk.org (Albert Mingkun Yang) Date: Tue, 3 Jun 2025 18:44:37 GMT Subject: Integrated: 8358539: ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 18:35:35 GMT, Daniel D. Daugherty wrote: > A trivial fix to ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java on all platforms. Marked as reviewed by ayang (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25626#pullrequestreview-2893678505 From bpb at openjdk.org Tue Jun 3 18:44:37 2025 From: bpb at openjdk.org (Brian Burkhalter) Date: Tue, 3 Jun 2025 18:44:37 GMT Subject: Integrated: 8358539: ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 18:35:35 GMT, Daniel D. Daugherty wrote: > A trivial fix to ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java on all platforms. Marked as reviewed by bpb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25626#pullrequestreview-2893679060 From dcubed at openjdk.org Tue Jun 3 18:44:37 2025 From: dcubed at openjdk.org (Daniel D. Daugherty) Date: Tue, 3 Jun 2025 18:44:37 GMT Subject: Integrated: 8358539: ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 18:39:29 GMT, Albert Mingkun Yang wrote: >> A trivial fix to ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java on all platforms. > > Marked as reviewed by ayang (Reviewer). @albertnetymk and @bplb - Thanks for the lightning fast reviews! ------------- PR Comment: https://git.openjdk.org/jdk/pull/25626#issuecomment-2936702783 From dcubed at openjdk.org Tue Jun 3 18:44:37 2025 From: dcubed at openjdk.org (Daniel D. Daugherty) Date: Tue, 3 Jun 2025 18:44:37 GMT Subject: Integrated: 8358539: ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 18:35:35 GMT, Daniel D. Daugherty wrote: > A trivial fix to ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java on all platforms. This pull request has now been integrated. Changeset: e984fa79 Author: Daniel D. Daugherty URL: https://git.openjdk.org/jdk/commit/e984fa7997dda922708edf556d1839b866e44e55 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod 8358539: ProblemList jdk/jfr/api/consumer/TestRecordingFileWrite.java Reviewed-by: ayang, bpb ------------- PR: https://git.openjdk.org/jdk/pull/25626 From egahlin at openjdk.org Tue Jun 3 20:41:15 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Tue, 3 Jun 2025 20:41:15 GMT Subject: RFR: 8358429: JFR: minimize the time the Threads_lock is held for sampling In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 23:17:33 GMT, Markus Gr?nlund wrote: > Greetings, > > Before [JDK-8352251](https://bugs.openjdk.org/browse/JDK-8352251), the JFR Sampler Thread held onto the Threads_lock during the entire sampling period when iterating threads. > > This was for two purposes: > > 1. Having a non-Java thread sampler thread race through an ongoing safepoint, touching oops is generally not supported by most GCs. > 2. Since the sampler thread is a non-Java thread, and a JavaThread to be sampled can be in thread state _thread_in_native, it means both threads are outside the safepoint protocol. JFR evolves its global epoch during a safepoint. > > With [JDK-8352251](https://bugs.openjdk.org/browse/JDK-8352251), things have improved much. The sampling parts performed by the non-Java sampler thread do not touch any oops for threads sampled in state _thread_in_Java. > For sampling threads in native, the original issue persists (the sampler thread needs to capture the stack trace in the correct JFR epoch, and will also, in the case of virtual threads, need to touch oops). > > However, we can significantly reduce the time the Threads_lock is held for sampling. > > Testing: jdk_jfr, stress testing > > Thanks > Markus Marked as reviewed by egahlin (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25602#pullrequestreview-2894053010 From mgronlun at openjdk.org Tue Jun 3 20:41:34 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 20:41:34 GMT Subject: RFR: 8357671: JFR: Remove JfrTraceIdEpoch synchronizing [v2] In-Reply-To: <4FuUPlh3piGBRKq_6BggDdyQviABYNk66rTV97rYaTs=.227185d8-81a8-49eb-a7e8-e70ce6cbf2b0@github.com> References: <4FuUPlh3piGBRKq_6BggDdyQviABYNk66rTV97rYaTs=.227185d8-81a8-49eb-a7e8-e70ce6cbf2b0@github.com> Message-ID: > Greetings, > > The JfrTraceIdEpoch::is_synchronizing() method and the field _synchronizing are remnants from the old days when we attempted to force CompilerThreads running in native mode into the correct epoch, which ultimately failed due to races. > > Removing all that old cruft. Also, reuse the existing epoch generation value for the string pool. > > Testing: jdk_jfr > > Thanks > Markus Markus Gr?nlund has updated the pull request incrementally with one additional commit since the last revision: extended comment ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25625/files - new: https://git.openjdk.org/jdk/pull/25625/files/990275ad..f66b90ee Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25625&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25625&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25625.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25625/head:pull/25625 PR: https://git.openjdk.org/jdk/pull/25625 From egahlin at openjdk.org Tue Jun 3 20:51:20 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Tue, 3 Jun 2025 20:51:20 GMT Subject: RFR: 8357671: JFR: Remove JfrTraceIdEpoch synchronizing [v2] In-Reply-To: References: <4FuUPlh3piGBRKq_6BggDdyQviABYNk66rTV97rYaTs=.227185d8-81a8-49eb-a7e8-e70ce6cbf2b0@github.com> Message-ID: On Tue, 3 Jun 2025 20:41:34 GMT, Markus Gr?nlund wrote: >> Greetings, >> >> The JfrTraceIdEpoch::is_synchronizing() method and the field _synchronizing are remnants from the old days when we attempted to force CompilerThreads running in native mode into the correct epoch, which ultimately failed due to races. >> >> Removing all that old cruft. Also, reuse the existing epoch generation value for the string pool. >> >> Testing: jdk_jfr >> >> Thanks >> Markus > > Markus Gr?nlund has updated the pull request incrementally with one additional commit since the last revision: > > extended comment Marked as reviewed by egahlin (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25625#pullrequestreview-2894076015 From mgronlun at openjdk.org Tue Jun 3 21:00:36 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 21:00:36 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 14:09:29 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Rename autoadapt src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.hpp line 31: > 29: > 30: class JavaThread; > 31: class NonJavaThread; NonJavaThread fwd not needed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2124913821 From mgronlun at openjdk.org Tue Jun 3 21:11:32 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 21:11:32 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 14:09:29 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Rename autoadapt src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 79: > 77: > 78: bool JfrCPUTimeTraceQueue::enqueue(JfrCPUTimeSampleRequest& request) { > 79: assert(JavaThread::current()->jfr_thread_local()->is_cpu_time_jfr_enqueue_locked(), "invariant"); What is preventing another thread from enqueuing a request here? We only know it holds a thread-local lock? Let's make it explicit at this site that the current queue corresponds to the thread-local queue for the current thread. + assert(&JavaThread::current()->jfr_thread_local()->cpu_time_jfr_queue() == this, "invariant"); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2124934207 From mgronlun at openjdk.org Tue Jun 3 21:18:34 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 21:18:34 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 14:09:29 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Rename autoadapt src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 96: > 94: } > 95: > 96: volatile u4 _lost_samples_sum = 0; static volatile ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2124941941 From mgronlun at openjdk.org Tue Jun 3 21:45:29 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 21:45:29 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: Message-ID: <1RLKF0E-I7CjQRNUqb7k0mEIvoSCO010FUaKnmLVPSI=.4c6876fb-ac9c-47d2-8379-ccafdbdbaabe@github.com> On Tue, 3 Jun 2025 14:09:29 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Rename autoadapt src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 520: > 518: // the sampling period might be too low for the current Linux configuration > 519: // so samples might be skipped and we have to compute the actual period > 520: int64_t period = get_sampling_period() * (info->si_overrun + 1); Does this calculation have to be done on every signal, by every thread? It seems like something that could be precalculated when the period is set? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2124980054 From mgronlun at openjdk.org Tue Jun 3 22:01:34 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 22:01:34 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 14:09:29 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Rename autoadapt src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 360: > 358: tl->set_do_async_processing_of_cpu_time_jfr_requests(false); > 359: if (lock) { > 360: tl->acquire_cpu_time_jfr_dequeue_lock(); This is your synchronization point on return from native code, which is effectively a spinlock. This can cause problems when a large number of threads are being processed by the "do_async_processing" request call. We should fix this as a bug after integration (use a proper Monitor as a synchronization point). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2124997140 From mgronlun at openjdk.org Tue Jun 3 22:04:27 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 3 Jun 2025 22:04:27 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 14:09:29 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Rename autoadapt src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 143: > 141: JavaThread *const jt = JavaThread::cast(t); > 142: send_java_thread_start_event(jt); > 143: JfrCPUTimeThreadSampling::on_javathread_create(jt); Move before send_java_thread...to have that captured by the timer? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125004892 From apangin at openjdk.org Wed Jun 4 03:15:36 2025 From: apangin at openjdk.org (Andrei Pangin) Date: Wed, 4 Jun 2025 03:15:36 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: Message-ID: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> On Tue, 3 Jun 2025 14:09:29 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Rename autoadapt src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 51: > 49: static bool is_excluded(JavaThread* jt) { > 50: return jt->is_hidden_from_external_view() || > 51: jt->jfr_thread_local()->is_excluded() || These restrictions cause a large blind spot in observability. There is no technical limitation for recording cpu samples for internal threads too, even without a Java stack trace. Consider removing this restriction, although not in this PR. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 135: > 133: while ((new_lost_samples = Atomic::cmpxchg(&_lost_samples, lost_samples, 0)) != lost_samples) { > 134: lost_samples = new_lost_samples; > 135: } Why not `Atomic::xchg`? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 161: > 159: return 0; > 160: } > 161: return os::active_processor_count() * 1000000000.0 / rate; If sampling period is configured as an absolute number in milliseconds, this value must be passed as is. Double conversion via `Runtime.availableProcessors()` / `active_processor_count()` is unobvious and error-prone. First, because of asymmetry: e.g. `Runtime.availableProcessors()` may be redefined by an agent so that its value is not aligned with `active_processor_count()`. Second, because number of available processors may change at runtime, e.g., by adjusting cgroup quotas. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 198: > 196: virtual void post_run(); > 197: public: > 198: virtual const char* name() const { return "JFR CPU Time Thread Sampler"; } Thread name is too long and does not sound right. Logically, it is not "Thread Sampler", but rather "Sampler Thread", which also aligns with the existing "JFR Sampler Thread". But I'd simplify it to `JFR CPU Time Sampler` or maybe `JFR CPU Sampler Thread`. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 202: > 200: void run(); > 201: void on_javathread_create(JavaThread* thread); > 202: bool create_timer_for_thread(JavaThread* thread, timer_t &timerid); Should it be `private`? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 252: > 250: timer_delete(*timer); > 251: tl->unset_cpu_timer(); > 252: tl->deallocate_cpu_time_jfr_queue(); Either this line is not needed or there is a possible resource leak: if `create_timer_for_thread` fails, queue is allocated but not deallocated. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 281: > 279: stop_timer(); > 280: Atomic::store(&_stop_signals, true); > 281: while (Atomic::load_acquire(&_active_signal_handlers) > 0) { There can be a race when `handle_timer_signal` has already passed `_stop_signals` check but has not yet incremented `_active_signal_handlers`. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 308: > 306: > 307: if (Atomic::load_acquire(&_is_async_processing_of_cpu_time_jfr_requests_triggered)) { > 308: Atomic::release_store(&_is_async_processing_of_cpu_time_jfr_requests_triggered, false); acquire/release seem to be used for no good reason. Also, this could be a single `cmpxchg`. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 326: > 324: if (jt->thread_state() != _thread_in_native || !tl->try_acquire_cpu_time_jfr_dequeue_lock()) { > 325: tl->set_do_async_processing_of_cpu_time_jfr_requests(false); > 326: continue; // thread doesn't have a last Java frame or queue is already being processed This comment may sound confusing, since `has_last_Java_frame` is checked separately below. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 472: > 470: > 471: void handle_timer_signal(int signo, siginfo_t* info, void* context) { > 472: assert(_instance != nullptr, "invariant"); There can be an arbitrary delay in async signal delivery. It's unlikely, but not impossible for `_instance` to be deleted by the time signal handler is called. There should be a better way to synchronize with JFR shutdown. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 477: > 475: > 476: > 477: void JfrCPUTimeThreadSampling::handle_timer_signal(siginfo_t* info, void* context) { It may be a good idea to validate `info->si_code` in order to protect from things like `kill -SIGPROF` after profiling has stopped. For a similar reason, `_sampler->_stop_signals` should default to `true` whenever profiler is not running. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 509: > 507: JfrCPUTimeTraceQueue& queue = tl->cpu_time_jfr_queue(); > 508: if (!check_state(jt)) { > 509: queue.increment_lost_samples(); nit: wrong indent src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 576: > 574: } > 575: if (timer_create(clock, &sev, &t) < 0) { > 576: log_error(jfr)("Failed to register the signal handler for thread sampling: %s", os::strerror(os::get_last_error())); If an application has many threads and current RLIMIT_SIGPENDING is low, logs will be flooded with this error message. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 606: > 604: void JfrCPUTimeThreadSampler::init_timers() { > 605: // install sig handler for sig > 606: PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal); SIGPROF is also used by external profilers. Need to check if SIGPROF handler is already installed and warn user. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.hpp line 58: > 56: volatile u4 _head; > 57: > 58: volatile s4 _lost_samples; Why signed int? Can it be negative? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.hpp line 128: > 126: static void send_lost_event(const JfrTicks& time, traceid tid, s4 lost_samples); > 127: > 128: // Trigger sampling while a thread is not in a safepoint, from a seperate thread typo: separate src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 558: > 556: void JfrThreadLocal::set_cpu_timer(timer_t* timer) { > 557: if (_cpu_timer == nullptr) { > 558: _cpu_timer = JfrCHeapObj::new_array(1); `timer_t` is a primitive type, at most one machine word. Why extra indirection and allocation? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2124528320 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2124503100 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125157311 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125128723 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125130332 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125190998 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125203700 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125342289 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125249171 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125230422 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125241099 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125320255 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125411074 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125430231 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2124507884 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125333563 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125183931 From dholmes at openjdk.org Wed Jun 4 04:53:27 2025 From: dholmes at openjdk.org (David Holmes) Date: Wed, 4 Jun 2025 04:53:27 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v10] In-Reply-To: <1JqKzjCGoZ9N_ez_gMKOlR1lbWPte0LkQS3bSb81ua0=.3c4c006b-18c0-4444-a867-8c774899b5b9@github.com> References: <8ESOaNI_qHLzLquiZT7RZR43lit-o8_5rTky1nJFjH4=.a81b8882-1470-4f76-8c9a-cdc2a7b50070@github.com> <1JqKzjCGoZ9N_ez_gMKOlR1lbWPte0LkQS3bSb81ua0=.3c4c006b-18c0-4444-a867-8c774899b5b9@github.com> Message-ID: On Tue, 3 Jun 2025 12:16:32 GMT, Johannes Bechberger wrote: >>> Hold on, shouldn't this really be "Lost"? @egahlin and @mgronlun need to chime in here. >> >> Lost might be better. >> >> I wonder if `` is needed, instead of thread = true? > >> I wonder if is needed, instead of thread = true? > > We had these discussions before on the old PR and then decided to end up with eventThread (as the other events do to), @parttimenerd I would really like to see some kind of design description for this which explains what the threading model is, how the signals are used, and how all the pieces interact. Thanks ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2938512151 From jbechberger at openjdk.org Wed Jun 4 05:32:29 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 05:32:29 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: On Wed, 4 Jun 2025 00:13:07 GMT, Andrei Pangin wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Rename autoadapt > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 161: > >> 159: return 0; >> 160: } >> 161: return os::active_processor_count() * 1000000000.0 / rate; > > If sampling period is configured as an absolute number in milliseconds, this value must be passed as is. > Double conversion via `Runtime.availableProcessors()` / `active_processor_count()` is unobvious and error-prone. First, because of asymmetry: e.g. `Runtime.availableProcessors()` may be redefined by an agent so that its value is not aligned with `active_processor_count()`. Second, because number of available processors may change at runtime, e.g., by adjusting cgroup quotas. Is this something for a later PR? > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 281: > >> 279: stop_timer(); >> 280: Atomic::store(&_stop_signals, true); >> 281: while (Atomic::load_acquire(&_active_signal_handlers) > 0) { > > There can be a race when `handle_timer_signal` has already passed `_stop_signals` check but has not yet incremented `_active_signal_handlers`. Amy idea on how to fix it? > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 472: > >> 470: >> 471: void handle_timer_signal(int signo, siginfo_t* info, void* context) { >> 472: assert(_instance != nullptr, "invariant"); > > There can be an arbitrary delay in async signal delivery. > It's unlikely, but not impossible for `_instance` to be deleted by the time signal handler is called. There should be a better way to synchronize with JFR shutdown. Any ideas? Or is it something for a later PR? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125678084 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125680345 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125681876 From jbechberger at openjdk.org Wed Jun 4 06:02:32 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 06:02:32 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v10] In-Reply-To: References: <8ESOaNI_qHLzLquiZT7RZR43lit-o8_5rTky1nJFjH4=.a81b8882-1470-4f76-8c9a-cdc2a7b50070@github.com> <1JqKzjCGoZ9N_ez_gMKOlR1lbWPte0LkQS3bSb81ua0=.3c4c006b-18c0-4444-a867-8c774899b5b9@github.com> Message-ID: <81dLp_39MhU-TuDD3EDt7iTX8HyEDZfj6nvCPwE5Ol4=.7d564cda-b7ae-4623-9705-704770b2b118@github.com> On Wed, 4 Jun 2025 04:50:56 GMT, David Holmes wrote: >>> I wonder if is needed, instead of thread = true? >> >> We had these discussions before on the old PR and then decided to end up with eventThread (as the other events do to), > > @parttimenerd I would really like to see some kind of design description for this which explains what the threading model is, how the signals are used, and how all the pieces interact. Thanks @dholmes-ora I attempt a first version here: The design consists of four main parts: - setup code: This sets up the signal handlers for every new thread and deletes them afterwards - the per-thread signal handlers: They check first that the current thread is valid, increment that they are currently active and check that they shouldn't stop (because the profiler is disabled). Now they acquire the thread-local enqueue lock for the current thread's request queue and push the sampling requests in (see https://openjdk.org/jeps/518 + the current period). It triggers/arms a safepoint. If the current thread is in native, they trigger (set a flag) the asynchronous stackwalking. This prevents long native periods of overflowing the request queue. Finally, the enqueue lock is released. - the safepoint handler: In the safepoint handler, we check if the thread-local queue is not empty. If so, we acquire a dequeue lock and process all entries of the queue, thereby creating JFR events. We also untrigger the async-stack-walking request for the thread. We then release the lock. - the sampler thread: Its task is to regularly update the timers if needed (configuration changes) and to walk the thread list to find any task that wants to be asynchronously stack-walked. For every of these threads, the dequeue lock is acquired (skipping if already set to enqueue) and the queue is processed as at the safepoint. Then the lock is released. On shutdown: Whenever the sampler is shut down, we first set the `_stop_signals` flag to prevent new signal handlers from entering the request creation code (and thereby accessing data structures that we already deallocated), we disable the timers for all threads and then wait till no signal handler is engaged anymore. It is important to note that there is only one thread-local lock used, but it has three states: - enqueue - dequeue - unlocked This prevents these phases from overlapping. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2938677600 From jbechberger at openjdk.org Wed Jun 4 06:10:30 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 06:10:30 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: <1RLKF0E-I7CjQRNUqb7k0mEIvoSCO010FUaKnmLVPSI=.4c6876fb-ac9c-47d2-8379-ccafdbdbaabe@github.com> References: <1RLKF0E-I7CjQRNUqb7k0mEIvoSCO010FUaKnmLVPSI=.4c6876fb-ac9c-47d2-8379-ccafdbdbaabe@github.com> Message-ID: On Tue, 3 Jun 2025 21:42:48 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Rename autoadapt > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 520: > >> 518: // the sampling period might be too low for the current Linux configuration >> 519: // so samples might be skipped and we have to compute the actual period >> 520: int64_t period = get_sampling_period() * (info->si_overrun + 1); > > Does this calculation have to be done on every signal, by every thread? It seems like something that could be precalculated when the period is set? This might change dynamically, so probably no. Only caching would work, but this is a small optimization for later. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125725230 From jbechberger at openjdk.org Wed Jun 4 06:34:29 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 06:34:29 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: On Wed, 4 Jun 2025 05:28:21 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 281: >> >>> 279: stop_timer(); >>> 280: Atomic::store(&_stop_signals, true); >>> 281: while (Atomic::load_acquire(&_active_signal_handlers) > 0) { >> >> There can be a race when `handle_timer_signal` has already passed `_stop_signals` check but has not yet incremented `_active_signal_handlers`. > > Amy idea on how to fix it? I added another _static_stop_signals field which should prevent this. >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 472: >> >>> 470: >>> 471: void handle_timer_signal(int signo, siginfo_t* info, void* context) { >>> 472: assert(_instance != nullptr, "invariant"); >> >> There can be an arbitrary delay in async signal delivery. >> It's unlikely, but not impossible for `_instance` to be deleted by the time signal handler is called. There should be a better way to synchronize with JFR shutdown. > > Any ideas? Or is it something for a later PR? I added another `_static_stop_signals` field which should prevent this. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125756115 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125755428 From jbechberger at openjdk.org Wed Jun 4 06:34:30 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 06:34:30 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: On Wed, 4 Jun 2025 00:28:46 GMT, Andrei Pangin wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Rename autoadapt > > src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 558: > >> 556: void JfrThreadLocal::set_cpu_timer(timer_t* timer) { >> 557: if (_cpu_timer == nullptr) { >> 558: _cpu_timer = JfrCHeapObj::new_array(1); > > `timer_t` is a primitive type, at most one machine word. Why extra indirection and allocation? @mgronlun wanted this indirection to move it abstract from implementation details ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125758074 From jbechberger at openjdk.org Wed Jun 4 07:00:51 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 07:00:51 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v43] In-Reply-To: References: Message-ID: <-BGoOClpsfsd4Q8Wq-H57L3tIvoaLGauYtRBEDPO-_w=.97e25e4f-879d-45f6-bd00-ad53e2463a8d@github.com> > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Improve ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/ae55610c..55c30aef Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=42 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=41-42 Stats: 87 lines in 6 files changed: 26 ins; 10 del; 51 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Wed Jun 4 08:17:31 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 08:17:31 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: On Wed, 4 Jun 2025 06:29:59 GMT, Johannes Bechberger wrote: >> Any ideas? Or is it something for a later PR? > > I added another `_static_stop_signals` field which should prevent this. The _instance is only ever deleted in case a JFR startup attempt fails as part of JfrRecorder::create(). The sampler must have a rate and become enrolled to serve clients (by installing timers). The rate is set post JfrRecorder::create() using the setting system, which implies that _instance != nullptr should be invariant. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125976370 From jbechberger at openjdk.org Wed Jun 4 08:21:33 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 08:21:33 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: On Wed, 4 Jun 2025 08:14:11 GMT, Markus Gr?nlund wrote: >> I added another `_static_stop_signals` field which should prevent this. > > The _instance is only ever deleted in case a JFR startup attempt fails as part of JfrRecorder::create(). The sampler must have a rate and become enrolled to serve clients (by installing timers). The rate is set post JfrRecorder::create() using the setting system, which implies that _instance != nullptr should be invariant. Yes, you're right. I'll update the code and combine `_active_signal_handlers` and `_stop_signals` in one, so that a CAS loop prevents `_active_signal_handlers` from being incremented when `_stop_signals` is true. This should solve the other data race. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2125985412 From mgronlun at openjdk.org Wed Jun 4 08:22:21 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 08:22:21 GMT Subject: Integrated: 8357671: JFR: Remove JfrTraceIdEpoch synchronizing In-Reply-To: <4FuUPlh3piGBRKq_6BggDdyQviABYNk66rTV97rYaTs=.227185d8-81a8-49eb-a7e8-e70ce6cbf2b0@github.com> References: <4FuUPlh3piGBRKq_6BggDdyQviABYNk66rTV97rYaTs=.227185d8-81a8-49eb-a7e8-e70ce6cbf2b0@github.com> Message-ID: On Tue, 3 Jun 2025 18:09:22 GMT, Markus Gr?nlund wrote: > Greetings, > > The JfrTraceIdEpoch::is_synchronizing() method and the field _synchronizing are remnants from the old days when we attempted to force CompilerThreads running in native mode into the correct epoch, which ultimately failed due to races. > > Removing all that old cruft. Also, reuse the existing epoch generation value for the string pool. > > Testing: jdk_jfr > > Thanks > Markus This pull request has now been integrated. Changeset: 955bfcd5 Author: Markus Gr?nlund URL: https://git.openjdk.org/jdk/commit/955bfcd5502b3555c2c91db876be8e7535f2289a Stats: 52 lines in 7 files changed: 1 ins; 29 del; 22 mod 8357671: JFR: Remove JfrTraceIdEpoch synchronizing Reviewed-by: egahlin ------------- PR: https://git.openjdk.org/jdk/pull/25625 From mgronlun at openjdk.org Wed Jun 4 08:23:26 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 08:23:26 GMT Subject: Integrated: 8358429: JFR: minimize the time the Threads_lock is held for sampling In-Reply-To: References: Message-ID: <98Xo5Tyi3O-uyYygRuySHcU-FBx4w1Bmu8ciZvKxkh4=.a1c1838e-0e23-4240-81a7-4fdea7822228@github.com> On Mon, 2 Jun 2025 23:17:33 GMT, Markus Gr?nlund wrote: > Greetings, > > Before [JDK-8352251](https://bugs.openjdk.org/browse/JDK-8352251), the JFR Sampler Thread held onto the Threads_lock during the entire sampling period when iterating threads. > > This was for two purposes: > > 1. Having a non-Java thread sampler thread race through an ongoing safepoint, touching oops is generally not supported by most GCs. > 2. Since the sampler thread is a non-Java thread, and a JavaThread to be sampled can be in thread state _thread_in_native, it means both threads are outside the safepoint protocol. JFR evolves its global epoch during a safepoint. > > With [JDK-8352251](https://bugs.openjdk.org/browse/JDK-8352251), things have improved much. The sampling parts performed by the non-Java sampler thread do not touch any oops for threads sampled in state _thread_in_Java. > For sampling threads in native, the original issue persists (the sampler thread needs to capture the stack trace in the correct JFR epoch, and will also, in the case of virtual threads, need to touch oops). > > However, we can significantly reduce the time the Threads_lock is held for sampling. > > Testing: jdk_jfr, stress testing > > Thanks > Markus This pull request has now been integrated. Changeset: b6d60280 Author: Markus Gr?nlund URL: https://git.openjdk.org/jdk/commit/b6d60280e789436c7f9e3cd1447c8f77b77e77b4 Stats: 165 lines in 4 files changed: 102 ins; 19 del; 44 mod 8358429: JFR: minimize the time the Threads_lock is held for sampling Reviewed-by: egahlin ------------- PR: https://git.openjdk.org/jdk/pull/25602 From mgronlun at openjdk.org Wed Jun 4 08:43:37 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 08:43:37 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: On Wed, 4 Jun 2025 03:07:52 GMT, Andrei Pangin wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Rename autoadapt > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 606: > >> 604: void JfrCPUTimeThreadSampler::init_timers() { >> 605: // install sig handler for sig >> 606: PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal); > > SIGPROF is also used by external profilers. Need to check if SIGPROF handler is already installed and warn user. This is *very* important to have a robust failure mechanism when existing handlers are already installed. Why? JFR can be turned on dynamically from the outside, at any time, during runtime. A lot of agents could have installed their handlers by then. Please describe how you intend to handle the case where someone starts JFR late during runtime and the signal handler cannot be installed. > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.hpp line 128: > >> 126: static void send_lost_event(const JfrTicks& time, traceid tid, s4 lost_samples); >> 127: >> 128: // Trigger sampling while a thread is not in a safepoint, from a seperate thread > > typo: separate And again, its not "sampling" that is triggered. It is async processing of the queue holding existing samples. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126029865 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126025355 From jbechberger at openjdk.org Wed Jun 4 11:13:16 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 11:13:16 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v44] In-Reply-To: References: Message-ID: <35LXUV5UP0dcnU2ImfP7ny2SyPmJBTYhRT6JbADqWA4=.22d4360e-639c-4e65-86a3-62aad45a2606@github.com> > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - Add error message on signal handler install failure - Fix signal handler synchronization ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/55c30aef..4a258e96 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=43 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=42-43 Stats: 71 lines in 2 files changed: 44 ins; 19 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 11:13:17 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 11:13:17 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: On Wed, 4 Jun 2025 08:40:34 GMT, Markus Gr?nlund wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 606: >> >>> 604: void JfrCPUTimeThreadSampler::init_timers() { >>> 605: // install sig handler for sig >>> 606: PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal); >> >> SIGPROF is also used by external profilers. Need to check if SIGPROF handler is already installed and warn user. > > This is *very* important to have a robust failure mechanism when existing handlers are already installed. Why? JFR can be turned on dynamically from the outside, at any time, during runtime. A lot of agents could have installed their handlers by then. > > Please describe how you intend to handle the case where someone starts JFR late during runtime and the signal handler cannot be installed. I added a log_error to tell the user >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.hpp line 128: >> >>> 126: static void send_lost_event(const JfrTicks& time, traceid tid, s4 lost_samples); >>> 127: >>> 128: // Trigger sampling while a thread is not in a safepoint, from a seperate thread >> >> typo: separate > > And again, its not "sampling" that is triggered. It is async processing of the queue holding existing samples. I removed the comment, as the method name itself is pretty self-explanatory. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126330036 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126332382 From jbechberger at openjdk.org Wed Jun 4 11:18:52 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 11:18:52 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v45] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 127 commits: - Merge branch 'master' into parttimenerd_cooperative_cpu_time_sampler - Add error message on signal handler install failure - Fix signal handler synchronization - Improve - Rename autoadapt - Make process_cpu_time_request private and move up - Reorder condition - Tiny refactoring - Restrict threads for which timers are created - Fix tiny mistake - ... and 117 more: https://git.openjdk.org/jdk/compare/7838321b...4fd4b673 ------------- Changes: https://git.openjdk.org/jdk/pull/25302/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=44 Stats: 2308 lines in 39 files changed: 2164 ins; 128 del; 16 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 11:28:51 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 11:28:51 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v46] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Improve error message ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/4fd4b673..8fe07614 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=45 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=44-45 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From apangin at openjdk.org Wed Jun 4 11:28:51 2025 From: apangin at openjdk.org (Andrei Pangin) Date: Wed, 4 Jun 2025 11:28:51 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: On Wed, 4 Jun 2025 05:26:42 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 161: >> >>> 159: return 0; >>> 160: } >>> 161: return os::active_processor_count() * 1000000000.0 / rate; >> >> If sampling period is configured as an absolute number in milliseconds, this value must be passed as is. >> Double conversion via `Runtime.availableProcessors()` / `active_processor_count()` is unobvious and error-prone. First, because of asymmetry: e.g. `Runtime.availableProcessors()` may be redefined by an agent so that its value is not aligned with `active_processor_count()`. Second, because number of available processors may change at runtime, e.g., by adjusting cgroup quotas. > > Is this something for a later PR? I'm OK with fixing this separately. >> src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 558: >> >>> 556: void JfrThreadLocal::set_cpu_timer(timer_t* timer) { >>> 557: if (_cpu_timer == nullptr) { >>> 558: _cpu_timer = JfrCHeapObj::new_array(1); >> >> `timer_t` is a primitive type, at most one machine word. Why extra indirection and allocation? > > @mgronlun wanted this indirection to move it abstract from implementation details I don't see how it is an abstraction when the pointer still has concrete `timer_t` type. All POSIX timer functions accept `timer_t` rather than `timer_t*`. This is not a big issue, though, just a minor inefficiency. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126360330 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126304082 From apangin at openjdk.org Wed Jun 4 11:28:52 2025 From: apangin at openjdk.org (Andrei Pangin) Date: Wed, 4 Jun 2025 11:28:52 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v43] In-Reply-To: <-BGoOClpsfsd4Q8Wq-H57L3tIvoaLGauYtRBEDPO-_w=.97e25e4f-879d-45f6-bd00-ad53e2463a8d@github.com> References: <-BGoOClpsfsd4Q8Wq-H57L3tIvoaLGauYtRBEDPO-_w=.97e25e4f-879d-45f6-bd00-ad53e2463a8d@github.com> Message-ID: On Wed, 4 Jun 2025 07:00:51 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Improve src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 238: > 236: tl->cpu_time_jfr_queue().resize_for_period(_current_sampling_period_ns / 1000000); > 237: timer_t timerid; > 238: if (create_timer_for_thread(thread, timerid)) { Timer creation failure is not an impossible situation, we should somehow let user know that not all threads are being profiled but without flooding in logs. One warning per profiling session may be a good compromise. You can verify failure condition by setting low `ulimit -i`. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 492: > 490: assert(_sampler != nullptr, "invariant"); > 491: if (info->si_signo != SIGPROF) { > 492: // not the signal we are interested in No, I meant checking `si_code`. `si_signo` will always be the right one. And this check should come first, before any assertions. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126338737 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126316533 From apangin at openjdk.org Wed Jun 4 11:28:54 2025 From: apangin at openjdk.org (Andrei Pangin) Date: Wed, 4 Jun 2025 11:28:54 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v45] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 11:18:52 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 127 commits: > > - Merge branch 'master' into parttimenerd_cooperative_cpu_time_sampler > - Add error message on signal handler install failure > - Fix signal handler synchronization > - Improve > - Rename autoadapt > - Make process_cpu_time_request private and move up > - Reorder condition > - Tiny refactoring > - Restrict threads for which timers are created > - Fix tiny mistake > - ... and 117 more: https://git.openjdk.org/jdk/compare/7838321b...4fd4b673 src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 611: > 609: // increment the count of active signal handlers > 610: u4 old_value = Atomic::fetch_then_add(&_active_signal_handlers, (u4)1, memory_order_acq_rel); > 611: if ((old_value & STOP_SIGNAL_BIT) != 0) { Combining stop signal with a counter is nice, you can then use `Atomic::cmpxchg` to avoid incrementing counter when the stop bit is set. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126354062 From mgronlun at openjdk.org Wed Jun 4 11:28:54 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 11:28:54 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v45] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 11:18:52 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 127 commits: > > - Merge branch 'master' into parttimenerd_cooperative_cpu_time_sampler > - Add error message on signal handler install failure > - Fix signal handler synchronization > - Improve > - Rename autoadapt > - Make process_cpu_time_request private and move up > - Reorder condition > - Tiny refactoring > - Restrict threads for which timers are created > - Fix tiny mistake > - ... and 117 more: https://git.openjdk.org/jdk/compare/7838321b...4fd4b673 src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 647: > 645: // install sig handler for sig > 646: if ((s8)PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == -1) { > 647: log_error(jfr)("Failed to install signal handler for CPU thread sampling, possibly because another profiler is active: %s", os::strerror(os::get_last_error())); That we are using a signal handler to provide the user with CPU time information is an implementation detail. Its good to provide an error message, but I think it should reflect back on something the user is expecting. Perhaps add a line that says something along the lines of "CPUTimeSample events will not be recorded." ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126357345 From jbechberger at openjdk.org Wed Jun 4 11:28:54 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 11:28:54 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v45] In-Reply-To: References: Message-ID: <1vlVzhpxsamhKyaKX4ixcG-JZj4Qxgc0Au3mEnjs_So=.91d8a5a1-7b1b-46c6-991c-a5c61c77e39e@github.com> On Wed, 4 Jun 2025 11:23:57 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 127 commits: >> >> - Merge branch 'master' into parttimenerd_cooperative_cpu_time_sampler >> - Add error message on signal handler install failure >> - Fix signal handler synchronization >> - Improve >> - Rename autoadapt >> - Make process_cpu_time_request private and move up >> - Reorder condition >> - Tiny refactoring >> - Restrict threads for which timers are created >> - Fix tiny mistake >> - ... and 117 more: https://git.openjdk.org/jdk/compare/7838321b...4fd4b673 > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 647: > >> 645: // install sig handler for sig >> 646: if ((s8)PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == -1) { >> 647: log_error(jfr)("Failed to install signal handler for CPU thread sampling, possibly because another profiler is active: %s", os::strerror(os::get_last_error())); > > That we are using a signal handler to provide the user with CPU time information is an implementation detail. Its good to provide an error message, but I think it should reflect back on something the user is expecting. > > Perhaps add a line that says something along the lines of "CPUTimeSample events will not be recorded." Done ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126360801 From egahlin at openjdk.org Wed Jun 4 11:34:24 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 4 Jun 2025 11:34:24 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 12:50:49 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Fix adjust boundary @AlanBateman Do you have time for a review? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25559#issuecomment-2939669198 From jbechberger at openjdk.org Wed Jun 4 11:37:34 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 11:37:34 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v43] In-Reply-To: References: <-BGoOClpsfsd4Q8Wq-H57L3tIvoaLGauYtRBEDPO-_w=.97e25e4f-879d-45f6-bd00-ad53e2463a8d@github.com> Message-ID: <3tt6-HjldmHpRIKHFqWHaLcC7FRZLwiCZl__j7Ht7Gw=.a14d3aa8-4780-49e2-b9ec-d24a828a1948@github.com> On Wed, 4 Jun 2025 11:13:30 GMT, Andrei Pangin wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Improve > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 238: > >> 236: tl->cpu_time_jfr_queue().resize_for_period(_current_sampling_period_ns / 1000000); >> 237: timer_t timerid; >> 238: if (create_timer_for_thread(thread, timerid)) { > > Timer creation failure is not an impossible situation, we should somehow let user know that not all threads are being profiled but without flooding in logs. One warning per profiling session may be a good compromise. > You can verify failure condition by setting low `ulimit -i`. I added a "Failed to create timer for a thread" warning ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126373721 From jbechberger at openjdk.org Wed Jun 4 11:37:37 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 11:37:37 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v45] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 11:21:57 GMT, Andrei Pangin wrote: >> Johannes Bechberger has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 127 commits: >> >> - Merge branch 'master' into parttimenerd_cooperative_cpu_time_sampler >> - Add error message on signal handler install failure >> - Fix signal handler synchronization >> - Improve >> - Rename autoadapt >> - Make process_cpu_time_request private and move up >> - Reorder condition >> - Tiny refactoring >> - Restrict threads for which timers are created >> - Fix tiny mistake >> - ... and 117 more: https://git.openjdk.org/jdk/compare/7838321b...4fd4b673 > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 611: > >> 609: // increment the count of active signal handlers >> 610: u4 old_value = Atomic::fetch_then_add(&_active_signal_handlers, (u4)1, memory_order_acq_rel); >> 611: if ((old_value & STOP_SIGNAL_BIT) != 0) { > > Combining stop signal with a counter is nice, you can then use `Atomic::cmpxchg` to avoid incrementing counter when the stop bit is set. I don't see how `Atomic::cmpxchg` would make the code easier. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126375482 From dtabata at openjdk.org Wed Jun 4 11:43:31 2025 From: dtabata at openjdk.org (Daishi Tabata) Date: Wed, 4 Jun 2025 11:43:31 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v46] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 11:28:51 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Improve error message https://github.com/openjdk/jdk/pull/25302/commits/a419dabab213e78a2ff7f3c62cd4af72a0fdabed Since the implementation has changed from Loss to Lost, the JEP document needs to be changed back to the original, Lost. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2939698219 From jbechberger at openjdk.org Wed Jun 4 11:43:32 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 11:43:32 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v45] In-Reply-To: References: Message-ID: <6e2kCVaBWwL4UY_zXxuwRDYQKksbEo_uaRH7P8gBDJU=.f52500af-d413-4b2e-bc19-32d2248aa48e@github.com> On Wed, 4 Jun 2025 11:34:44 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 611: >> >>> 609: // increment the count of active signal handlers >>> 610: u4 old_value = Atomic::fetch_then_add(&_active_signal_handlers, (u4)1, memory_order_acq_rel); >>> 611: if ((old_value & STOP_SIGNAL_BIT) != 0) { >> >> Combining stop signal with a counter is nice, you can then use `Atomic::cmpxchg` to avoid incrementing counter when the stop bit is set. > > I don't see how `Atomic::cmpxchg` would make the code easier. With my current code, I avoid having a loop, and in the fast path, I only have one atomic instruction. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126383576 From jbechberger at openjdk.org Wed Jun 4 11:49:33 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 11:49:33 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v46] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 11:28:51 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Improve error message > [a419dab](https://github.com/openjdk/jdk/commit/a419dabab213e78a2ff7f3c62cd4af72a0fdabed) > Since the implementation has changed from Loss to Lost, the JEP document needs to be changed back to the original, Lost. Good catch, I updated the JEP. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2939723399 From jbechberger at openjdk.org Wed Jun 4 12:05:50 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 12:05:50 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v47] In-Reply-To: References: Message-ID: <7XHQamQvo__d4VCHVNQQqwNEmPLoKh8wtpES1a3ZRDg=.2bc3d95c-c00d-4487-90e2-2341a8da9173@github.com> > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Improve ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/8fe07614..fe53990d Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=46 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=45-46 Stats: 11 lines in 1 file changed: 8 ins; 1 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Wed Jun 4 12:05:50 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 12:05:50 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v46] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 11:28:51 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Improve error message I am approving this PR for the following reasons: 1. We have reached a state that is "good enough" - I no longer see any fundamental design issues that can not be handled by follow-up bug fixes. 2. There are still many vague aspects included with this PR, as many has already pointed out, mostly related to the memory model and thread interactions - all those can, and should, be clarified, explained and exacted post-integration. 3. The feature as a whole is experimental and turned off by default. 4. Today is the penultimate day before JDK 25 cutoff. To give the feature a fair chance for making JDK25, it needs approval now. Thanks a lot Johannes and all involved for your hard work getting this feature ready. Many thanks Markus ------------- Marked as reviewed by mgronlun (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2896467191 From jbechberger at openjdk.org Wed Jun 4 12:10:17 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 12:10:17 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v48] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Fix timer creation warning ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/fe53990d..8d545e74 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=47 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=46-47 Stats: 4 lines in 1 file changed: 0 ins; 1 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From alanb at openjdk.org Wed Jun 4 12:10:20 2025 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 4 Jun 2025 12:10:20 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 11:31:21 GMT, Erik Gahlin wrote: > @AlanBateman Do you have time for a review? Yes, looking at the changes. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25559#issuecomment-2939787559 From jbechberger at openjdk.org Wed Jun 4 12:23:13 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 12:23:13 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v49] In-Reply-To: References: Message-ID: <4aLbfK7e6pncU0QwXORueBxt8WEOz5KYO1pKnpjFOC0=.cf78fb29-a30f-4084-bee7-76c1e6e81f31@github.com> > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Fix build ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/8d545e74..fbaf1da6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=48 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=47-48 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From apangin at openjdk.org Wed Jun 4 12:38:21 2025 From: apangin at openjdk.org (Andrei Pangin) Date: Wed, 4 Jun 2025 12:38:21 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v48] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 12:10:17 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix timer creation warning src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 491: > 489: > 490: void JfrCPUTimeThreadSampling::handle_timer_signal(siginfo_t* info, void* context) { > 491: if (info->si_code != SIGPROF) { The correct check is `if (info->si_code != SI_TIMER)` src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 652: > 650: bool JfrCPUSamplerThread::init_timers() { > 651: // install sig handler for sig > 652: if ((s8)PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == -1) { Comparing return value to `(void*)-1` would be cleaner. But the main problem is that it only checks for `sigaction` failure (which normally never happens), however, we should also check if there was a custom signal handler set _before_ installing our own handler, i.e. old handler is not SIG_IGN or SIG_DFL or `handle_timer_signal`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126447823 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126488937 From jbechberger at openjdk.org Wed Jun 4 12:47:36 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 12:47:36 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v48] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 12:33:45 GMT, Andrei Pangin wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix timer creation warning > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 652: > >> 650: bool JfrCPUSamplerThread::init_timers() { >> 651: // install sig handler for sig >> 652: if ((s8)PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == -1) { > > Comparing return value to `(void*)-1` would be cleaner. > But the main problem is that it only checks for `sigaction` failure (which normally never happens), however, we should also check if there was a custom signal handler set _before_ installing our own handler, i.e. old handler is not SIG_IGN or SIG_DFL or `handle_timer_signal`. Using `sigaction(SIG, NULL, &sa)` ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126510947 From jbechberger at openjdk.org Wed Jun 4 12:56:22 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 12:56:22 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: Message-ID: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Fix build ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/fbaf1da6..e4558a6e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=49 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=48-49 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 13:07:15 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 13:07:15 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v48] In-Reply-To: References: Message-ID: <-JmnqMbD8vGy_dVeVUv59WrjuCavWV3F3w9HMTxhAQM=.2c079574-0729-4c70-af86-946a3204f7b6@github.com> On Wed, 4 Jun 2025 12:44:53 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 652: >> >>> 650: bool JfrCPUSamplerThread::init_timers() { >>> 651: // install sig handler for sig >>> 652: if ((s8)PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == -1) { >> >> Comparing return value to `(void*)-1` would be cleaner. >> But the main problem is that it only checks for `sigaction` failure (which normally never happens), however, we should also check if there was a custom signal handler set _before_ installing our own handler, i.e. old handler is not SIG_IGN or SIG_DFL or `handle_timer_signal`. > > Using `sigaction(SIG, NULL, &sa)` ? I'm currently implementing the check against SIG_IGN and SIG_DFL, as `handle_timer_signal` should never occur. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126551278 From egahlin at openjdk.org Wed Jun 4 13:19:36 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 4 Jun 2025 13:19:36 GMT Subject: RFR: 8358590: JFR: Include min and max in MethodTiming event Message-ID: Could I have review of this PR that adds minimum and maximum to the MethodTimingEvent. Testing: jdk/jdk/jfr Thanks Erik ------------- Commit messages: - Initial Changes: https://git.openjdk.org/jdk/pull/25637/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25637&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8358590 Stats: 49 lines in 6 files changed: 42 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/25637.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25637/head:pull/25637 PR: https://git.openjdk.org/jdk/pull/25637 From egahlin at openjdk.org Wed Jun 4 13:19:49 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 4 Jun 2025 13:19:49 GMT Subject: RFR: 8358536: jdk/jfr/api/consumer/TestRecordingFileWrite.java times out Message-ID: <3mPIkzXdn_aYsY5Xw0Ovqj-NQZqthFB4EKt7Oter6kg=.9c21d13e-1aac-4356-8b09-bf1dcb5e73a1@github.com> Could I have a review of the PR that fixes a regression caused by [JDK-8356698](https://bugs.openjdk.org/browse/JDK-8356698)? The problem is that PrettyWriter is also used by RecordedObject::toString, and by allocating the priority queue when PrettyWriter is instantiated, the memory pressure increases enormously. The fix is to allocate them lazily. Testing: 10 * jdk/jdk/jfr/ on Linux, MacOS and Windows. Thanks Erik ------------- Commit messages: - Initial Changes: https://git.openjdk.org/jdk/pull/25633/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25633&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8358536 Stats: 10 lines in 2 files changed: 6 ins; 4 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25633.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25633/head:pull/25633 PR: https://git.openjdk.org/jdk/pull/25633 From mgronlun at openjdk.org Wed Jun 4 13:19:50 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 13:19:50 GMT Subject: RFR: 8358536: jdk/jfr/api/consumer/TestRecordingFileWrite.java times out In-Reply-To: <3mPIkzXdn_aYsY5Xw0Ovqj-NQZqthFB4EKt7Oter6kg=.9c21d13e-1aac-4356-8b09-bf1dcb5e73a1@github.com> References: <3mPIkzXdn_aYsY5Xw0Ovqj-NQZqthFB4EKt7Oter6kg=.9c21d13e-1aac-4356-8b09-bf1dcb5e73a1@github.com> Message-ID: On Wed, 4 Jun 2025 04:15:12 GMT, Erik Gahlin wrote: > Could I have a review of the PR that fixes a regression caused by [JDK-8356698](https://bugs.openjdk.org/browse/JDK-8356698)? > > The problem is that PrettyWriter is also used by RecordedObject::toString, and by allocating the priority queue when PrettyWriter is instantiated, the memory pressure increases enormously. The fix is to allocate them lazily. > > Testing: 10 * jdk/jdk/jfr/ on Linux, MacOS and Windows. > > Thanks > Erik Looks good. ------------- Marked as reviewed by mgronlun (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25633#pullrequestreview-2896381131 From egahlin at openjdk.org Wed Jun 4 13:41:55 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 4 Jun 2025 13:41:55 GMT Subject: Integrated: 8358536: jdk/jfr/api/consumer/TestRecordingFileWrite.java times out In-Reply-To: <3mPIkzXdn_aYsY5Xw0Ovqj-NQZqthFB4EKt7Oter6kg=.9c21d13e-1aac-4356-8b09-bf1dcb5e73a1@github.com> References: <3mPIkzXdn_aYsY5Xw0Ovqj-NQZqthFB4EKt7Oter6kg=.9c21d13e-1aac-4356-8b09-bf1dcb5e73a1@github.com> Message-ID: On Wed, 4 Jun 2025 04:15:12 GMT, Erik Gahlin wrote: > Could I have a review of the PR that fixes a regression caused by [JDK-8356698](https://bugs.openjdk.org/browse/JDK-8356698)? > > The problem is that PrettyWriter is also used by RecordedObject::toString, and by allocating the priority queue when PrettyWriter is instantiated, the memory pressure increases enormously. The fix is to allocate them lazily. > > Testing: 10 * jdk/jdk/jfr/ on Linux, MacOS and Windows. > > Thanks > Erik This pull request has now been integrated. Changeset: a653ff48 Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/a653ff48933bfd72c7c3d004ccc5bd0d9c1162cb Stats: 10 lines in 2 files changed: 6 ins; 4 del; 0 mod 8358536: jdk/jfr/api/consumer/TestRecordingFileWrite.java times out Reviewed-by: mgronlun ------------- PR: https://git.openjdk.org/jdk/pull/25633 From mdoerr at openjdk.org Wed Jun 4 14:01:16 2025 From: mdoerr at openjdk.org (Martin Doerr) Date: Wed, 4 Jun 2025 14:01:16 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 12:56:22 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix build I've looked over it and couldn't spot any critical issue. I think it's good enough for an experimental feature if we do further cleanups and improvements later. What I'd like to see as a follow-up is a review of the usage of `Atomic` functions. I've never seen so many of them in such a density. ------------- Marked as reviewed by mdoerr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2896853345 From mgronlun at openjdk.org Wed Jun 4 14:04:50 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 14:04:50 GMT Subject: RFR: 8358590: JFR: Include min and max in MethodTiming event In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 11:36:34 GMT, Erik Gahlin wrote: > Could I have review of this PR that adds minimum and maximum to the MethodTimingEvent. > > Testing: jdk/jdk/jfr > > Thanks > Erik Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25637#pullrequestreview-2896869984 From pchilanomate at openjdk.org Wed Jun 4 14:15:53 2025 From: pchilanomate at openjdk.org (Patricio Chilano Mateo) Date: Wed, 4 Jun 2025 14:15:53 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 12:56:22 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix build I took a look at this. I only found one issue that needs fixing before integration and then a few comments. Thanks. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 59: > 57: Thread* raw_thread = Thread::current_or_null_safe(); > 58: if (raw_thread == nullptr) { > 59: // probably while shutting down Do you remember which test fail because of this? It would be interesting to know, since I don?t see how it could be null here. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 330: > 328: void JfrCPUSamplerThread::stackwalk_threads_in_native() { > 329: ResourceMark rm; > 330: MutexLocker tlock(Threads_lock); What exactly are we guarding against by holding the `Threads_lock`? Seems `ThreadsListHandle` should be enough. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 430: > 428: void JfrCPUTimeThreadSampling::create_sampler(double rate, bool auto_adapt) { > 429: assert(_sampler == nullptr, "invariant"); > 430: _sampler = new JfrCPUSamplerThread(rate, auto_adapt); If we start a recording on an already running process we have a race here where a new thread can create and set its timer before we call init_timers() where the signal handler is installed. In that case the program will terminate with message ?Profiling timer expired" (default action for SIGPROF). It can be easily reproduced by adding a delay here and starting a recording on a simple test that just creates new threads. We need to add some extra check in create_timer_for_thread() or install the signal handler earlier. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 584: > 582: sev.sigev_notify = SIGEV_THREAD_ID; > 583: sev.sigev_signo = SIG; > 584: sev.sigev_value.sival_ptr = &t; Why setting the address of `t` which is a local variable here? ------------- PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2896813404 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126661443 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126670024 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126651264 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126666505 From jbechberger at openjdk.org Wed Jun 4 14:15:55 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:15:55 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v48] In-Reply-To: <-JmnqMbD8vGy_dVeVUv59WrjuCavWV3F3w9HMTxhAQM=.2c079574-0729-4c70-af86-946a3204f7b6@github.com> References: <-JmnqMbD8vGy_dVeVUv59WrjuCavWV3F3w9HMTxhAQM=.2c079574-0729-4c70-af86-946a3204f7b6@github.com> Message-ID: On Wed, 4 Jun 2025 13:04:28 GMT, Johannes Bechberger wrote: >> Using `sigaction(SIG, NULL, &sa)` ? > > I'm currently implementing the check against SIG_IGN and SIG_DFL, as `handle_timer_signal` should never occur. I implemented what you want. This prevents confusion of users. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126701277 From jbechberger at openjdk.org Wed Jun 4 14:15:48 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:15:48 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v51] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Check if signal handler is already installed ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/e4558a6e..762da321 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=50 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=49-50 Stats: 14 lines in 3 files changed: 12 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From pchilanomate at openjdk.org Wed Jun 4 14:15:54 2025 From: pchilanomate at openjdk.org (Patricio Chilano Mateo) Date: Wed, 4 Jun 2025 14:15:54 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 15:13:54 GMT, Markus Gr?nlund wrote: >> So I don't read the ` tl->has_cpu_time_jfr_requests()` twice on the hot-path > > Ok, for now. We should try to come up with a better split. If there are sample requests then we are already in the slow path so loading again `has_cpu_time_jfr_requests()` later won't change anything. My suggestion would be to avoid passing this boolean around. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126692802 From jbechberger at openjdk.org Wed Jun 4 14:21:07 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:21:07 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 13:51:31 GMT, Patricio Chilano Mateo wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix build > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 59: > >> 57: Thread* raw_thread = Thread::current_or_null_safe(); >> 58: if (raw_thread == nullptr) { >> 59: // probably while shutting down > > Do you remember which test fail because of this? It would be interesting to know, since I don?t see how it could be null here. I just ran the renaissance benchmark with https://github.com/parttimenerd/basic-profiler-tests for a few hours. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126728665 From jbechberger at openjdk.org Wed Jun 4 14:27:16 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:27:16 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 13:55:06 GMT, Patricio Chilano Mateo wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix build > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 330: > >> 328: void JfrCPUSamplerThread::stackwalk_threads_in_native() { >> 329: ResourceMark rm; >> 330: MutexLocker tlock(Threads_lock); > > What exactly are we guarding against by holding the `Threads_lock`? Seems `ThreadsListHandle` should be enough. You're right. > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 584: > >> 582: sev.sigev_notify = SIGEV_THREAD_ID; >> 583: sev.sigev_signo = SIG; >> 584: sev.sigev_value.sival_ptr = &t; > > Why setting the address of `t` which is a local variable here? Because this is how the API works. You store the location where the timer should be stored. See https://www.man7.org/linux/man-pages/man2/timer_create.2.html for more information. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126741491 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126735519 From jbechberger at openjdk.org Wed Jun 4 14:31:08 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:31:08 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v29] In-Reply-To: References: Message-ID: <8K2UKh2c90_9WYibMs0LoKZr5GNFAGZkINV11POsvac=.8150ba38-e33e-4780-bb08-2783640b6a3a@github.com> On Wed, 4 Jun 2025 14:04:51 GMT, Patricio Chilano Mateo wrote: >> Ok, for now. We should try to come up with a better split. > > If there are sample requests then we are already in the slow path so loading again `has_cpu_time_jfr_requests()` later won't change anything. My suggestion would be to avoid passing this boolean around. I removed it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126751794 From alanb at openjdk.org Wed Jun 4 14:35:00 2025 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 4 Jun 2025 14:35:00 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: References: Message-ID: <7i52AKYBlYgN9kWre2Nc7gUusKWjRJ3aQD8sll095xg=.c2589f2d-76c6-405a-92ab-2b33908c9cc1@github.com> On Tue, 3 Jun 2025 12:50:49 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Fix adjust boundary src/java.base/share/classes/java/net/Socket.java line 970: > 968: long end = SocketReadEvent.timestamp(); > 969: long duration = end - start; > 970: if (SocketReadEvent.shouldThrottleCommit(duration, end)) { The use sites want to ask if an event should be committed. Does the word "Throttle" need to be in name as I don't think the use cases need to care about this. Also, just to point out that the shouldXXX method is called with the the end timestamp and duration whereas the offset/emit/commit methods are called with the start timestamp and duration. So two long timestamps and a long measure of time, easy to get it wrong somewhere. Maybe not this PR but I think would be clearer at the use sites to use start or end consistently and reduce potential for mistakes. src/jdk.jfr/share/classes/jdk/jfr/Throttle.java line 77: > 75: * Specifying {@code "off"} (case-sensitive) results in all events being emitted. > 76: * > 77: * @return the throttle value, default {@code "off"} not {@code null} I think it would be clear to drop "not null" from the return description. src/jdk.jfr/share/conf/jfr/default.jfc line 762: > 760: true > 761: true > 762: 20 ms I agree FileForce isn't a good candidate to throttle. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2126765474 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2126722810 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2126719134 From jbechberger at openjdk.org Wed Jun 4 14:45:15 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:45:15 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 13:47:01 GMT, Patricio Chilano Mateo wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix build > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 430: > >> 428: void JfrCPUTimeThreadSampling::create_sampler(double rate, bool auto_adapt) { >> 429: assert(_sampler == nullptr, "invariant"); >> 430: _sampler = new JfrCPUSamplerThread(rate, auto_adapt); > > If we start a recording on an already running process we have a race here where a new thread can create and set its timer before we call init_timers() where the signal handler is installed. In that case the program will terminate with message ?Profiling timer expired" (default action for SIGPROF). It can be easily reproduced by adding a delay here and starting a recording on a simple test that just creates new threads. We need to add some extra check in create_timer_for_thread() or install the signal handler earlier. I created a `has_timer` flag that is checked by `create_timer_for_thread()` before creating timers and set by `init_timers`. Is this what you envisioned? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126783367 From pchilanomate at openjdk.org Wed Jun 4 14:45:21 2025 From: pchilanomate at openjdk.org (Patricio Chilano Mateo) Date: Wed, 4 Jun 2025 14:45:21 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 14:21:31 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 584: >> >>> 582: sev.sigev_notify = SIGEV_THREAD_ID; >>> 583: sev.sigev_signo = SIG; >>> 584: sev.sigev_value.sival_ptr = &t; >> >> Why setting the address of `t` which is a local variable here? > > Because this is how the API works. You store the location where the timer should be stored. > > See https://www.man7.org/linux/man-pages/man2/timer_create.2.html for more information. Sorry where does it say that? I think you are looking at the example in that page which makes use of sival_ptr in the signal handler. In that example reading from that timer address in the handler is valid but for us we would be accessing invalid memory. Plus we are not really reading it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126787035 From jbechberger at openjdk.org Wed Jun 4 14:49:09 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:49:09 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 14:41:24 GMT, Patricio Chilano Mateo wrote: >> Because this is how the API works. You store the location where the timer should be stored. >> >> See https://www.man7.org/linux/man-pages/man2/timer_create.2.html for more information. > > Sorry where does it say that? I think you are looking at the example in that page which makes use of sival_ptr in the signal handler. In that example reading from that timer address in the handler is valid but for us we would be accessing invalid memory. Plus we are not really reading it. Why would we be accessing invalid memory? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126798263 From jbechberger at openjdk.org Wed Jun 4 14:59:33 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:59:33 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v52] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Small changes Suggested by @pchilano ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/762da321..20b8db28 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=51 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=50-51 Stats: 21 lines in 4 files changed: 6 ins; 4 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 14:59:33 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:59:33 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 14:46:27 GMT, Johannes Bechberger wrote: >> Sorry where does it say that? I think you are looking at the example in that page which makes use of sival_ptr in the signal handler. In that example reading from that timer address in the handler is valid but for us we would be accessing invalid memory. Plus we are not really reading it. > > Why would we be accessing invalid memory? Which differences to the example code are you seeing? sev.sigev_notify = SIGEV_SIGNAL; sev.sigev_signo = SIG; sev.sigev_value.sival_ptr = &timerid; if (timer_create(CLOCKID, &sev, &timerid) == -1) errExit("timer_create"); printf("timer ID is %#jx\n", (uintmax_t) timerid); /* Start the timer. */ freq_nanosecs = atoll(argv[2]); its.it_value.tv_sec = freq_nanosecs / 1000000000; its.it_value.tv_nsec = freq_nanosecs % 1000000000; its.it_interval.tv_sec = its.it_value.tv_sec; its.it_interval.tv_nsec = its.it_value.tv_nsec; Is similar to: ((int*)&sev.sigev_notify)[1] = thread->osthread()->thread_id(); clockid_t clock; int err = pthread_getcpuclockid(thread->osthread()->pthread_id(), &clock); if (err != 0) { log_error(jfr)("Failed to get clock for thread sampling: %s", os::strerror(err)); return false; } if (timer_create(clock, &sev, &t) < 0) { return false; } int64_t period = get_sampling_period(); if (period != 0) { set_timer_time(t, period); } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126810984 From pchilanomate at openjdk.org Wed Jun 4 14:59:33 2025 From: pchilanomate at openjdk.org (Patricio Chilano Mateo) Date: Wed, 4 Jun 2025 14:59:33 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 14:52:04 GMT, Johannes Bechberger wrote: >> Why would we be accessing invalid memory? > > Which differences to the example code are you seeing? > > > sev.sigev_notify = SIGEV_SIGNAL; > sev.sigev_signo = SIG; > sev.sigev_value.sival_ptr = &timerid; > if (timer_create(CLOCKID, &sev, &timerid) == -1) > errExit("timer_create"); > > printf("timer ID is %#jx\n", (uintmax_t) timerid); > > /* Start the timer. */ > > freq_nanosecs = atoll(argv[2]); > its.it_value.tv_sec = freq_nanosecs / 1000000000; > its.it_value.tv_nsec = freq_nanosecs % 1000000000; > its.it_interval.tv_sec = its.it_value.tv_sec; > its.it_interval.tv_nsec = its.it_value.tv_nsec; > > > > Is similar to: > > > ((int*)&sev.sigev_notify)[1] = thread->osthread()->thread_id(); > clockid_t clock; > int err = pthread_getcpuclockid(thread->osthread()->pthread_id(), &clock); > if (err != 0) { > log_error(jfr)("Failed to get clock for thread sampling: %s", os::strerror(err)); > return false; > } > if (timer_create(clock, &sev, &t) < 0) { > return false; > } > int64_t period = get_sampling_period(); > if (period != 0) { > set_timer_time(t, period); > } The `sigev_value` member is used to pass data that you can read in the signal handler. The address of `t` won't be valid anymore once you return from this function. In that example the address of `timerid ` is still valid. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126817165 From jbechberger at openjdk.org Wed Jun 4 14:59:33 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 14:59:33 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 14:54:44 GMT, Patricio Chilano Mateo wrote: >> Which differences to the example code are you seeing? >> >> >> sev.sigev_notify = SIGEV_SIGNAL; >> sev.sigev_signo = SIG; >> sev.sigev_value.sival_ptr = &timerid; >> if (timer_create(CLOCKID, &sev, &timerid) == -1) >> errExit("timer_create"); >> >> printf("timer ID is %#jx\n", (uintmax_t) timerid); >> >> /* Start the timer. */ >> >> freq_nanosecs = atoll(argv[2]); >> its.it_value.tv_sec = freq_nanosecs / 1000000000; >> its.it_value.tv_nsec = freq_nanosecs % 1000000000; >> its.it_interval.tv_sec = its.it_value.tv_sec; >> its.it_interval.tv_nsec = its.it_value.tv_nsec; >> >> >> >> Is similar to: >> >> >> ((int*)&sev.sigev_notify)[1] = thread->osthread()->thread_id(); >> clockid_t clock; >> int err = pthread_getcpuclockid(thread->osthread()->pthread_id(), &clock); >> if (err != 0) { >> log_error(jfr)("Failed to get clock for thread sampling: %s", os::strerror(err)); >> return false; >> } >> if (timer_create(clock, &sev, &t) < 0) { >> return false; >> } >> int64_t period = get_sampling_period(); >> if (period != 0) { >> set_timer_time(t, period); >> } > > The `sigev_value` member is used to pass data that you can read in the signal handler. The address of `t` won't be valid anymore once you return from this function. In that example the address of `timerid ` is still valid. Why is this a problem? We don't leak `&t` outside of `create_timer_for_thread`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126820560 From jbechberger at openjdk.org Wed Jun 4 15:06:16 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 15:06:16 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v53] In-Reply-To: References: Message-ID: <40QHcJ9vY8NkXNVIhF-84WqMoSTRwxGsQfENcTJNEHI=.d1753def-3f74-4646-a574-952612dddaec@github.com> > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Improve create_timer_for_thread ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/20b8db28..45f915b4 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=52 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=51-52 Stats: 5 lines in 1 file changed: 0 ins; 2 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 15:06:16 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 15:06:16 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 14:56:10 GMT, Johannes Bechberger wrote: >> The `sigev_value` member is used to pass data that you can read in the signal handler. The address of `t` won't be valid anymore once you return from this function. In that example the address of `timerid ` is still valid. > > Why is this a problem? We don't leak `&t` outside of `create_timer_for_thread`. But I can start using the passed-in parameter `timerid` directly, which should make the code less confusing. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126829360 From jbechberger at openjdk.org Wed Jun 4 15:19:09 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 15:19:09 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 15:00:07 GMT, Johannes Bechberger wrote: >> Why is this a problem? We don't leak `&t` outside of `create_timer_for_thread`. > > But I can start using the passed-in parameter `timerid` directly, which should make the code less confusing. I pushed the modifications. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126863235 From jbechberger at openjdk.org Wed Jun 4 15:32:25 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 15:32:25 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v54] In-Reply-To: References: Message-ID: <8m6_JMIlbofV7pazQz-ZmfzLDOmVt-bXpmOMtQQFhpg=.121c7602-81c0-4a8a-81ea-dc753bd4ca87@github.com> > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Improve create_timer_for_thread ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/45f915b4..8f237898 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=53 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=52-53 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From apangin at openjdk.org Wed Jun 4 15:32:26 2025 From: apangin at openjdk.org (Andrei Pangin) Date: Wed, 4 Jun 2025 15:32:26 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 15:16:16 GMT, Johannes Bechberger wrote: >> But I can start using the passed-in parameter `timerid` directly, which should make the code less confusing. > > I pushed the modifications. Simply set `sival_ptr` to `NULL`, the value is never used. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126880196 From jbechberger at openjdk.org Wed Jun 4 15:32:26 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 15:32:26 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 15:23:55 GMT, Andrei Pangin wrote: >> I pushed the modifications. > > Simply set `sival_ptr` to `NULL`, the value is never used. You're right, thanks. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126886264 From shade at openjdk.org Wed Jun 4 15:32:26 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Wed, 4 Jun 2025 15:32:26 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 12:56:22 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Fix build Some more cosmetics/nits. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 264: > 262: } > 263: timer_delete(*timer); > 264: tl->unset_cpu_timer(); Should this deletion be right in `unset_cpu_timer`? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 729: > 727: #else > 728: > 729: static bool _showed_warning = false; `_displayed_warning`? Actually, I think you can move this straight into `warn()` body. src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 250: > 248: } > 249: > 250: Unnecessary? src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 582: > 580: } > 581: > 582: bool JfrThreadLocal::acquire_cpu_time_jfr_enqueue_lock() { This sounds like `try_acquire_cpu_time_jfr_enqueue_lock`, emphasis on `try_`. It does not actually guarantee to lock. src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 586: > 584: } > 585: > 586: bool JfrThreadLocal::try_acquire_cpu_time_jfr_dequeue_lock() { ...and this one is not `try_`, but the actual "blocking" acquire. ------------- PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2896958686 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126882197 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126868308 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126736956 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126831195 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126844713 From jbechberger at openjdk.org Wed Jun 4 15:32:26 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 15:32:26 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 14:22:05 GMT, Aleksey Shipilev wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix build > > src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 250: > >> 248: } >> 249: >> 250: > > Unnecessary? Yes ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126890693 From jbechberger at openjdk.org Wed Jun 4 15:40:06 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 15:40:06 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 15:07:32 GMT, Aleksey Shipilev wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix build > > src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 586: > >> 584: } >> 585: >> 586: bool JfrThreadLocal::try_acquire_cpu_time_jfr_dequeue_lock() { > > ...and this one is not `try_`, but the actual "blocking" acquire. But it fails if the lock state is already on `DEQUEUE`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126907622 From jbechberger at openjdk.org Wed Jun 4 15:48:31 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 15:48:31 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v55] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Improve ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/8f237898..3a486817 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=54 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=53-54 Stats: 11 lines in 4 files changed: 2 ins; 4 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From egahlin at openjdk.org Wed Jun 4 15:59:03 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 4 Jun 2025 15:59:03 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: <7i52AKYBlYgN9kWre2Nc7gUusKWjRJ3aQD8sll095xg=.c2589f2d-76c6-405a-92ab-2b33908c9cc1@github.com> References: <7i52AKYBlYgN9kWre2Nc7gUusKWjRJ3aQD8sll095xg=.c2589f2d-76c6-405a-92ab-2b33908c9cc1@github.com> Message-ID: On Wed, 4 Jun 2025 14:16:56 GMT, Alan Bateman wrote: >> Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix adjust boundary > > src/jdk.jfr/share/classes/jdk/jfr/Throttle.java line 77: > >> 75: * Specifying {@code "off"} (case-sensitive) results in all events being emitted. >> 76: * >> 77: * @return the throttle value, default {@code "off"} not {@code null} > > I think it would be clearer to drop "not null" from the return description. We have "not null" with Threshold, but not with "Period". I filed a bug to make it consistent for all JFR annotations and I can bring Throttle into the same CSR. https://bugs.openjdk.org/browse/JDK-8358602 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2126946237 From egahlin at openjdk.org Wed Jun 4 16:06:55 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 4 Jun 2025 16:06:55 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: <7i52AKYBlYgN9kWre2Nc7gUusKWjRJ3aQD8sll095xg=.c2589f2d-76c6-405a-92ab-2b33908c9cc1@github.com> References: <7i52AKYBlYgN9kWre2Nc7gUusKWjRJ3aQD8sll095xg=.c2589f2d-76c6-405a-92ab-2b33908c9cc1@github.com> Message-ID: <2s1MhHmV6w6DgtZEIQ056jvOQDG4SxfDNXgf_H31RZA=.2f0f2395-f805-41be-85bc-7cb4e1a8a0a9@github.com> On Wed, 4 Jun 2025 14:32:31 GMT, Alan Bateman wrote: >> Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: >> >> Fix adjust boundary > > src/java.base/share/classes/java/net/Socket.java line 970: > >> 968: long end = SocketReadEvent.timestamp(); >> 969: long duration = end - start; >> 970: if (SocketReadEvent.shouldThrottleCommit(duration, end)) { > > The use sites want to ask if an event should be committed. Does the word "Throttle" need to be in name as I don't think the use cases need to care about this. > > Also, just to point out that the shouldXXX method is called with the the end timestamp and duration whereas the offset/emit/commit methods are called with the start timestamp and duration. So two long timestamps and a long measure of time, easy to get it wrong somewhere. Maybe not this PR but I think would be clearer at the use sites to use start or end consistently and reduce potential for mistakes. We need some indication of which events are throttleable and looking at the mirror event may not work in some scenarios. We need to sample the endTime, because the startTime may be several minutes in the past. We could use commit(startTime, endTime, ...) and calculate the duration inside the method, but it may be confusing because the fields in the event are startTime and duration. We would also need to calculate the duration twice, both for shouldCommit and commit. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2126960704 From mgronlun at openjdk.org Wed Jun 4 17:09:08 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 17:09:08 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 14:24:04 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 330: >> >>> 328: void JfrCPUSamplerThread::stackwalk_threads_in_native() { >>> 329: ResourceMark rm; >>> 330: MutexLocker tlock(Threads_lock); >> >> What exactly are we guarding against by holding the `Threads_lock`? Seems `ThreadsListHandle` should be enough. > > You're right. The Threads_lock is required to prevent JFR from sampling through an ongoing safepoint, touching oops, which is not supported by most GCs as well as JFR evolving its global epoch (happens during safepoint) while both threads are outside the safepoint protocol. Can be optimized (later), see for example: https://github.com/openjdk/jdk/pull/25602 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127062451 From jbechberger at openjdk.org Wed Jun 4 17:22:37 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 17:22:37 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v56] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Readd lock ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/3a486817..53d3ed4a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=55 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=54-55 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 17:22:37 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 17:22:37 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: <-YJusSw4Vn4Dx_is7mRjOT6clvj3Uh5F5tcLsPIwUAk=.fda1546c-22b0-4a57-900e-2e752841b617@github.com> On Wed, 4 Jun 2025 17:04:15 GMT, Markus Gr?nlund wrote: >> You're right. > > The Threads_lock is required to prevent JFR from sampling through an ongoing safepoint, touching oops, which is not supported by most GCs as well as JFR evolving its global epoch (happens during safepoint) while both threads are outside the safepoint protocol. Can be optimized (later), see for example: https://github.com/openjdk/jdk/pull/25602 I readded the lock. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127082776 From shade at openjdk.org Wed Jun 4 17:27:08 2025 From: shade at openjdk.org (Aleksey Shipilev) Date: Wed, 4 Jun 2025 17:27:08 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v55] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 15:48:31 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Improve I admit I am leaning pretty hard on JFR folks expertise here. I agree this code passes the bar for experimental feature: it does not seem to affect non-JFR paths, does not seem to interact with JFR in obviously incorrect manner, and in itself looks more or less sensible. Please file the follow-ups to figure out the memory ordering story in `JfrCPUTimeTraceQueue`. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 640: > 638: > 639: VM_CPUTimeSamplerThreadInitializer(JfrCPUSamplerThread* sampler) : _sampler(sampler) { > 640: } Suggestion: private: JfrCPUSamplerThread* const _sampler; public: VM_CPUTimeSamplerThreadInitializer(JfrCPUSamplerThread* sampler) : _sampler(sampler) {} src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 671: > 669: > 670: VM_CPUTimeSamplerThreadTerminator(JfrCPUSamplerThread* sampler) : _sampler(sampler) { > 671: } Suggestion: private: JfrCPUSamplerThread* const _sampler; public: VM_CPUTimeSamplerThreadTerminator(JfrCPUSamplerThread* sampler) : _sampler(sampler) {} src/hotspot/share/runtime/vmOperation.hpp line 119: > 117: template(RendezvousGCThreads) \ > 118: template(CPUTimeSamplerThreadInitializer) \ > 119: template(CPUTimeSamplerThreadTerminator) \ I think these better be prefixed with `JFR`. E.g.: `JFRInitializeCPUTimeSampler` / `JFRTerminateCPUTimeSampler`? ------------- Marked as reviewed by shade (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2897511962 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127078325 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127079549 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127090498 From jbechberger at openjdk.org Wed Jun 4 17:49:27 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 17:49:27 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v57] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with three additional commits since the last revision: - Renaming of VM ops - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp Co-authored-by: Aleksey Shipil?v - Update src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp Co-authored-by: Aleksey Shipil?v ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/53d3ed4a..f3ef7908 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=56 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=55-56 Stats: 16 lines in 2 files changed: 0 ins; 2 del; 14 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 17:49:27 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 17:49:27 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v55] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 17:24:07 GMT, Aleksey Shipilev wrote: > Please file the follow-ups to figure out the memory ordering story in `JfrCPUTimeTraceQueue`. I created a preliminary issue at https://bugs.openjdk.org/browse/JDK-8358616 > src/hotspot/share/runtime/vmOperation.hpp line 119: > >> 117: template(RendezvousGCThreads) \ >> 118: template(CPUTimeSamplerThreadInitializer) \ >> 119: template(CPUTimeSamplerThreadTerminator) \ > > I think these better be prefixed with `JFR`. E.g.: `JFRInitializeCPUTimeSampler` / `JFRTerminateCPUTimeSampler`? Good point ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2940863550 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127113247 From mgronlun at openjdk.org Wed Jun 4 17:49:28 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 17:49:28 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v56] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 17:22:37 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Readd lock src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 300: > 298: if (!Atomic::cmpxchg(&_disenrolled, false, true)) { > 299: log_trace(jfr)("Disenrolling CPU thread sampler"); > 300: if (Atomic::fetch_then_and(&_signal_handler_installed, false)) { fetch_then_and with false? Must be simpler way to express this? Like Atomic::load(&_signal_handler_installed)? src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 608: > 606: void JfrCPUSamplerThread::stop_signal_handlers() { > 607: // set the stop signal bit > 608: Atomic::or_then_fetch(&_active_signal_handlers, STOP_SIGNAL_BIT, memory_order_acq_rel); Whatever was fetched is gone with the wind... ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127117357 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127119596 From jbechberger at openjdk.org Wed Jun 4 17:49:28 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 17:49:28 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v56] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 17:39:38 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Readd lock > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 300: > >> 298: if (!Atomic::cmpxchg(&_disenrolled, false, true)) { >> 299: log_trace(jfr)("Disenrolling CPU thread sampler"); >> 300: if (Atomic::fetch_then_and(&_signal_handler_installed, false)) { > > fetch_then_and with false? Must be simpler way to express this? Like Atomic::load(&_signal_handler_installed)? I also want to set it. Wanted to do a simple ::xchg, but this doesn't exist for booleans. > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 608: > >> 606: void JfrCPUSamplerThread::stop_signal_handlers() { >> 607: // set the stop signal bit >> 608: Atomic::or_then_fetch(&_active_signal_handlers, STOP_SIGNAL_BIT, memory_order_acq_rel); > > Whatever was fetched is gone with the wind... I didn't find an Atomic::or method ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127120548 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127122509 From mgronlun at openjdk.org Wed Jun 4 17:49:28 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 17:49:28 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v56] In-Reply-To: References: Message-ID: <-1_gEsqoLf4kh7TUZbIXh0n4PwcU7_IuaFMedlvMaAM=.27f3a6c4-79f6-4535-912a-9d2e69587a41@github.com> On Wed, 4 Jun 2025 17:41:46 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 300: >> >>> 298: if (!Atomic::cmpxchg(&_disenrolled, false, true)) { >>> 299: log_trace(jfr)("Disenrolling CPU thread sampler"); >>> 300: if (Atomic::fetch_then_and(&_signal_handler_installed, false)) { >> >> fetch_then_and with false? Must be simpler way to express this? Like Atomic::load(&_signal_handler_installed)? > > I also want to set it. Wanted to do a simple ::xchg, but this doesn't exist for booleans. 1 & 0 -> 0, are you setting _signal_handler_installed to false? Why? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127125344 From jbechberger at openjdk.org Wed Jun 4 17:54:50 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 17:54:50 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v58] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Improve disenroll ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/f3ef7908..db093a28 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=57 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=56-57 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 17:54:51 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 17:54:51 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v56] In-Reply-To: <-1_gEsqoLf4kh7TUZbIXh0n4PwcU7_IuaFMedlvMaAM=.27f3a6c4-79f6-4535-912a-9d2e69587a41@github.com> References: <-1_gEsqoLf4kh7TUZbIXh0n4PwcU7_IuaFMedlvMaAM=.27f3a6c4-79f6-4535-912a-9d2e69587a41@github.com> Message-ID: On Wed, 4 Jun 2025 17:44:45 GMT, Markus Gr?nlund wrote: >> I also want to set it. Wanted to do a simple ::xchg, but this doesn't exist for booleans. > > 1 & 0 -> 0, are you setting _signal_handler_installed to false? Why? You're right, it's not required. I removed it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127135816 From mgronlun at openjdk.org Wed Jun 4 18:41:14 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 18:41:14 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: On Wed, 4 Jun 2025 11:25:44 GMT, Andrei Pangin wrote: >> Is this something for a later PR? > > I'm OK with fixing this separately. Please ensure that you file a follow-up issue on this matter. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127213771 From ecki at zusammenkunft.net Wed Jun 4 18:50:47 2025 From: ecki at zusammenkunft.net (Bernd Eckenfels) Date: Wed, 4 Jun 2025 20:50:47 +0200 (CEST) Subject: Hidden startup exception, JFR Crashs with javaagents Message-ID: <20250604185047.301126660D4@dd33810.kasserver.com> Hello, While playing round with JavaAgents which emit JFR Events I could trigger a class circularity problem (Most likely my (or Copilot) fault, tips welcome). However, this report is about the fact that the actual exception is not printed and the actual error Message is very ugly: > java -XX:StartFlightRecording=filename=out.jfr,settings=single.jfc > -javaagent:.\target\agent-x-0.1.0.jar=TestApp:test .\TestApp.java OpenJDK > 64-Bit Server VM warning: Sharing is only supported for boot loader > classes because bootstrap classpath has been appended > [0.064s][error][jfr,startup] java/lang/WeakPairMap$Pair$Weak Error > occurred during initialization of VM Failure when starting JFR > on_create_vm_3 find the details here: https://github.com/ecki/jfr-agent-x (also when looking at Xlog:exceptions=error it feels like its handele multiple times) Gru? Bernd From jbechberger at openjdk.org Wed Jun 4 18:57:07 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 18:57:07 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: <3ALqkSc9a0HKOJrA6CW61v725SxX8FcLmasC8Wm4y24=.9d40a91c-a77a-442b-926a-e5785032c415@github.com> Message-ID: <0PjEBxgqHesjNBoyKSYCW6wGcS2GEqujEz79IeWl_LA=.04c24d78-dfb4-4917-bc50-59420548b854@github.com> On Wed, 4 Jun 2025 18:38:42 GMT, Markus Gr?nlund wrote: >> I'm OK with fixing this separately. > > Please ensure that you file a follow-up issue on this matter. Here it is https://bugs.openjdk.org/browse/JDK-8358619 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127234787 From pchilanomate at openjdk.org Wed Jun 4 18:57:08 2025 From: pchilanomate at openjdk.org (Patricio Chilano Mateo) Date: Wed, 4 Jun 2025 18:57:08 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: <-YJusSw4Vn4Dx_is7mRjOT6clvj3Uh5F5tcLsPIwUAk=.fda1546c-22b0-4a57-900e-2e752841b617@github.com> References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> <-YJusSw4Vn4Dx_is7mRjOT6clvj3Uh5F5tcLsPIwUAk=.fda1546c-22b0-4a57-900e-2e752841b617@github.com> Message-ID: On Wed, 4 Jun 2025 17:17:31 GMT, Johannes Bechberger wrote: >> The Threads_lock is required to prevent JFR from sampling through an ongoing safepoint, touching oops, which is not supported by most GCs as well as JFR evolving its global epoch (happens during safepoint) while both threads are outside the safepoint protocol. Can be optimized (later), see for example: https://github.com/openjdk/jdk/pull/25602 > > I readded the lock. Thanks, a comment about that would be nice. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127239230 From pchilanomate at openjdk.org Wed Jun 4 18:57:09 2025 From: pchilanomate at openjdk.org (Patricio Chilano Mateo) Date: Wed, 4 Jun 2025 18:57:09 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v50] In-Reply-To: References: <4_cKaFGWs_Wf0mcRY-lbaEn5i_DJfUoqpaNPhF8E_pw=.b82280fe-ed5b-42f0-85af-6dd15d297ba0@github.com> Message-ID: On Wed, 4 Jun 2025 14:39:47 GMT, Johannes Bechberger wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 430: >> >>> 428: void JfrCPUTimeThreadSampling::create_sampler(double rate, bool auto_adapt) { >>> 429: assert(_sampler == nullptr, "invariant"); >>> 430: _sampler = new JfrCPUSamplerThread(rate, auto_adapt); >> >> If we start a recording on an already running process we have a race here where a new thread can create and set its timer before we call init_timers() where the signal handler is installed. In that case the program will terminate with message ?Profiling timer expired" (default action for SIGPROF). It can be easily reproduced by adding a delay here and starting a recording on a simple test that just creates new threads. We need to add some extra check in create_timer_for_thread() or install the signal handler earlier. > > I created a `has_timer` flag that is checked by `create_timer_for_thread()` before creating timers and set by `init_timers`. Is this what you envisioned? Thanks, I verified that fixes the issue. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127238263 From mgronlun at openjdk.org Wed Jun 4 19:08:40 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 19:08:40 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v58] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 17:54:50 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Improve disenroll src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 396: > 394: } > 395: > 396: class SampleMonitor : public StackObj { This is a merge error. SampleMonitor is no longer used and can be deleted. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127252688 From jbechberger at openjdk.org Wed Jun 4 19:08:40 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 19:08:40 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v59] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - Fixed merge error - Add comment regarding Threads_lock ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/db093a28..b9def278 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=58 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=57-58 Stats: 19 lines in 2 files changed: 1 ins; 18 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From apangin at openjdk.org Wed Jun 4 19:15:09 2025 From: apangin at openjdk.org (Andrei Pangin) Date: Wed, 4 Jun 2025 19:15:09 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v58] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 17:54:50 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Improve disenroll src/hotspot/os/posix/signals_posix.cpp line 1511: > 1509: struct sigaction oact; > 1510: if (sigaction(sig, (struct sigaction*)nullptr, &oact) == -1) { > 1511: return nullptr; // signal not installed A comment is misleading: sigaction does not fail if a handler for the signal is not installed (i.e. the handler is SIG_IGN). src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 656: > 654: if ((prev_handler != SIG_DFL && prev_handler != SIG_IGN && prev_handler != (void*)::handle_timer_signal) || > 655: PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == (void*)-1) { > 656: log_error(jfr)("CPUTimeSample events will not be recorded: %p", prev_handler); A message with some random hex address may look cryptic. Maybe make it a bit more user-friendly? E.g. Conflicting SIGPROF handler found: %p. CPUTimeSample events will not be recorded src/hotspot/share/jfr/periodic/sampling/jfrSampleRequest.cpp line 333: > 331: } > 332: } > 333: request._sample_ticks = JfrTicks::now(); For accurate correlation with other events, timestamp of a sample should be taken as early as possible, preferably in the beginning of `JfrCPUSamplerThread::handle_timer_signal` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127222795 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127266822 PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127236706 From mgronlun at openjdk.org Wed Jun 4 19:15:10 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 19:15:10 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v59] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:08:40 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Fixed merge error > - Add comment regarding Threads_lock src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 633: > 631: > 632: void JfrCPUSamplerThread::allow_signal_handlers() { > 633: Atomic::release_store(&_active_signal_handlers, (u4)0); "allow_signal_handlers" is not the best name for this routine - it suggests that by setting _active_signal_handlers = 0, something is enabled - like an inverted Semaphore. But "signal handlers" are allowed for all W of this value, so the 0 has no bearing on enablement. Just call it "initialize_active_signal_handler_counter" or whatever. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127267710 From mgronlun at openjdk.org Wed Jun 4 19:18:08 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 19:18:08 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v58] In-Reply-To: References: Message-ID: <3MKLMJ4-eLHkm1qroOSGU2Kvi1pIYkyeZ9unRVbhHAk=.afeb3c4a-4501-4f70-82b6-f293948bc229@github.com> On Wed, 4 Jun 2025 19:11:16 GMT, Andrei Pangin wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Improve disenroll > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 656: > >> 654: if ((prev_handler != SIG_DFL && prev_handler != SIG_IGN && prev_handler != (void*)::handle_timer_signal) || >> 655: PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == (void*)-1) { >> 656: log_error(jfr)("CPUTimeSample events will not be recorded: %p", prev_handler); > > A message with some random hex address may look cryptic. > Maybe make it a bit more user-friendly? E.g. > > Conflicting SIGPROF handler found: %p. CPUTimeSample events will not be recorded Thanks Andrei. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127272864 From jbechberger at openjdk.org Wed Jun 4 19:24:11 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 19:24:11 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v58] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 18:44:23 GMT, Andrei Pangin wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Improve disenroll > > src/hotspot/os/posix/signals_posix.cpp line 1511: > >> 1509: struct sigaction oact; >> 1510: if (sigaction(sig, (struct sigaction*)nullptr, &oact) == -1) { >> 1511: return nullptr; // signal not installed > > A comment is misleading: sigaction does not fail if a handler for the signal is not installed (i.e. the handler is SIG_IGN). Good catch. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127281710 From jbechberger at openjdk.org Wed Jun 4 19:33:08 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 19:33:08 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v58] In-Reply-To: <3MKLMJ4-eLHkm1qroOSGU2Kvi1pIYkyeZ9unRVbhHAk=.afeb3c4a-4501-4f70-82b6-f293948bc229@github.com> References: <3MKLMJ4-eLHkm1qroOSGU2Kvi1pIYkyeZ9unRVbhHAk=.afeb3c4a-4501-4f70-82b6-f293948bc229@github.com> Message-ID: On Wed, 4 Jun 2025 19:15:19 GMT, Markus Gr?nlund wrote: >> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 656: >> >>> 654: if ((prev_handler != SIG_DFL && prev_handler != SIG_IGN && prev_handler != (void*)::handle_timer_signal) || >>> 655: PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == (void*)-1) { >>> 656: log_error(jfr)("CPUTimeSample events will not be recorded: %p", prev_handler); >> >> A message with some random hex address may look cryptic. >> Maybe make it a bit more user-friendly? E.g. >> >> Conflicting SIGPROF handler found: %p. CPUTimeSample events will not be recorded > > Thanks Andrei. Fixed it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127292777 From jbechberger at openjdk.org Wed Jun 4 19:33:09 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 19:33:09 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v58] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 18:53:35 GMT, Andrei Pangin wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Improve disenroll > > src/hotspot/share/jfr/periodic/sampling/jfrSampleRequest.cpp line 333: > >> 331: } >> 332: } >> 333: request._sample_ticks = JfrTicks::now(); > > For accurate correlation with other events, timestamp of a sample should be taken as early as possible, preferably in the beginning of `JfrCPUSamplerThread::handle_timer_signal` I moved it up: void JfrCPUSamplerThread::handle_timer_signal(siginfo_t* info, void* context) { JfrTicks now = JfrTicks::now(); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127294191 From jbechberger at openjdk.org Wed Jun 4 19:38:57 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 19:38:57 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v60] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Improve ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/b9def278..ab2ac459 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=59 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=58-59 Stats: 22 lines in 4 files changed: 5 ins; 1 del; 16 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From mgronlun at openjdk.org Wed Jun 4 19:38:58 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 19:38:58 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v42] In-Reply-To: References: Message-ID: <0T2FCxivdxhNus6A9_fGcXDNFDLachuVRGgJbixpU_0=.d51a569d-6f68-4dfa-a0cb-ca71c85f9286@github.com> On Tue, 3 Jun 2025 21:56:41 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Rename autoadapt > > src/hotspot/share/jfr/periodic/sampling/jfrThreadSampling.cpp line 360: > >> 358: tl->set_do_async_processing_of_cpu_time_jfr_requests(false); >> 359: if (lock) { >> 360: tl->acquire_cpu_time_jfr_dequeue_lock(); > > This is your synchronization point on return from native code, which is effectively a spinlock. This can cause problems when a large number of threads are being processed by the "do_async_processing" request call. > > We should fix this as a bug after integration (use a proper Monitor as a synchronization point). Filed: https://bugs.openjdk.org/browse/JDK-8358621 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127300632 From mgronlun at openjdk.org Wed Jun 4 19:50:08 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 19:50:08 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v60] In-Reply-To: References: Message-ID: <399lO47PUBfDUPjh-Ve1NztHstmkEF24xiJVQe3FRZI=.693af08b-3df9-4ec5-a589-a1c269bb7837@github.com> On Wed, 4 Jun 2025 19:38:57 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Improve src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 634: > 632: > 633: void JfrCPUSamplerThread::allow_signal_handlers() { > 634: Atomic::release_store(&_initialize_active_signal_handler_counter, (u4)0); I think we might be getting a bit tired. I meant the function name, not the variable name, which now looks completely bonkers :-) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127323120 From jbechberger at openjdk.org Wed Jun 4 19:55:55 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 19:55:55 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Renaming ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25302/files - new: https://git.openjdk.org/jdk/pull/25302/files/ab2ac459..b1689bdf Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=60 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25302&range=59-60 Stats: 11 lines in 1 file changed: 0 ins; 0 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/25302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25302/head:pull/25302 PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 19:55:56 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 19:55:56 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v60] In-Reply-To: <399lO47PUBfDUPjh-Ve1NztHstmkEF24xiJVQe3FRZI=.693af08b-3df9-4ec5-a589-a1c269bb7837@github.com> References: <399lO47PUBfDUPjh-Ve1NztHstmkEF24xiJVQe3FRZI=.693af08b-3df9-4ec5-a589-a1c269bb7837@github.com> Message-ID: On Wed, 4 Jun 2025 19:47:17 GMT, Markus Gr?nlund wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Improve > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 634: > >> 632: >> 633: void JfrCPUSamplerThread::allow_signal_handlers() { >> 634: Atomic::release_store(&_initialize_active_signal_handler_counter, (u4)0); > > I think we might be getting a bit tired. I meant the function name, not the variable name, which now looks completely bonkers :-) Well, I just misunderstood you :D ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127329186 From mdoerr at openjdk.org Wed Jun 4 20:48:07 2025 From: mdoerr at openjdk.org (Martin Doerr) Date: Wed, 4 Jun 2025 20:48:07 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: <8jQ9fsDS_OZA6WYBEy5Rf9WPfZaZJQB1zWB53iHt5i8=.6ebbb1cc-0c6f-4699-88cc-f93e8d9b5a82@github.com> On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming Marked as reviewed by mdoerr (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2898056841 From apangin at openjdk.org Wed Jun 4 21:22:07 2025 From: apangin at openjdk.org (Andrei Pangin) Date: Wed, 4 Jun 2025 21:22:07 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming Marked as reviewed by apangin (Author). ------------- PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2898137302 From mgronlun at openjdk.org Wed Jun 4 21:47:08 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 21:47:08 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: <-H5MPWW5BYrLTBLZIGu8PRcWUw9LxZoLpapnZaDy5ts=.295d136b-d764-4a73-b334-4fb51295a580@github.com> On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming I am waiting for the basic CI pre-tests to come back green before I approve for integration. No sweat, the cutoff is in CST :) and branching usually happens later in the day. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2941623120 From mgronlun at openjdk.org Wed Jun 4 22:02:19 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 22:02:19 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming Ship it! ------------- Marked as reviewed by mgronlun (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2898222436 From pchilanomate at openjdk.org Wed Jun 4 22:02:19 2025 From: pchilanomate at openjdk.org (Patricio Chilano Mateo) Date: Wed, 4 Jun 2025 22:02:19 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming Marked as reviewed by pchilanomate (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25302#pullrequestreview-2898222664 From jbechberger at openjdk.org Wed Jun 4 22:02:19 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 22:02:19 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming I know, but I want to get over it today(ish). ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2941671138 From mgronlun at openjdk.org Wed Jun 4 22:02:19 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 22:02:19 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 21:56:04 GMT, Johannes Bechberger wrote: > I know, but I want to get over it today(ish). Go for it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2941686873 From mgronlun at openjdk.org Wed Jun 4 22:13:14 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 22:13:14 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 22:06:51 GMT, Johannes Bechberger wrote: > So I'm just waiting for Skara? You can issue the integrate command. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2941709310 From mgronlun at openjdk.org Wed Jun 4 22:13:14 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 22:13:14 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming Well done - now take some well-deserved rest. I'll monitor the first stages of integration. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2941716415 From jbechberger at openjdk.org Wed Jun 4 22:13:17 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 22:13:17 GMT Subject: Integrated: 8342818: Implement JEP 509: JFR CPU-Time Profiling In-Reply-To: References: Message-ID: On Mon, 19 May 2025 13:02:20 GMT, Johannes Bechberger wrote: > This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). > > Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with > - ... different heap sizes > - ... different GCs > - ... different samplers (the standard JFR and the new CPU Time Sampler and both) > - ... different JFR recording durations > - ... different chunk-sizes This pull request has now been integrated. Changeset: 5b27e9c2 Author: Johannes Bechberger URL: https://git.openjdk.org/jdk/commit/5b27e9c2df8b386b38b0553d941469cd8aa65c28 Stats: 2306 lines in 41 files changed: 2166 ins; 128 del; 12 mod 8342818: Implement JEP 509: JFR CPU-Time Profiling Reviewed-by: mgronlun, mdoerr, pchilanomate, apangin, shade ------------- PR: https://git.openjdk.org/jdk/pull/25302 From jbechberger at openjdk.org Wed Jun 4 22:13:14 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 4 Jun 2025 22:13:14 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming So I'm just waiting for Skara? Thanks, good night. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2941707891 PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2941716783 From mgronlun at openjdk.org Wed Jun 4 22:47:15 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 22:47:15 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming Hope you have not got to sleep yet: jdk/jfr/jcmd/TestJcmdStartStopDefault.java fails on Linux. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2941820906 From dholmes at openjdk.org Wed Jun 4 23:57:56 2025 From: dholmes at openjdk.org (David Holmes) Date: Wed, 4 Jun 2025 23:57:56 GMT Subject: RFR: 8358628: [BACKOUT] 8342818: Implement JEP 509: JFR CPU-Time Profiling In-Reply-To: References: Message-ID: <62oqwYVSGqRO_SeQhJ7Ylhgo9Y_M6fbTDVLYSkb8cK4=.95eba6bd-99ae-41ad-86e3-51cfcf16b0cd@github.com> On Wed, 4 Jun 2025 23:38:07 GMT, Markus Gr?nlund wrote: > This reverts commit 5b27e9c2df8b386b38b0553d941469cd8aa65c28. > > There are too many strange issues appearing, memory allocation corruptions, and also some strange activation of the feature that is yet not understood. > > We should back it out as to not block other integrations while we troubleshoot. > > Thanks > Markus Marked as reviewed by dholmes (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25649#pullrequestreview-2898378246 From mgronlun at openjdk.org Wed Jun 4 23:57:56 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 4 Jun 2025 23:57:56 GMT Subject: Integrated: 8358628: [BACKOUT] 8342818: Implement JEP 509: JFR CPU-Time Profiling In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 23:38:07 GMT, Markus Gr?nlund wrote: > This reverts commit 5b27e9c2df8b386b38b0553d941469cd8aa65c28. > > There are too many strange issues appearing, memory allocation corruptions, and also some strange activation of the feature that is yet not understood. > > We should back it out as to not block other integrations while we troubleshoot. > > Thanks > Markus This pull request has now been integrated. Changeset: 9186cc73 Author: Markus Gr?nlund URL: https://git.openjdk.org/jdk/commit/9186cc7310c0cca2fca776031280f08d84e43b74 Stats: 2306 lines in 41 files changed: 128 ins; 2166 del; 12 mod 8358628: [BACKOUT] 8342818: Implement JEP 509: JFR CPU-Time Profiling Reviewed-by: pchilanomate, dholmes ------------- PR: https://git.openjdk.org/jdk/pull/25649 From smarks at openjdk.org Thu Jun 5 00:24:55 2025 From: smarks at openjdk.org (Stuart Marks) Date: Thu, 5 Jun 2025 00:24:55 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: <2s1MhHmV6w6DgtZEIQ056jvOQDG4SxfDNXgf_H31RZA=.2f0f2395-f805-41be-85bc-7cb4e1a8a0a9@github.com> References: <7i52AKYBlYgN9kWre2Nc7gUusKWjRJ3aQD8sll095xg=.c2589f2d-76c6-405a-92ab-2b33908c9cc1@github.com> <2s1MhHmV6w6DgtZEIQ056jvOQDG4SxfDNXgf_H31RZA=.2f0f2395-f805-41be-85bc-7cb4e1a8a0a9@github.com> Message-ID: On Wed, 4 Jun 2025 16:04:08 GMT, Erik Gahlin wrote: >> src/java.base/share/classes/java/net/Socket.java line 970: >> >>> 968: long end = SocketReadEvent.timestamp(); >>> 969: long duration = end - start; >>> 970: if (SocketReadEvent.shouldThrottleCommit(duration, end)) { >> >> The use sites want to ask if an event should be committed. Does the word "Throttle" need to be in name as I don't think the use cases need to care about this. >> >> Also, just to point out that the shouldXXX method is called with the the end timestamp and duration whereas the offset/emit/commit methods are called with the start timestamp and duration. So two long timestamps and a long measure of time, easy to get it wrong somewhere. Maybe not this PR but I think would be clearer at the use sites to use start or end consistently and reduce potential for mistakes. > > We need some indication of which events are throttleable and looking at the mirror event may not work in some scenarios. > > We need to sample the endTime, because the startTime may be several minutes in the past. We could use commit(startTime, endTime, ...) and calculate the duration inside the method, but it may be confusing because the fields in the event are startTime and duration. We would also need to calculate the duration twice, both for shouldCommit and commit. > > When we get value types and perhaps value events, much of the ugliness of static methods could be avoided. I think we (from both the java.base and jdk.jfr perspectives) need to keep an eye on the complexity of the use sites. The new throttling stuff requires a new local variable. By itself this isn't a big deal, but there are 12 events being updated here. In addition, each requires a start, end, and duration, and clearly duration = end - start. These are all long values, and the different calls require different long values, so sooner or later somebody is going to get this wrong. To a certain extent we can do more cleanup on the java.base side, by using things like SocketReadEvent's offer() method instead of its emit() method. Unfortunately only one site uses offer() -- NIO SocketChannelImpl -- and note that it didn't need to be updated! The other events should have something like the offer() method, which groups together the testing of shouldCommit/shouldThrottleCommit with the committing of the event. (This also should avoid recalculating the duration, but really, this is only a subtraction of two longs, so it should take only one cycle.) But note what we're doing here is constructing an internal API within java.base, between the use sites (like java.net.Socket) and the java.base-side JFR stuff (jdk.internal.event.SocketReadEvent). Maybe after things are cleaned up and consolidated here we can see if the API between jdk.internal.event and jdk.jfr can be improved. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2127716516 From dholmes at openjdk.org Thu Jun 5 01:12:14 2025 From: dholmes at openjdk.org (David Holmes) Date: Thu, 5 Jun 2025 01:12:14 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 88: > 86: return false; > 87: } > 88: } while (Atomic::cmpxchg(&_head, elementIndex, elementIndex + 1) != elementIndex); Why do we need atomic operations if we hold the enqueue lock. ?? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127755502 From jbechberger at openjdk.org Thu Jun 5 05:05:22 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Thu, 5 Jun 2025 05:05:22 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 01:09:01 GMT, David Holmes wrote: >> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: >> >> Renaming > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 88: > >> 86: return false; >> 87: } >> 88: } while (Atomic::cmpxchg(&_head, elementIndex, elementIndex + 1) != elementIndex); > > Why do we need atomic operations if we hold the enqueue lock. ?? Valid Point, I was probably over cautious. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127957148 From jbechberger at openjdk.org Thu Jun 5 05:13:15 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Thu, 5 Jun 2025 05:13:15 GMT Subject: RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v61] In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 19:55:55 GMT, Johannes Bechberger wrote: >> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509). >> >> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with >> - ... different heap sizes >> - ... different GCs >> - ... different samplers (the standard JFR and the new CPU Time Sampler and both) >> - ... different JFR recording durations >> - ... different chunk-sizes > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Renaming I'm on it, darn. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25302#issuecomment-2942770368 From vyazici at openjdk.org Thu Jun 5 05:51:55 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Thu, 5 Jun 2025 05:51:55 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 18:08:39 GMT, Chris Plummer wrote: > That's not going to be sufficient. The nsk tests are not being run until tier5. @plummercj, I've attached the `tier3,4,5` run report to the ticket, would you mind reviewing them, please? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2942851679 From egahlin at openjdk.org Thu Jun 5 08:10:42 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 08:10:42 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v4] In-Reply-To: References: Message-ID: <72MCuwD8Jd9igYMm5C4yZyxh-8xLnnKePImAaep3p2U=.49745a1b-7f46-4a07-a150-4c243683068f@github.com> > Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision: - Merge remote-tracking branch 'upstream/master' into throttle-mania-3 - Fix adjust boundary - Some reviewer feedback - Consistent annotation - Fix typos - Fix whitespace - Initial ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25559/files - new: https://git.openjdk.org/jdk/pull/25559/files/7fa2db19..59278ca8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=02-03 Stats: 26802 lines in 553 files changed: 20626 ins; 2170 del; 4006 mod Patch: https://git.openjdk.org/jdk/pull/25559.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25559/head:pull/25559 PR: https://git.openjdk.org/jdk/pull/25559 From egahlin at openjdk.org Thu Jun 5 08:13:21 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 08:13:21 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v5] In-Reply-To: References: Message-ID: <8opPh4lTfGQBzlleDOuxmi3QyhF3M9M7U7MpIoFWUCE=.a14d1385-e759-4fa5-8733-5ebb162d20a7@github.com> > Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision: - Merge remote-tracking branch 'upstream/master' into throttle-mania-3 - Merge remote-tracking branch 'upstream/master' into throttle-mania-3 - Fix adjust boundary - Some reviewer feedback - Consistent annotation - Fix typos - Fix whitespace - Initial ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25559/files - new: https://git.openjdk.org/jdk/pull/25559/files/59278ca8..535d458a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=03-04 Stats: 2776 lines in 58 files changed: 477 ins; 2217 del; 82 mod Patch: https://git.openjdk.org/jdk/pull/25559.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25559/head:pull/25559 PR: https://git.openjdk.org/jdk/pull/25559 From egahlin at openjdk.org Thu Jun 5 08:40:44 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 08:40:44 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v6] In-Reply-To: References: Message-ID: <0zy-Tz-VxzBeZiq5EE1iHvG-Z5pmhyByw6H3aCD2Mm4=.217bcfc4-f471-48cc-a003-22bcda24669d@github.com> > Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision: - Merge remote-tracking branch 'upstream/master' into throttle-mania-3 - Merge remote-tracking branch 'upstream/master' into throttle-mania-3 - Merge remote-tracking branch 'upstream/master' into throttle-mania-3 - Fix adjust boundary - Some reviewer feedback - Consistent annotation - Fix typos - Fix whitespace - Initial ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25559/files - new: https://git.openjdk.org/jdk/pull/25559/files/535d458a..8259ff41 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=04-05 Stats: 2319 lines in 41 files changed: 2179 ins; 128 del; 12 mod Patch: https://git.openjdk.org/jdk/pull/25559.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25559/head:pull/25559 PR: https://git.openjdk.org/jdk/pull/25559 From aturbanov at openjdk.org Thu Jun 5 09:02:57 2025 From: aturbanov at openjdk.org (Andrey Turbanov) Date: Thu, 5 Jun 2025 09:02:57 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v6] In-Reply-To: <0zy-Tz-VxzBeZiq5EE1iHvG-Z5pmhyByw6H3aCD2Mm4=.217bcfc4-f471-48cc-a003-22bcda24669d@github.com> References: <0zy-Tz-VxzBeZiq5EE1iHvG-Z5pmhyByw6H3aCD2Mm4=.217bcfc4-f471-48cc-a003-22bcda24669d@github.com> Message-ID: On Thu, 5 Jun 2025 08:40:44 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision: > > - Merge remote-tracking branch 'upstream/master' into throttle-mania-3 > - Merge remote-tracking branch 'upstream/master' into throttle-mania-3 > - Merge remote-tracking branch 'upstream/master' into throttle-mania-3 > - Fix adjust boundary > - Some reviewer feedback > - Consistent annotation > - Fix typos > - Fix whitespace > - Initial src/java.base/share/classes/java/io/RandomAccessFile.java line 594: > 592: } finally { > 593: long end = FileWriteEvent.timestamp(); > 594: long duration = end - start; Suggestion: long duration = end - start; src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 65: > 63: public final class EventInstrumentation { > 64: public static final long MASK_THROTTLE = 1 << 62; > 65: public static final long MASK_THROTTLE_CHECK = 1 << 63; Let's align Suggestion: public static final long MASK_THROTTLE = 1 << 62; public static final long MASK_THROTTLE_CHECK = 1 << 63; src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line 593: > 591: if (throttled) { > 592: codeBuilder.aload(0); > 593: getfield(codeBuilder, eventClassDesc, ImplicitFields.FIELD_DURATION); Suggestion: getfield(codeBuilder, eventClassDesc, ImplicitFields.FIELD_DURATION); test/jdk/jdk/jfr/api/recording/settings/TestSettingsAvailability.java line 93: > 91: testSetting(EventNames.JVMInformation, "enabled", "period"); > 92: testSetting(EventNames.FileRead, "enabled", "threshold", "stackTrace", "throttle"); > 93: testSetting(EventNames.FileWrite, "enabled", "threshold","stackTrace", "throttle"); Suggestion: testSetting(EventNames.FileWrite, "enabled", "threshold", "stackTrace", "throttle"); ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128322876 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128321445 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128322474 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128323708 From egahlin at openjdk.org Thu Jun 5 09:26:13 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 09:26:13 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v7] In-Reply-To: References: Message-ID: > Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: Use offer method ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25559/files - new: https://git.openjdk.org/jdk/pull/25559/files/8259ff41..7f26f172 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=05-06 Stats: 570 lines in 10 files changed: 455 ins; 88 del; 27 mod Patch: https://git.openjdk.org/jdk/pull/25559.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25559/head:pull/25559 PR: https://git.openjdk.org/jdk/pull/25559 From alanb at openjdk.org Thu Jun 5 09:28:52 2025 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 5 Jun 2025 09:28:52 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v7] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 09:26:13 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Use offer method t.txt line 1: > 1: diff --git a/src/java.base/share/classes/java/io/FileInputStream.java b/src/java.base/share/classes/java/io/FileInputStream.java t.txt added by mistake. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128388583 From egahlin at openjdk.org Thu Jun 5 09:41:10 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 09:41:10 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v8] In-Reply-To: References: Message-ID: > Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request incrementally with two additional commits since the last revision: - Remove the mistakenly added file. - Fix whitespace ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25559/files - new: https://git.openjdk.org/jdk/pull/25559/files/7f26f172..8beb194a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=06-07 Stats: 414 lines in 3 files changed: 0 ins; 410 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/25559.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25559/head:pull/25559 PR: https://git.openjdk.org/jdk/pull/25559 From alanb at openjdk.org Thu Jun 5 09:41:10 2025 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 5 Jun 2025 09:41:10 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v8] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 09:37:45 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with two additional commits since the last revision: > > - Remove the mistakenly added file. > - Fix whitespace src/java.base/share/classes/java/io/FileInputStream.java line 219: > 217: } > 218: } finally { > 219: FileReadEvent.offer(start, path, bytesRead); Thanks for this update, this looks much better. It think would be better again if `start = FileReadEvent.timestamp()` is moved to before the try. src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java line 328: > 326: } finally { > 327: long end = FileReadEvent.timestamp(); > 328: FileReadEvent.offer(start, path, bytesRead); I don't think "end" is needed now. src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java line 382: > 380: FileWriteEvent.offer(start, path, bytes); > 381: } > 382: return bytes; The method returns the number of bytes written and traceImplRead uses bytesRead for the number of bytes read. So I think better to leave it as bytesWritten. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128400058 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128401565 PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128406420 From egahlin at openjdk.org Thu Jun 5 09:41:10 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 09:41:10 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: References: <7i52AKYBlYgN9kWre2Nc7gUusKWjRJ3aQD8sll095xg=.c2589f2d-76c6-405a-92ab-2b33908c9cc1@github.com> <2s1MhHmV6w6DgtZEIQ056jvOQDG4SxfDNXgf_H31RZA=.2f0f2395-f805-41be-85bc-7cb4e1a8a0a9@github.com> Message-ID: On Thu, 5 Jun 2025 00:21:45 GMT, Stuart Marks wrote: >> We need some indication of which events are throttleable and looking at the mirror event may not work in some scenarios. >> >> We need to sample the endTime, because the startTime may be several minutes in the past. We could use commit(startTime, endTime, ...) and calculate the duration inside the method, but it may be confusing because the fields in the event are startTime and duration. We would also need to calculate the duration twice, both for shouldCommit and commit. >> >> When we get value types and perhaps value events, much of the ugliness of static methods could be avoided. > > I think we (from both the java.base and jdk.jfr perspectives) need to keep an eye on the complexity of the use sites. The new throttling stuff requires a new local variable. By itself this isn't a big deal, but there are 12 events being updated here. In addition, each requires a start, end, and duration, and clearly duration = end - start. These are all long values, and the different calls require different long values, so sooner or later somebody is going to get this wrong. > > To a certain extent we can do more cleanup on the java.base side, by using things like SocketReadEvent's offer() method instead of its emit() method. Unfortunately only one site uses offer() -- NIO SocketChannelImpl -- and note that it didn't need to be updated! The other events should have something like the offer() method, which groups together the testing of shouldCommit/shouldThrottleCommit with the committing of the event. (This also should avoid recalculating the duration, but really, this is only a subtraction of two longs, so it should take only one cycle.) > > But note what we're doing here is constructing an internal API within java.base, between the use sites (like java.net.Socket) and the java.base-side JFR stuff (jdk.internal.event.SocketReadEvent). Maybe after things are cleaned up and consolidated here we can see if the API between jdk.internal.event and jdk.jfr can be improved. I updated FileRead and FileWrite to use an offer method like SocketRead and SocketWrite, reducing boilerplate. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128398824 From alanb at openjdk.org Thu Jun 5 09:41:10 2025 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 5 Jun 2025 09:41:10 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v3] In-Reply-To: References: <7i52AKYBlYgN9kWre2Nc7gUusKWjRJ3aQD8sll095xg=.c2589f2d-76c6-405a-92ab-2b33908c9cc1@github.com> <2s1MhHmV6w6DgtZEIQ056jvOQDG4SxfDNXgf_H31RZA=.2f0f2395-f805-41be-85bc-7cb4e1a8a0a9@github.com> Message-ID: On Thu, 5 Jun 2025 09:31:39 GMT, Erik Gahlin wrote: >> I think we (from both the java.base and jdk.jfr perspectives) need to keep an eye on the complexity of the use sites. The new throttling stuff requires a new local variable. By itself this isn't a big deal, but there are 12 events being updated here. In addition, each requires a start, end, and duration, and clearly duration = end - start. These are all long values, and the different calls require different long values, so sooner or later somebody is going to get this wrong. >> >> To a certain extent we can do more cleanup on the java.base side, by using things like SocketReadEvent's offer() method instead of its emit() method. Unfortunately only one site uses offer() -- NIO SocketChannelImpl -- and note that it didn't need to be updated! The other events should have something like the offer() method, which groups together the testing of shouldCommit/shouldThrottleCommit with the committing of the event. (This also should avoid recalculating the duration, but really, this is only a subtraction of two longs, so it should take only one cycle.) >> >> But note what we're doing here is constructing an internal API within java.base, between the use sites (like java.net.Socket) and the java.base-side JFR stuff (jdk.internal.event.SocketReadEvent). Maybe after things are cleaned up and consolidated here we can see if the API between jdk.internal.event and jdk.jfr can be improved. > > I updated FileRead and FileWrite to use an offer method like SocketRead and SocketWrite, reducing boilerplate. Thank you for this update, it looks much better now. I chatted briefly with Stuart yesterday and mostly agreed there would need to be some follow-up cleanup of the use-sites. Doing in now is good as it addresses our grumblings. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128410969 From alanb at openjdk.org Thu Jun 5 09:48:57 2025 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 5 Jun 2025 09:48:57 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v8] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 09:41:10 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with two additional commits since the last revision: > > - Remove the mistakenly added file. > - Fix whitespace src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java line 1252: > 1250: } finally { > 1251: long bytes = bytesWritten > 0 ? bytesWritten : 0; > 1252: FileWriteEvent.offer(start, path, bytes); The number of bytes written is >=0, it can't be < 0, so I'm not sure why the existing code checks bytesWritten > 0. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128429546 From alanb at openjdk.org Thu Jun 5 09:54:52 2025 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 5 Jun 2025 09:54:52 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v8] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 09:41:10 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with two additional commits since the last revision: > > - Remove the mistakenly added file. > - Fix whitespace src/jdk.jfr/share/conf/jfr/default.jfc line 845: > 843: true > 844: true > 845: 100/s What was used to proposed 100/s as the default and 300/s in profile.jfc? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128442250 From egahlin at openjdk.org Thu Jun 5 10:10:41 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 10:10:41 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v9] In-Reply-To: References: Message-ID: > Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: Move the timestamp to before the try block, change bytes to bytesWritten and remove unnecessary code ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25559/files - new: https://git.openjdk.org/jdk/pull/25559/files/8beb194a..45adc081 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25559&range=07-08 Stats: 35 lines in 4 files changed: 0 ins; 16 del; 19 mod Patch: https://git.openjdk.org/jdk/pull/25559.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25559/head:pull/25559 PR: https://git.openjdk.org/jdk/pull/25559 From alanb at openjdk.org Thu Jun 5 10:37:53 2025 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 5 Jun 2025 10:37:53 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v9] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 10:10:41 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Move the timestamp to before the try block, change bytes to bytesWritten and remove unnecessary code src/java.base/share/classes/java/lang/Throwable.java line 124: > 122: * exceptions should be traced by JFR. > 123: */ > 124: static boolean jfrTracing; Are you sure this is okay? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128525269 From egahlin at openjdk.org Thu Jun 5 10:51:52 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 10:51:52 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v8] In-Reply-To: References: Message-ID: <-LaEF0pmA3xzw9HcVJlYD91h2ek-nUAfB3BQ1NG--Is=.381146ec-7a22-4fc1-aa2c-032726bc134b@github.com> On Thu, 5 Jun 2025 09:51:51 GMT, Alan Bateman wrote: >> Erik Gahlin has updated the pull request incrementally with two additional commits since the last revision: >> >> - Remove the mistakenly added file. >> - Fix whitespace > > src/jdk.jfr/share/conf/jfr/default.jfc line 845: > >> 843: true >> 844: true >> 845: 100/s > > What was used to propose 100/s as the default and 300/s in profile.jfc? Just curious if there was a benchmark or test to see the overhead. It's hard to benchmark since it depends on the application, but we have used 150 events / second for the Object Allocation Sample event without complaints. If you divide one second by 20 ms, the previous threshold, you end up with at most 50 events / second per thread. That said, I think few applications actually have socket read/write around 20-25 ms, so I don't think we should draw too many conclusions from that. Another way of thinking about it is that the cost of walking maximum 64 stack frames is roughly 5000 ns, so we end up with 100 * 5000 = 500 000 ns or 0.05% of CPU usage. There is also the cost of sampling, and that's why I put in the 1 ms threshold, which puts an upper bound of 1000 sampling attempts per thread. For profile, I used the same value as Object Allocation Sample. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128549389 From alanb at openjdk.org Thu Jun 5 11:07:56 2025 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 5 Jun 2025 11:07:56 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v9] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 10:10:41 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Move the timestamp to before the try block, change bytes to bytesWritten and remove unnecessary code The usages are much cleaner in the update so I think this all good. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25559#pullrequestreview-2899855765 From egahlin at openjdk.org Thu Jun 5 11:10:54 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 11:10:54 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v9] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 10:35:10 GMT, Alan Bateman wrote: >> Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: >> >> Move the timestamp to before the try block, change bytes to bytesWritten and remove unnecessary code > > src/java.base/share/classes/java/lang/Throwable.java line 124: > >> 122: * exceptions should be traced by JFR. >> 123: */ >> 124: static boolean jfrTracing; > > Are you sure this is okay? When JFR starts the JVM is brought to safepoint so the whole heap becomes visible. We have used it for socket events without any issues. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25559#discussion_r2128580995 From egahlin at openjdk.org Thu Jun 5 11:20:52 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 11:20:52 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v9] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 10:10:41 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Move the timestamp to before the try block, change bytes to bytesWritten and remove unnecessary code Thanks for the reviews, the offer methods turned out nicely. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25559#issuecomment-2943787262 From mgronlun at openjdk.org Thu Jun 5 11:35:53 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Thu, 5 Jun 2025 11:35:53 GMT Subject: RFR: 8351594: JFR: Rate-limited sampling of Java events [v9] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 10:10:41 GMT, Erik Gahlin wrote: >> Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). >> >> Testing: test/jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Move the timestamp to before the try block, change bytes to bytesWritten and remove unnecessary code Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25559#pullrequestreview-2899934064 From egahlin at openjdk.org Thu Jun 5 11:39:01 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 11:39:01 GMT Subject: Integrated: 8351594: JFR: Rate-limited sampling of Java events In-Reply-To: References: Message-ID: On Fri, 30 May 2025 22:30:25 GMT, Erik Gahlin wrote: > Could I have review of an enhancement that adds rate-limited sampling to Java events, including five events in the JDK (SocketRead, SocketWrite, FileRead, FileWrite, and JavaExceptionThrow). > > Testing: test/jdk/jdk/jfr > > Thanks > Erik This pull request has now been integrated. Changeset: eb770a06 Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/eb770a060ad86d69b38df7d11622e9e25a528e1d Stats: 1346 lines in 37 files changed: 1056 ins; 174 del; 116 mod 8351594: JFR: Rate-limited sampling of Java events Reviewed-by: mgronlun, alanb ------------- PR: https://git.openjdk.org/jdk/pull/25559 From egahlin at openjdk.org Thu Jun 5 11:45:00 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 5 Jun 2025 11:45:00 GMT Subject: Integrated: 8358590: JFR: Include min and max in MethodTiming event In-Reply-To: References: Message-ID: On Wed, 4 Jun 2025 11:36:34 GMT, Erik Gahlin wrote: > Could I have review of this PR that adds minimum and maximum to the MethodTimingEvent. > > Testing: jdk/jdk/jfr > > Thanks > Erik This pull request has now been integrated. Changeset: 6cdfd36a Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/6cdfd36ac80ad889ddbcfc702115b750a32d9645 Stats: 49 lines in 6 files changed: 42 ins; 0 del; 7 mod 8358590: JFR: Include min and max in MethodTiming event Reviewed-by: mgronlun ------------- PR: https://git.openjdk.org/jdk/pull/25637 From cjplummer at openjdk.org Thu Jun 5 15:16:54 2025 From: cjplummer at openjdk.org (Chris Plummer) Date: Thu, 5 Jun 2025 15:16:54 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Thu, 5 Jun 2025 05:49:18 GMT, Volkan Yazici wrote: > > That's not going to be sufficient. The nsk tests are not being run until tier5. > > @plummercj, I've attached the `tier3,4,5` run report to the ticket, would you mind reviewing them, please? Looks good. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2944947156 From sspitsyn at openjdk.org Thu Jun 5 17:05:51 2025 From: sspitsyn at openjdk.org (Serguei Spitsyn) Date: Thu, 5 Jun 2025 17:05:51 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 18:39:33 GMT, Volkan Yazici wrote: >> Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`. >> >> `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357993 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to Hotspot. > > Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: > > Provide fallback for `stdin.encoding` Looks okay to me. ------------- Marked as reviewed by sspitsyn (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25542#pullrequestreview-2901163257 From vyazici at openjdk.org Fri Jun 6 06:55:58 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Fri, 6 Jun 2025 06:55:58 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 18:39:33 GMT, Volkan Yazici wrote: >> Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`. >> >> `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357993 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to Hotspot. > > Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: > > Provide fallback for `stdin.encoding` @AlanBateman @plummercj @sspitsyn Thanks so much for taking time to review the changes, much appreciated. ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2948280027 From vyazici at openjdk.org Fri Jun 6 06:55:59 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Fri, 6 Jun 2025 06:55:59 GMT Subject: Integrated: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] In-Reply-To: References: Message-ID: On Fri, 30 May 2025 10:50:57 GMT, Volkan Yazici wrote: > Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`. > > `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357993 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to Hotspot. This pull request has now been integrated. Changeset: bb2611ad Author: Volkan Yazici URL: https://git.openjdk.org/jdk/commit/bb2611ad43a2feaebc2246fdbac2179a40115d67 Stats: 13 lines in 4 files changed: 4 ins; 0 del; 9 mod 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] Reviewed-by: cjplummer, sspitsyn ------------- PR: https://git.openjdk.org/jdk/pull/25542 From alanb at openjdk.org Fri Jun 6 07:25:04 2025 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jun 2025 07:25:04 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Fri, 6 Jun 2025 06:52:19 GMT, Volkan Yazici wrote: > @AlanBateman @plummercj @sspitsyn Thanks so much for taking time to review the changes, much appreciated. Okay, but I'm still puzzled as to why the tests were changed as they don't ready from the console. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2948340133 From vyazici at openjdk.org Fri Jun 6 08:09:00 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Fri, 6 Jun 2025 08:09:00 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Fri, 6 Jun 2025 07:21:59 GMT, Alan Bateman wrote: > Okay, but I'm still puzzled as to why the tests were changed as they don't ready from the console. @AlanBateman, I only skipped the practice of passing `stdin.encoding` to `InputStreamReader`/`Scanner` ctors whenever it is obvious that the `System.in` referred there is not the console. Do you imply I was mistaken while assessing `BindServer` and `attach010Agent00`? If so, which ones, and [to learn what I missed] why? I can create a follow-up ticket+PR to amend them. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2948435515 From alanb at openjdk.org Fri Jun 6 08:44:56 2025 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 6 Jun 2025 08:44:56 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Fri, 6 Jun 2025 07:21:59 GMT, Alan Bateman wrote: >> @AlanBateman @plummercj @sspitsyn Thanks so much for taking time to review the changes, much appreciated. ? > >> @AlanBateman @plummercj @sspitsyn Thanks so much for taking time to review the changes, much appreciated. > > Okay, but I'm still puzzled as to why the tests were changed as they don't ready from the console. > @AlanBateman, I only skipped the practice of passing `stdin.encoding` to `InputStreamReader`/`Scanner` ctors whenever it is obvious that the `System.in` referred there is not the console. Do you imply I was mistaken while assessing `BindServer` and `attach010Agent00`? If so, which ones, and [to learn what I missed] why? I can create a follow-up ticket+PR to amend them. Tests are automated and very rare to have tests read from an interactive console. A small number of test uses "expect" for testing interactive input. There might be tests that have stdin redirected from a file or something else. For multi VM tests (very common in the test suite) then you typically see the parent process using Process/ProcessBuilder and starting a child VM with its standard streams connected to the parent, meaning reading from System.in will read from a pipe connected to the parent. Some tests do inherit but I doubt we have any tests that inherit and also read from an interactive console. So my point is that we probably don't need to jump on all tests that use System.in. The tests that do read from System.in probably need closer examination to see if they are reading from a pipe or something else. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2948526535 From vyazici at openjdk.org Fri Jun 6 11:48:54 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Fri, 6 Jun 2025 11:48:54 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Fri, 6 Jun 2025 08:42:40 GMT, Alan Bateman wrote: > For multi VM tests (very common in the test suite) then you typically see the parent process using Process/ProcessBuilder and starting a child VM with its standard streams connected to the parent, meaning reading from System.in will read from a pipe connected to the parent. Some tests do inherit but I doubt we have any tests that inherit and also read from an interactive console. > > So my point is that we probably don't need to jump on all tests that use System.in. _I think_ ? I see your point, and I agree with it. I've dropped several of my earlier changes from the abandoned parent #25368 ? this applies to all subsequent tickets: #25544 (core), #25541 (tools), and this one. When the subject code is called in a `Process`, or the stream is obtained from a `URL` or a `ClassLoader`, ..., when it is _"obvious"_ that the stream doesn't refer to the console, I've skipped the `stdin.encoding` refactoring. That said, _"obvious"_ is very subjective and I might have misjudged certain usages. > The tests that do read from System.in probably need closer examination to see if they are reading from a pipe or something else. In all `stdin.encoding` PRs ? #25544 (core), #25541 (tools), and this one ? I've examined usages before introducing the changes. I did my best, but I cannot claim it was exhaustive. That said, if it requires a significant effort to deduce that the console is not involved in a `System.in` usage, I'd prefer to include the `stdin.encoding` best-practice. There is a considerable likelihood that a later change could inadvertently violate that subtle assumption. @AlanBateman, if you think a particular change needs closer examination or needs to be reverted, please say so. I'd be more than happy to carry out that task. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2948996963 From cjplummer at openjdk.org Fri Jun 6 19:28:55 2025 From: cjplummer at openjdk.org (Chris Plummer) Date: Fri, 6 Jun 2025 19:28:55 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Mon, 2 Jun 2025 18:39:33 GMT, Volkan Yazici wrote: >> Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`. >> >> `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357993 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to Hotspot. > > Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: > > Provide fallback for `stdin.encoding` BindServer.java is not used. It can be removed. The changes in attach010Agent00.java are unnecessary because System.in has been set to read from a file: 35 private static final String inStreamFileName = "AttachOnDemand.attach010.in"; 60 FileInputStream newInputStream = new FileInputStream(inStreamFileName); 61 System.setIn(newInputStream); ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2950447745 From vyazici at openjdk.org Sun Jun 8 21:12:59 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Sun, 8 Jun 2025 21:12:59 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Fri, 6 Jun 2025 19:26:32 GMT, Chris Plummer wrote: >> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: >> >> Provide fallback for `stdin.encoding` > > BindServer.java is not used. It can be removed. > > The changes in attach010Agent00.java are unnecessary because System.in has been set to read from a file: > > 35 private static final String inStreamFileName = "AttachOnDemand.attach010.in"; > 60 FileInputStream newInputStream = new FileInputStream(inStreamFileName); > 61 System.setIn(newInputStream); @plummercj, shall I create a ticket+PR to 1. remove `BindServer.java`, and 2. revert changes to `attach010Agent00.java`? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2954277726 From cjplummer at openjdk.org Mon Jun 9 15:48:08 2025 From: cjplummer at openjdk.org (Chris Plummer) Date: Mon, 9 Jun 2025 15:48:08 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: On Fri, 6 Jun 2025 19:26:32 GMT, Chris Plummer wrote: >> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: >> >> Provide fallback for `stdin.encoding` > > BindServer.java is not used. It can be removed. > > The changes in attach010Agent00.java are unnecessary because System.in has been set to read from a file: > > 35 private static final String inStreamFileName = "AttachOnDemand.attach010.in"; > 60 FileInputStream newInputStream = new FileInputStream(inStreamFileName); > 61 System.setIn(newInputStream); > @plummercj, shall I create a ticket+PR to > > 1. remove `BindServer.java`, and > > 2. revert changes to `attach010Agent00.java`? Yes. It might be better to make them 2 PRs. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2956182139 From egahlin at openjdk.org Tue Jun 10 13:16:07 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Tue, 10 Jun 2025 13:16:07 GMT Subject: RFR: 8358602: JFR: Annotations in jdk.jfr package should not use "not null" in specification Message-ID: Could I have review of PR that fixes the specification / documentation for annotations in the jdk.jfr package. Testing: tier1 + jdk/jdk/jfr ------------- Commit messages: - Initial Changes: https://git.openjdk.org/jdk/pull/25723/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25723&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8358602 Stats: 15 lines in 8 files changed: 0 ins; 0 del; 15 mod Patch: https://git.openjdk.org/jdk/pull/25723.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25723/head:pull/25723 PR: https://git.openjdk.org/jdk/pull/25723 From mgronlun at openjdk.org Tue Jun 10 17:01:28 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Tue, 10 Jun 2025 17:01:28 GMT Subject: RFR: 8358602: JFR: Annotations in jdk.jfr package should not use "not null" in specification In-Reply-To: References: Message-ID: On Tue, 10 Jun 2025 12:48:39 GMT, Erik Gahlin wrote: > Could I have review of PR that fixes the specification / documentation for annotations in the jdk.jfr package. > > Testing: tier1 + jdk/jdk/jfr Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25723#pullrequestreview-2914382380 From vyazici at openjdk.org Tue Jun 10 20:34:35 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Tue, 10 Jun 2025 20:34:35 GMT Subject: RFR: 8357993: Use "stdin.encoding" for reading System.in with InputStreamReader/Scanner [hotspot] [v2] In-Reply-To: References: Message-ID: <2q9j9ODae3SFNCHdS9fpasGuXrm3wWGXip_Fk1NNvIk=.ba677f20-2660-4d93-91e7-6debc0ad4cfd@github.com> On Mon, 2 Jun 2025 18:39:33 GMT, Volkan Yazici wrote: >> Passes the `Charset` read from the `stdin.encoding` system property while creating `InputStreamReader` or `Scanner` instances for `System.in`. >> >> `stdin.encoding` is a recently added property for Java 25 in [JDK-8350703](https://bugs.openjdk.org/browse/JDK-8350703). Employing it throughout the entire code base is addressed by the parent ticket [JDK-8356893](https://bugs.openjdk.org/browse/JDK-8356893). JDK-8357993 this PR is addressing is a sub-task of JDK-8356893 and is concerned with only areas related to Hotspot. > > Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision: > > Provide fallback for `stdin.encoding` I've created - [8359167](https://bugs.openjdk.org/browse/JDK-8359167): Remove unused test/hotspot/jtreg/vmTestbase/nsk/share/jpda/BindServer.java - [8359168](https://bugs.openjdk.org/browse/JDK-8359168): Revert stdin.encoding usage in test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach010/attach010Agent00.java Used `hotspot` and `test` as `Component/s` and `Subcomponent`, respectively ? hope that is okay. Feel free to update the tickets as you see fit. I will try to pick them up sometime this week. @plummercj, @AlanBateman, thank you for your assistance and patience. ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25542#issuecomment-2960509836 From mdoerr at openjdk.org Wed Jun 11 10:18:10 2025 From: mdoerr at openjdk.org (Martin Doerr) Date: Wed, 11 Jun 2025 10:18:10 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently In-Reply-To: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: On Wed, 11 Jun 2025 10:10:25 GMT, Johannes Bechberger wrote: > I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. Thanks! 25% should hopefully avoid intermittent failures. ------------- Marked as reviewed by mdoerr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25745#pullrequestreview-2916508242 From jbechberger at openjdk.org Wed Jun 11 10:18:10 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 11 Jun 2025 10:18:10 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently In-Reply-To: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: On Wed, 11 Jun 2025 10:10:25 GMT, Johannes Bechberger wrote: > I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. Although one could say that I should not have symmetric bounds, I expect to get fewer samples; if I get significantly more, then I probably have a bug. Maybe I should therefore use `0.75 < rate < 1.1`? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25745#issuecomment-2962079022 From jbechberger at openjdk.org Wed Jun 11 10:18:10 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 11 Jun 2025 10:18:10 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently Message-ID: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. ------------- Commit messages: - 8359135: New test TestCPUTimeSampleThrottling fails intermittently Changes: https://git.openjdk.org/jdk/pull/25745/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25745&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359135 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25745.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25745/head:pull/25745 PR: https://git.openjdk.org/jdk/pull/25745 From jbechberger at openjdk.org Wed Jun 11 11:11:50 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 11 Jun 2025 11:11:50 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v2] In-Reply-To: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: > I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: - Remove debug code - Make upper-bound narrower ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25745/files - new: https://git.openjdk.org/jdk/pull/25745/files/7f9fda63..57a3f447 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25745&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25745&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25745.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25745/head:pull/25745 PR: https://git.openjdk.org/jdk/pull/25745 From mdoerr at openjdk.org Wed Jun 11 11:44:29 2025 From: mdoerr at openjdk.org (Martin Doerr) Date: Wed, 11 Jun 2025 11:44:29 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v2] In-Reply-To: References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: <9qL89mmtHWhset08ZwM2zaEJmx5I5nTlj7eqcFSs4-E=.ecf9180b-88eb-41c1-9098-76d2a87086f1@github.com> On Wed, 11 Jun 2025 11:11:50 GMT, Johannes Bechberger wrote: >> I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Remove debug code > - Make upper-bound narrower Looks good and trivial. ------------- Marked as reviewed by mdoerr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25745#pullrequestreview-2916793102 From egahlin at openjdk.org Wed Jun 11 14:13:29 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 11 Jun 2025 14:13:29 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v2] In-Reply-To: References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: On Wed, 11 Jun 2025 11:11:50 GMT, Johannes Bechberger wrote: >> I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Remove debug code > - Make upper-bound narrower My experience with tests that make a recording and check some time-related bounds is that they fail sooner or later. The hardware is slow, a GC happens etc. Maybe you could use an event stream and let it run until you hit, let's say, 50-150 samples / second? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25745#issuecomment-2962997568 From jbechberger at openjdk.org Wed Jun 11 14:59:29 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 11 Jun 2025 14:59:29 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v2] In-Reply-To: References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: On Wed, 11 Jun 2025 11:11:50 GMT, Johannes Bechberger wrote: >> I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Remove debug code > - Make upper-bound narrower But I still want to see when we have large deviations, which might indicate a bug. The 75 boundary is low enough that it we should not run into the issues you described. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25745#issuecomment-2963167764 From egahlin at openjdk.org Wed Jun 11 15:05:28 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 11 Jun 2025 15:05:28 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v2] In-Reply-To: References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: On Wed, 11 Jun 2025 14:57:11 GMT, Johannes Bechberger wrote: > But I still want to see when we have large deviations, which might indicate a bug. The 75 boundary is low enough that it we should not run into the issues you described. Ok, but I think you will be back with a new test failure soon. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25745#issuecomment-2963185727 From jbechberger at openjdk.org Wed Jun 11 15:10:32 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 11 Jun 2025 15:10:32 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v2] In-Reply-To: References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: On Wed, 11 Jun 2025 11:11:50 GMT, Johannes Bechberger wrote: >> I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Remove debug code > - Make upper-bound narrower This test already only takes CPU-time into account (so this prevents issues with system load), and even if the thread is in the wrong state (like in VM or in GC), events are recorded (with `failed=true`). So I disagree with you. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25745#issuecomment-2963205790 From egahlin at openjdk.org Wed Jun 11 15:17:28 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 11 Jun 2025 15:17:28 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v2] In-Reply-To: References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: On Wed, 11 Jun 2025 15:08:16 GMT, Johannes Bechberger wrote: > This test already only takes CPU-time into account (so this prevents issues with system load), and even if the thread is in the wrong state (like in VM or in GC), events are recorded (with `failed=true`). So I disagree with you. That's fine. Check it in. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25745#issuecomment-2963224594 From jbechberger at openjdk.org Wed Jun 11 15:21:28 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 11 Jun 2025 15:21:28 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v2] In-Reply-To: References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: <_iRyjRiL7d5a_yW52HQ4RhxuOG8-L3qMF-DLKBj9hLY=.4e1da6e1-5f66-41db-9b2a-db1e21f4de02@github.com> On Wed, 11 Jun 2025 11:11:50 GMT, Johannes Bechberger wrote: >> I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. > > Johannes Bechberger has updated the pull request incrementally with two additional commits since the last revision: > > - Remove debug code > - Make upper-bound narrower Good, but I feel I should document this somewhere in a comment. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25745#issuecomment-2963241791 From jbechberger at openjdk.org Wed Jun 11 15:28:08 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 11 Jun 2025 15:28:08 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v3] In-Reply-To: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: > I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: Add comment ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25745/files - new: https://git.openjdk.org/jdk/pull/25745/files/57a3f447..5ce6cf35 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25745&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25745&range=01-02 Stats: 15 lines in 1 file changed: 8 ins; 2 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/25745.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25745/head:pull/25745 PR: https://git.openjdk.org/jdk/pull/25745 From egahlin at openjdk.org Wed Jun 11 16:34:40 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 11 Jun 2025 16:34:40 GMT Subject: RFR: 8359242: JFR: Missing help text for method trace and timing Message-ID: Could I have a review of a PR that adds missing help texts for method trace and method timing? Without, it's hard for user to understand how the feature can be used in JMC or with "jfr configure --interactive" Testing: test/jdk/jdk/jfr + tier1 Thanks Erik ------------- Commit messages: - Improve - Initial Changes: https://git.openjdk.org/jdk/pull/25759/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25759&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359242 Stats: 54 lines in 8 files changed: 36 ins; 4 del; 14 mod Patch: https://git.openjdk.org/jdk/pull/25759.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25759/head:pull/25759 PR: https://git.openjdk.org/jdk/pull/25759 From mdoerr at openjdk.org Wed Jun 11 16:44:29 2025 From: mdoerr at openjdk.org (Martin Doerr) Date: Wed, 11 Jun 2025 16:44:29 GMT Subject: RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently [v3] In-Reply-To: References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: On Wed, 11 Jun 2025 15:28:08 GMT, Johannes Bechberger wrote: >> I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. > > Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision: > > Add comment Still good. ------------- Marked as reviewed by mdoerr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25745#pullrequestreview-2917974820 From egahlin at openjdk.org Wed Jun 11 20:52:09 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 11 Jun 2025 20:52:09 GMT Subject: RFR: 8359242: JFR: Missing help text for method trace and timing [v2] In-Reply-To: References: Message-ID: > Could I have a review of a PR that adds missing help text for method trace and method timing? Without it, it's hard for users to understand how the feature can be used in JMC or with `jfr configure --interactive`. > > Testing: test/jdk/jdk/jfr + tier1 > > Thanks > Erik Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: Restore accidentally changed file ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25759/files - new: https://git.openjdk.org/jdk/pull/25759/files/6ed4825e..a23b5489 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25759&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25759&range=00-01 Stats: 4 lines in 1 file changed: 0 ins; 1 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/25759.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25759/head:pull/25759 PR: https://git.openjdk.org/jdk/pull/25759 From jbechberger at openjdk.org Thu Jun 12 08:57:40 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Thu, 12 Jun 2025 08:57:40 GMT Subject: Integrated: 8359135: New test TestCPUTimeSampleThrottling fails intermittently In-Reply-To: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> References: <04iTDD9yJI60x75w9Ir6cTPD-19qhaUHkblkakXLEt0=.ad9e8ea5-717a-4b6c-9450-2218ccee2421@github.com> Message-ID: On Wed, 11 Jun 2025 10:10:25 GMT, Johannes Bechberger wrote: > I increased the tolerated rate deviation to make the test less flaky on systems like PowerPC. The deviation comes from the thread not being in the Java and native states on some platforms compared to others. This pull request has now been integrated. Changeset: 3f0fef2c Author: Johannes Bechberger URL: https://git.openjdk.org/jdk/commit/3f0fef2c9c323cb7b6e9191b17eac4296ff22dac Stats: 16 lines in 1 file changed: 8 ins; 2 del; 6 mod 8359135: New test TestCPUTimeSampleThrottling fails intermittently Reviewed-by: mdoerr ------------- PR: https://git.openjdk.org/jdk/pull/25745 From mgronlun at openjdk.org Thu Jun 12 09:06:36 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Thu, 12 Jun 2025 09:06:36 GMT Subject: RFR: 8359242: JFR: Missing help text for method trace and timing [v2] In-Reply-To: References: Message-ID: On Wed, 11 Jun 2025 20:52:09 GMT, Erik Gahlin wrote: >> Could I have a review of a PR that adds missing help text for method trace and method timing? Without it, it's hard for users to understand how the feature can be used in JMC or with `jfr configure --interactive`. >> >> Testing: test/jdk/jdk/jfr + tier1 >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Restore accidentally changed file Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25759#pullrequestreview-2920171358 From jbechberger at openjdk.org Thu Jun 12 09:36:48 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Thu, 12 Jun 2025 09:36:48 GMT Subject: RFR: 8358619: Fix interval recomputation in CPU Time Profiler Message-ID: <3WRVvy_UqE4zZX60ZmDPb23PnJN2_pinfrcKVD-uQR8=.253cb8cd-8c39-49e5-b7f1-9e9f16bd76ea@github.com> Fixes the recomputation issue by passing either the rate or the period directly to the sampler (instead of just the rate value with the period value converted into a rate). This prevents issues when the number of cores changes during the JFR recording. ------------- Commit messages: - 8358619: Fix interval recomputation in CPU Time Profiler Changes: https://git.openjdk.org/jdk/pull/25775/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25775&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8358619 Stats: 327 lines in 11 files changed: 180 ins; 78 del; 69 mod Patch: https://git.openjdk.org/jdk/pull/25775.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25775/head:pull/25775 PR: https://git.openjdk.org/jdk/pull/25775 From jbechberger at openjdk.org Thu Jun 12 09:48:02 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Thu, 12 Jun 2025 09:48:02 GMT Subject: [jdk25] RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently Message-ID: Tested in SAP's testing queue. ------------- Commit messages: - Backport 3f0fef2c9c323cb7b6e9191b17eac4296ff22dac Changes: https://git.openjdk.org/jdk/pull/25776/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25776&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359135 Stats: 16 lines in 1 file changed: 8 ins; 2 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/25776.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25776/head:pull/25776 PR: https://git.openjdk.org/jdk/pull/25776 From mdoerr at openjdk.org Thu Jun 12 09:48:02 2025 From: mdoerr at openjdk.org (Martin Doerr) Date: Thu, 12 Jun 2025 09:48:02 GMT Subject: [jdk25] RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently In-Reply-To: References: Message-ID: On Thu, 12 Jun 2025 09:40:23 GMT, Johannes Bechberger wrote: > Tested in SAP's testing queue. Simple P3 test fix. Applies cleanly. ------------- Marked as reviewed by mdoerr (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25776#pullrequestreview-2920330900 From erwan.viollet at gmail.com Thu Jun 12 15:07:12 2025 From: erwan.viollet at gmail.com (Erwan Viollet) Date: Thu, 12 Jun 2025 17:07:12 +0200 Subject: JFR: Scrubbing sensitive information from events In-Reply-To: References: Message-ID: Hello, Here is an example of the types of events we are concerned about: Recording ? ??? Event (e.g. jdk.InitialSystemProperty) ? ??? eventType: "jdk.InitialSystemProperty" ? ??? startTime ? ??? duration ? ??? fields: ? ? ??? key: "javax.net.ssl.keyStorePassword" ? ? ??? value: "*supersecret*" ? ? ??? ... ? ??? ... ? ??? Event (e.g. jdk.JVMInformation) ? ??? eventType: "jdk.JVMInformation" ? ??? jvmArguments: [ "-Xmx4G", "-Djavax.net.ssl.keyStorePassword= *supersecret*", ... ] ? ??? ... ? ??? ... The rules are slightly challenging as they need to account for key/value pairs, arrays and simple fields (like commandLine field). Here is a scrub file example. I'm happy to consider ways to simplify this proposal. Storing JFR files would also be helpful to consider test cases. Regards, Erwan Le mar. 3 juin 2025 ? 11:50, Erik Gahlin a ?crit : > We have discussed it, but we don't understand all the details. We are also > unsure how to best expose it to the end user. Let's say there was a command > line option -XX:FlightRecorder:scrub-file=. > > What would you fill that file with? I want examples that work on real data > to understand how expressive the filters must be. > > Thanks > Erik > ------------------------------ > *From:* hotspot-jfr-dev on behalf of > Erwan Viollet > *Sent:* Monday, June 2, 2025 3:30 PM > *To:* hotspot-jfr-dev at openjdk.org > *Subject:* JFR: Scrubbing sensitive information from events > > Hello, > > I am currently looking into how to remove sensitive information from JFR > events. The main events that typically contain sensitive information: > jdk.SystemProcess, jdk.InitialSystemProperty, jdk.JVMInformation. > Passwords from command lines can typically be found in these events. > > Dropping these events altogether is not ideal, as we need them to make > relevant performance recommendations to users (e.g. suggesting JVM or > system setting adjustments). > > Dropping them or scrubbing them on the backend side (after the fact) > requires decompressing and re-writing these events, which is wasteful in > terms of both compute and storage. The approach is not perfect, as we still > end up intaking and temporarily storing sensitive information. > > Ideally, we would like to be able to scrub or redact only the sensitive > fields within these events (for example, using a simple regex or > pattern-based rule), rather than dropping the whole event. We also want to > avoid handling this only after the event has already been written to the > JFR file, as that does not fully mitigate the risk of exposing sensitive > data. > > At present, it appears there is no public API or supported mechanism to > intercept or scrub JFR events in-process, before they are persisted. What > would you think of an API accepting custom scrubbing patterns so that > sensitive data never leaves the JVM in an unredacted state? > > Are there any plans or discussions in this area? I am fairly new to the > JFR world, so it is likely that I missed previous discussions around this. > > Thank you, Best regards, > > Erwan Viollet, > > Profiling team, Datadog > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erik.gahlin at oracle.com Thu Jun 12 17:24:29 2025 From: erik.gahlin at oracle.com (Erik Gahlin) Date: Thu, 12 Jun 2025 17:24:29 +0000 Subject: [External] : Re: JFR: Scrubbing sensitive information from events In-Reply-To: References: Message-ID: Thanks for the file. I worry that processing the file in the JVM or creating an intuitive Java API for post-processing it will be hard. The context/event determines what needs to be redacted. If scrubbing is only necessary for these four events, hardcoding the sensitive tokens and logic into the JVM might be a viable approach. Users would specify: $ java -XX:FlightRecorderOptions:scrub-sensitive=true or it might be enabled by default and users would need to opt-out. Anyway, if enabled, a jfrScrub.cpp class would do the job. Something like this: EventInitialEnvironmentVariable event(UNTIMED); event.set_starttime(time_stamp); event.set_endtime(time_stamp); event.set_key(key); if (JfrScrub::is_sensitive_key(key)) { event.set_value("[REDACTED]"); } else { event.set_value(value); } event.commit(); EventInitialSystemProperty event(UNTIMED); event.set_key(p->key()); if (JfrScrub::is_sensitive_key(p->key()) { event.set_value("[REDACTED]"); } else { event.set_value(p->value()); } event.set_starttime(time_stamp); event.set_endtime(time_stamp); event.commit(); EventSystemProcess event(UNTIMED); event.set_pid(pid_buf); event.set_commandLine(JfrScrub::command_line(info)); event.set_starttime(start_time); event.set_endtime(end_time); event.commit(); EventJVMInformation event; event.set_jvmName(VM_Version::vm_name()); event.set_jvmVersion(VM_Version::internal_vm_info_string()); event.set_javaArguments(JfrScrub::command_line(Arguments::java_command())); event.set_jvmArguments(Arguments::jvm_args()); event.set_jvmFlags(Arguments::jvm_flags()); event.set_jvmStartTime(Management::vm_init_done_time()); event.set_pid(os::current_process_id()); event.commit(); It's a bit ugly and not as flexible, but perhaps that's something we need to tolerate. Or will it be useless because new passwords/keys will be added all the time, or because they will match false positives, and more advanced logic is needed? Perhaps it will give users the false(?) impression that they don't need to worry about sensitive data? Thanks Erik ________________________________ From: Erwan Viollet Sent: Thursday, June 12, 2025 5:07 PM To: Erik Gahlin Cc: hotspot-jfr-dev at openjdk.org Subject: [External] : Re: JFR: Scrubbing sensitive information from events Hello, Here is an example of the types of events we are concerned about: Recording ? ??? Event (e.g. jdk.InitialSystemProperty) ? ??? eventType: "jdk.InitialSystemProperty" ? ??? startTime ? ??? duration ? ??? fields: ? ? ??? key: "javax.net.ssl.keyStorePassword" ? ? ??? value: "supersecret" ? ? ??? ... ? ??? ... ? ??? Event (e.g. jdk.JVMInformation) ? ??? eventType: "jdk.JVMInformation" ? ??? jvmArguments: [ "-Xmx4G", "-Djavax.net.ssl.keyStorePassword=supersecret", ... ] ? ??? ... ? ??? ... The rules are slightly challenging as they need to account for key/value pairs, arrays and simple fields (like commandLine field). Here is a scrub file example. I'm happy to consider ways to simplify this proposal. Storing JFR files would also be helpful to consider test cases. Regards, Erwan Le mar. 3 juin 2025 ? 11:50, Erik Gahlin > a ?crit : We have discussed it, but we don't understand all the details. We are also unsure how to best expose it to the end user. Let's say there was a command line option -XX:FlightRecorder:scrub-file=. What would you fill that file with? I want examples that work on real data to understand how expressive the filters must be. Thanks Erik ________________________________ From: hotspot-jfr-dev > on behalf of Erwan Viollet > Sent: Monday, June 2, 2025 3:30 PM To: hotspot-jfr-dev at openjdk.org > Subject: JFR: Scrubbing sensitive information from events Hello, I am currently looking into how to remove sensitive information from JFR events. The main events that typically contain sensitive information: jdk.SystemProcess, jdk.InitialSystemProperty, jdk.JVMInformation. Passwords from command lines can typically be found in these events. Dropping these events altogether is not ideal, as we need them to make relevant performance recommendations to users (e.g. suggesting JVM or system setting adjustments). Dropping them or scrubbing them on the backend side (after the fact) requires decompressing and re-writing these events, which is wasteful in terms of both compute and storage. The approach is not perfect, as we still end up intaking and temporarily storing sensitive information. Ideally, we would like to be able to scrub or redact only the sensitive fields within these events (for example, using a simple regex or pattern-based rule), rather than dropping the whole event. We also want to avoid handling this only after the event has already been written to the JFR file, as that does not fully mitigate the risk of exposing sensitive data. At present, it appears there is no public API or supported mechanism to intercept or scrub JFR events in-process, before they are persisted. What would you think of an API accepting custom scrubbing patterns so that sensitive data never leaves the JVM in an unredacted state? Are there any plans or discussions in this area? I am fairly new to the JFR world, so it is likely that I missed previous discussions around this. Thank you, Best regards, Erwan Viollet, Profiling team, Datadog -------------- next part -------------- An HTML attachment was scrubbed... URL: From egahlin at openjdk.org Fri Jun 13 10:50:42 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Fri, 13 Jun 2025 10:50:42 GMT Subject: Integrated: 8358602: JFR: Annotations in jdk.jfr package should not use "not null" in specification In-Reply-To: References: Message-ID: On Tue, 10 Jun 2025 12:48:39 GMT, Erik Gahlin wrote: > Could I have review of PR that fixes the specification / documentation for annotations in the jdk.jfr package. > > Testing: tier1 + jdk/jdk/jfr This pull request has now been integrated. Changeset: 25b22c9b Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/25b22c9b553ffab82eb44df23f6b4942724aedaf Stats: 15 lines in 8 files changed: 0 ins; 0 del; 15 mod 8358602: JFR: Annotations in jdk.jfr package should not use "not null" in specification Reviewed-by: mgronlun ------------- PR: https://git.openjdk.org/jdk/pull/25723 From egahlin at openjdk.org Fri Jun 13 11:25:46 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Fri, 13 Jun 2025 11:25:46 GMT Subject: RFR: 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated Message-ID: Could I have review of a PR that updates the help text for report-on-exit so it clarifies that the option can be repeated. Testing: jdk/jdk/jfr + tier1 Thanks Erik ------------- Commit messages: - Initial Changes: https://git.openjdk.org/jdk/pull/25797/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25797&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359248 Stats: 9 lines in 2 files changed: 3 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/25797.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25797/head:pull/25797 PR: https://git.openjdk.org/jdk/pull/25797 From mgronlun at openjdk.org Fri Jun 13 12:22:36 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Fri, 13 Jun 2025 12:22:36 GMT Subject: RFR: 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated In-Reply-To: References: Message-ID: <6wcFWvoHZAajzudIOgGQi2FQI4IakGfcNGNqb0Rt7bU=.c931b87b-af65-4668-a6dc-057a295fe784@github.com> On Fri, 13 Jun 2025 11:01:16 GMT, Erik Gahlin wrote: > Could I have review of a PR that updates the help text for report-on-exit so it clarifies that the option can be repeated. > > Testing: jdk/jdk/jfr + tier1 > > Thanks > Erik Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25797#pullrequestreview-2924614601 From erwan.viollet at gmail.com Fri Jun 13 12:51:22 2025 From: erwan.viollet at gmail.com (Erwan Viollet) Date: Fri, 13 Jun 2025 14:51:22 +0200 Subject: [External] : Re: JFR: Scrubbing sensitive information from events In-Reply-To: References: Message-ID: I like the simple and pragmatic approach. Especially if we can have this as default. Writing custom scrubbing logic for these specific events is much more straightforward than building a generic scrubbing framework. To address the risk of missing sensitive patterns that are specific to user environments, I'd suggest adding a customization option: # Allow users to extend or override default patterns -XX:FlightRecorderOptions:scrub-sensitive-patterns="password,secret,key,token,credential,auth,pwd,passwd,api[_-]?key,custompattern" We had to do the same for the Datadog Agent process scrubbing , where users can specify `custom_sensitive_words` to handle their specific use cases. The remaining questions: 1. Scope limitations: Are there any known use cases that would be impacted by limiting scrubbing to these four event types? We believe this covers the vast majority of sensitive data exposure, but want to ensure we're not missing critical scenarios. 2. Default pattern selection: We should align on what a reasonable default would look like. We can use our JFR Data to do this. Regards, Erwan Le jeu. 12 juin 2025 ? 19:24, Erik Gahlin a ?crit : > Thanks for the file. > > I worry that processing the file in the JVM or creating an intuitive Java > API for post-processing it will be hard. The context/event determines what > needs to be redacted. If scrubbing is only necessary for these four events, > hardcoding the sensitive tokens and logic into the JVM might be a viable > approach. > > Users would specify: > > $ java -XX:FlightRecorderOptions:scrub-sensitive=true > > or it might be enabled by default and users would need to opt-out. > > Anyway, if enabled, a jfrScrub.cpp class would do the job. Something like > this: > > EventInitialEnvironmentVariable event(UNTIMED); > event.set_starttime(time_stamp); > event.set_endtime(time_stamp); > event.set_key(key); > if (JfrScrub::is_sensitive_key(key)) { > event.set_value("[REDACTED]"); > } else { > event.set_value(value); > } > event.commit(); > > EventInitialSystemProperty event(UNTIMED); > event.set_key(p->key()); > if (JfrScrub::is_sensitive_key(p->key()) { > event.set_value("[REDACTED]"); > } else { > event.set_value(p->value()); > } > event.set_starttime(time_stamp); > event.set_endtime(time_stamp); > event.commit(); > > EventSystemProcess event(UNTIMED); > event.set_pid(pid_buf); > event.set_commandLine(JfrScrub::command_line(info)); > event.set_starttime(start_time); > event.set_endtime(end_time); > event.commit(); > > EventJVMInformation event; > event.set_jvmName(VM_Version::vm_name()); > event.set_jvmVersion(VM_Version::internal_vm_info_string()); > > event.set_javaArguments(JfrScrub::command_line(Arguments::java_command())); > event.set_jvmArguments(Arguments::jvm_args()); > event.set_jvmFlags(Arguments::jvm_flags()); > event.set_jvmStartTime(Management::vm_init_done_time()); > event.set_pid(os::current_process_id()); > event.commit(); > > It's a bit ugly and not as flexible, but perhaps that's something we need > to tolerate. Or will it be useless because new passwords/keys will be added > all the time, or because they will match false positives, and more advanced > logic is needed? Perhaps it will give users the false(?) impression that > they don't need to worry about sensitive data? > > Thanks > Erik > ------------------------------ > *From:* Erwan Viollet > *Sent:* Thursday, June 12, 2025 5:07 PM > *To:* Erik Gahlin > *Cc:* hotspot-jfr-dev at openjdk.org > *Subject:* [External] : Re: JFR: Scrubbing sensitive information from > events > > Hello, > > Here is an example of the types of events we are concerned about: > > Recording > ? > ??? Event (e.g. jdk.InitialSystemProperty) > ? ??? eventType: "jdk.InitialSystemProperty" > ? ??? startTime > ? ??? duration > ? ??? fields: > ? ? ??? key: "javax.net.ssl.keyStorePassword" > ? ? ??? value: "*supersecret*" > ? ? ??? ... > ? ??? ... > ? > ??? Event (e.g. jdk.JVMInformation) > ? ??? eventType: "jdk.JVMInformation" > ? ??? jvmArguments: [ "-Xmx4G", "-Djavax.net.ssl.keyStorePassword= > *supersecret*", ... ] > ? ??? ... > ? > ??? ... > > The rules are slightly challenging as they need to account for key/value > pairs, arrays and simple fields (like commandLine field). > Here > > is a scrub file example. I'm happy to consider ways to simplify this > proposal. Storing JFR files would also be helpful to consider test cases. > Regards, > > Erwan > > > Le mar. 3 juin 2025 ? 11:50, Erik Gahlin a > ?crit : > > We have discussed it, but we don't understand all the details. We are also > unsure how to best expose it to the end user. Let's say there was a command > line option -XX:FlightRecorder:scrub-file=. > > What would you fill that file with? I want examples that work on real data > to understand how expressive the filters must be. > > Thanks > Erik > ------------------------------ > *From:* hotspot-jfr-dev on behalf of > Erwan Viollet > *Sent:* Monday, June 2, 2025 3:30 PM > *To:* hotspot-jfr-dev at openjdk.org > *Subject:* JFR: Scrubbing sensitive information from events > > Hello, > > I am currently looking into how to remove sensitive information from JFR > events. The main events that typically contain sensitive information: > jdk.SystemProcess, jdk.InitialSystemProperty, jdk.JVMInformation. > Passwords from command lines can typically be found in these events. > > Dropping these events altogether is not ideal, as we need them to make > relevant performance recommendations to users (e.g. suggesting JVM or > system setting adjustments). > > Dropping them or scrubbing them on the backend side (after the fact) > requires decompressing and re-writing these events, which is wasteful in > terms of both compute and storage. The approach is not perfect, as we still > end up intaking and temporarily storing sensitive information. > > Ideally, we would like to be able to scrub or redact only the sensitive > fields within these events (for example, using a simple regex or > pattern-based rule), rather than dropping the whole event. We also want to > avoid handling this only after the event has already been written to the > JFR file, as that does not fully mitigate the risk of exposing sensitive > data. > > At present, it appears there is no public API or supported mechanism to > intercept or scrub JFR events in-process, before they are persisted. What > would you think of an API accepting custom scrubbing patterns so that > sensitive data never leaves the JVM in an unredacted state? > > Are there any plans or discussions in this area? I am fairly new to the > JFR world, so it is likely that I missed previous discussions around this. > > Thank you, Best regards, > > Erwan Viollet, > > Profiling team, Datadog > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From egahlin at openjdk.org Sun Jun 15 16:37:24 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Sun, 15 Jun 2025 16:37:24 GMT Subject: RFR: 8359593: JFR: Instrumentation of java.lang.String corrupts recording Message-ID: Could I have review of PR that excludes problematic String-related methods when tracing java.lang.String. Testing: jdk/jdk/jfr Thanks Erik ------------- Commit messages: - Initial Changes: https://git.openjdk.org/jdk/pull/25814/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25814&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359593 Stats: 100 lines in 2 files changed: 88 ins; 5 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/25814.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25814/head:pull/25814 PR: https://git.openjdk.org/jdk/pull/25814 From egahlin at openjdk.org Sun Jun 15 18:41:18 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Sun, 15 Jun 2025 18:41:18 GMT Subject: RFR: 8359593: JFR: Instrumentation of java.lang.String corrupts recording [v2] In-Reply-To: References: Message-ID: <9J11ddd9n87zzDpcKPEQIw00ne7a8SAPnz0Uv5S1ejw=.18f60b3b-7b48-4021-9d15-28fc1497c27e@github.com> > Could I have review of PR that excludes problematic String-related methods when tracing java.lang.String. > > Testing: jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: Add missing copyright header ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25814/files - new: https://git.openjdk.org/jdk/pull/25814/files/7f00bba7..90ad9325 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25814&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25814&range=00-01 Stats: 22 lines in 1 file changed: 22 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25814.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25814/head:pull/25814 PR: https://git.openjdk.org/jdk/pull/25814 From duke at openjdk.org Sun Jun 15 21:58:28 2025 From: duke at openjdk.org (ExE Boss) Date: Sun, 15 Jun 2025 21:58:28 GMT Subject: RFR: 8359593: JFR: Instrumentation of java.lang.String corrupts recording [v2] In-Reply-To: <9J11ddd9n87zzDpcKPEQIw00ne7a8SAPnz0Uv5S1ejw=.18f60b3b-7b48-4021-9d15-28fc1497c27e@github.com> References: <9J11ddd9n87zzDpcKPEQIw00ne7a8SAPnz0Uv5S1ejw=.18f60b3b-7b48-4021-9d15-28fc1497c27e@github.com> Message-ID: On Sun, 15 Jun 2025 18:41:18 GMT, Erik Gahlin wrote: >> Could I have review of PR that excludes problematic String-related methods when tracing java.lang.String. >> >> Testing: jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Add missing copyright header src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/ExcludeList.java line 38: > 36: "jdk/internal/misc/Unsafe", > 37: "java/lang/StringLatin1", > 38: "java/lang/StringUTF16" **Java** array?initialiser?expressions can?have trailing?commas: Suggestion: "java/lang/StringUTF16", (wish?the?same applied?to?method parameters) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25814#discussion_r2148837431 From egahlin at openjdk.org Mon Jun 16 09:10:51 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Mon, 16 Jun 2025 09:10:51 GMT Subject: RFR: 8359593: JFR: Instrumentation of java.lang.String corrupts recording [v3] In-Reply-To: References: Message-ID: <4VCHQlrVuo_c1onovruLFy1xnPnPD4N-8lhZcS8YjfE=.2ce5cd57-163c-40ab-a078-f04a906b27a9@github.com> > Could I have review of PR that excludes problematic String-related methods when tracing java.lang.String. > > Testing: jdk/jdk/jfr > > Thanks > Erik Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: Add comma ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25814/files - new: https://git.openjdk.org/jdk/pull/25814/files/90ad9325..9669ed4a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25814&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25814&range=01-02 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/25814.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25814/head:pull/25814 PR: https://git.openjdk.org/jdk/pull/25814 From egahlin at openjdk.org Mon Jun 16 09:12:36 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Mon, 16 Jun 2025 09:12:36 GMT Subject: Integrated: 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated In-Reply-To: References: Message-ID: On Fri, 13 Jun 2025 11:01:16 GMT, Erik Gahlin wrote: > Could I have review of a PR that updates the help text for report-on-exit so it clarifies that the option can be repeated. > > Testing: jdk/jdk/jfr + tier1 > > Thanks > Erik This pull request has now been integrated. Changeset: fedd0a0e Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/fedd0a0ee3aea9f73cfce34172a764e63c1ba46b Stats: 9 lines in 2 files changed: 3 ins; 0 del; 6 mod 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated Reviewed-by: mgronlun ------------- PR: https://git.openjdk.org/jdk/pull/25797 From syan at openjdk.org Mon Jun 16 11:36:31 2025 From: syan at openjdk.org (SendaoYan) Date: Mon, 16 Jun 2025 11:36:31 GMT Subject: RFR: 8359593: JFR: Instrumentation of java.lang.String corrupts recording [v3] In-Reply-To: <4VCHQlrVuo_c1onovruLFy1xnPnPD4N-8lhZcS8YjfE=.2ce5cd57-163c-40ab-a078-f04a906b27a9@github.com> References: <4VCHQlrVuo_c1onovruLFy1xnPnPD4N-8lhZcS8YjfE=.2ce5cd57-163c-40ab-a078-f04a906b27a9@github.com> Message-ID: On Mon, 16 Jun 2025 09:10:51 GMT, Erik Gahlin wrote: >> Could I have review of PR that excludes problematic String-related methods when tracing java.lang.String. >> >> Testing: jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Add comma test/jdk/jdk/jfr/event/tracing/TestTracedString.java line 39: > 37: * @requires vm.hasJFR > 38: * @library /test/lib > 39: * @run main/othervm jdk.jfr.event.tracing.TestTracedString The `/othervm` could be removed or not? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25814#discussion_r2149723823 From egahlin at openjdk.org Mon Jun 16 11:43:28 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Mon, 16 Jun 2025 11:43:28 GMT Subject: RFR: 8359593: JFR: Instrumentation of java.lang.String corrupts recording [v3] In-Reply-To: References: <4VCHQlrVuo_c1onovruLFy1xnPnPD4N-8lhZcS8YjfE=.2ce5cd57-163c-40ab-a078-f04a906b27a9@github.com> Message-ID: <8dQcan3JAVHmh6qZSauSbP3RXEubm9Awp9sAj-dyHKw=.81dac1c8-9f77-40d4-b278-69d154636399@github.com> On Mon, 16 Jun 2025 11:34:07 GMT, SendaoYan wrote: >> Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: >> >> Add comma > > test/jdk/jdk/jfr/event/tracing/TestTracedString.java line 39: > >> 37: * @requires vm.hasJFR >> 38: * @library /test/lib >> 39: * @run main/othervm jdk.jfr.event.tracing.TestTracedString > > The `/othervm` could be removed or not? It's by design. We don't want other tests to modify the state of the JVM. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25814#discussion_r2149734149 From mbaesken at openjdk.org Mon Jun 16 13:27:33 2025 From: mbaesken at openjdk.org (Matthias Baesken) Date: Mon, 16 Jun 2025 13:27:33 GMT Subject: [jdk25] RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently In-Reply-To: References: Message-ID: <83PzVS_hd8BJX1Q1-k0h2uvkvTLdacvnGQJ7Dz5NOi8=.5cd425f5-811b-495d-9860-fdbddfdcf3ee@github.com> On Thu, 12 Jun 2025 09:40:23 GMT, Johannes Bechberger wrote: > Tested in SAP's testing queue. We got also this error from the test java.lang.RuntimeException: Expected between 0 and 3 events, got 0: expected true, was false at jdk.test.lib.Asserts.fail(Asserts.java:715) at jdk.test.lib.Asserts.assertTrue(Asserts.java:545) at jdk.jfr.event.profiling.TestCPUTimeSampleThrottling.testThrottleSettings(TestCPUTimeSampleThrottling.java:58) at jdk.jfr.event.profiling.TestCPUTimeSampleThrottling.main(TestCPUTimeSampleThrottling.java:47) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:565) at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138) at java.base/java.lang.Thread.run(Thread.java:1474) Should we fix this as well in this PR ? Or is a separate one planned ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/25776#issuecomment-2976653684 From mdoerr at openjdk.org Mon Jun 16 13:56:27 2025 From: mdoerr at openjdk.org (Martin Doerr) Date: Mon, 16 Jun 2025 13:56:27 GMT Subject: [jdk25] RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently In-Reply-To: <83PzVS_hd8BJX1Q1-k0h2uvkvTLdacvnGQJ7Dz5NOi8=.5cd425f5-811b-495d-9860-fdbddfdcf3ee@github.com> References: <83PzVS_hd8BJX1Q1-k0h2uvkvTLdacvnGQJ7Dz5NOi8=.5cd425f5-811b-495d-9860-fdbddfdcf3ee@github.com> Message-ID: On Mon, 16 Jun 2025 13:25:15 GMT, Matthias Baesken wrote: > We got also this error from the test java.lang.RuntimeException: Expected between 0 and 3 events, got 0: expected true, was false at jdk.test.lib.Asserts.fail(Asserts.java:715) at jdk.test.lib.Asserts.assertTrue(Asserts.java:545) at jdk.jfr.event.profiling.TestCPUTimeSampleThrottling.testThrottleSettings(TestCPUTimeSampleThrottling.java:58) at jdk.jfr.event.profiling.TestCPUTimeSampleThrottling.main(TestCPUTimeSampleThrottling.java:47) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:565) at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138) at java.base/java.lang.Thread.run(Thread.java:1474) > > Should we fix this as well in this PR ? Or is a separate one planned ? This is the clean JDK25 backport. We'll need a new issue. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25776#issuecomment-2976757345 From mbaesken at openjdk.org Mon Jun 16 14:07:29 2025 From: mbaesken at openjdk.org (Matthias Baesken) Date: Mon, 16 Jun 2025 14:07:29 GMT Subject: [jdk25] RFR: 8359135: New test TestCPUTimeSampleThrottling fails intermittently In-Reply-To: References: Message-ID: On Thu, 12 Jun 2025 09:40:23 GMT, Johannes Bechberger wrote: > Tested in SAP's testing queue. I created the new issue JDK-8359690 . ------------- PR Comment: https://git.openjdk.org/jdk/pull/25776#issuecomment-2976797163 From mgronlun at openjdk.org Mon Jun 16 14:46:28 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Mon, 16 Jun 2025 14:46:28 GMT Subject: RFR: 8359593: JFR: Instrumentation of java.lang.String corrupts recording [v3] In-Reply-To: <4VCHQlrVuo_c1onovruLFy1xnPnPD4N-8lhZcS8YjfE=.2ce5cd57-163c-40ab-a078-f04a906b27a9@github.com> References: <4VCHQlrVuo_c1onovruLFy1xnPnPD4N-8lhZcS8YjfE=.2ce5cd57-163c-40ab-a078-f04a906b27a9@github.com> Message-ID: On Mon, 16 Jun 2025 09:10:51 GMT, Erik Gahlin wrote: >> Could I have review of PR that excludes problematic String-related methods when tracing java.lang.String. >> >> Testing: jdk/jdk/jfr >> >> Thanks >> Erik > > Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision: > > Add comma Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25814#pullrequestreview-2932438185 From egahlin at openjdk.org Mon Jun 16 16:13:36 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Mon, 16 Jun 2025 16:13:36 GMT Subject: Integrated: 8359593: JFR: Instrumentation of java.lang.String corrupts recording In-Reply-To: References: Message-ID: On Sun, 15 Jun 2025 16:25:52 GMT, Erik Gahlin wrote: > Could I have review of PR that excludes problematic String-related methods when tracing java.lang.String. > > Testing: jdk/jdk/jfr > > Thanks > Erik This pull request has now been integrated. Changeset: 2f2acb2e Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/2f2acb2e3f292517456f5b328a35182863188653 Stats: 122 lines in 2 files changed: 110 ins; 5 del; 7 mod 8359593: JFR: Instrumentation of java.lang.String corrupts recording Reviewed-by: mgronlun ------------- PR: https://git.openjdk.org/jdk/pull/25814 From jbechberger at openjdk.org Mon Jun 16 16:23:33 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Mon, 16 Jun 2025 16:23:33 GMT Subject: [jdk25] Integrated: 8359135: New test TestCPUTimeSampleThrottling fails intermittently In-Reply-To: References: Message-ID: <55rlWdyLxbmN9YVmSreYsaTWwu5YPBlp-sQGobsAwJ0=.8d7885ed-4cb0-46c9-b779-af5307d0a851@github.com> On Thu, 12 Jun 2025 09:40:23 GMT, Johannes Bechberger wrote: > Tested in SAP's testing queue. This pull request has now been integrated. Changeset: b6cacfcb Author: Johannes Bechberger URL: https://git.openjdk.org/jdk/commit/b6cacfcbc80fd6574b1040a3ec56639a1db47e46 Stats: 16 lines in 1 file changed: 8 ins; 2 del; 6 mod 8359135: New test TestCPUTimeSampleThrottling fails intermittently Reviewed-by: mdoerr Backport-of: 3f0fef2c9c323cb7b6e9191b17eac4296ff22dac ------------- PR: https://git.openjdk.org/jdk/pull/25776 From egahlin at openjdk.org Mon Jun 16 16:55:32 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Mon, 16 Jun 2025 16:55:32 GMT Subject: Integrated: 8359242: JFR: Missing help text for method trace and timing In-Reply-To: References: Message-ID: On Wed, 11 Jun 2025 15:12:08 GMT, Erik Gahlin wrote: > Could I have a review of a PR that adds missing help text for method trace and method timing? Without it, it's hard for users to understand how the feature can be used in JMC or with `jfr configure --interactive`. > > Testing: test/jdk/jdk/jfr + tier1 > > Thanks > Erik This pull request has now been integrated. Changeset: e57a214e Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/e57a214e2a1059109dd028369d518298cfa5d5b4 Stats: 50 lines in 7 files changed: 35 ins; 4 del; 11 mod 8359242: JFR: Missing help text for method trace and timing Reviewed-by: mgronlun ------------- PR: https://git.openjdk.org/jdk/pull/25759 From egahlin at openjdk.org Tue Jun 17 12:27:32 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Tue, 17 Jun 2025 12:27:32 GMT Subject: RFR: 8346886: Add since checker test to jdk.management.jfr In-Reply-To: References: Message-ID: On Tue, 3 Jun 2025 10:08:37 GMT, Nizar Benalla wrote: > Please review this patch to add a new test to check `@since` tags in the `jdk.management.jfr` module. > > TIA Looks reasonable. ------------- Marked as reviewed by egahlin (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25612#pullrequestreview-2935443583 From naoto at openjdk.org Tue Jun 17 20:37:04 2025 From: naoto at openjdk.org (Naoto Sato) Date: Tue, 17 Jun 2025 20:37:04 GMT Subject: RFR: 8359732: Make standard i/o encoding related system properties `StaticProperty` Message-ID: Refactored the internal handling of `stdin/out/err.encoding` to allow setting them only via command-line options by converting them into `StaticProperty`. This change prevents unexpected behavior caused by applications modifying these properties at runtime using `System.setProperty()`. ------------- Commit messages: - Several more locations - initial commit Changes: https://git.openjdk.org/jdk/pull/25860/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25860&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359732 Stats: 69 lines in 13 files changed: 50 ins; 0 del; 19 mod Patch: https://git.openjdk.org/jdk/pull/25860.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25860/head:pull/25860 PR: https://git.openjdk.org/jdk/pull/25860 From vyazici at openjdk.org Wed Jun 18 07:10:27 2025 From: vyazici at openjdk.org (Volkan Yazici) Date: Wed, 18 Jun 2025 07:10:27 GMT Subject: RFR: 8359732: Make standard i/o encoding related system properties `StaticProperty` In-Reply-To: References: Message-ID: On Tue, 17 Jun 2025 20:16:05 GMT, Naoto Sato wrote: > Refactored the internal handling of `stdin/out/err.encoding` to allow setting them only via command-line options by converting them into `StaticProperty`. This change prevents unexpected behavior caused by applications modifying these properties at runtime using `System.setProperty()`. I've verified that all relevant occurrences of `std{in,err,out}.encoding` are covered, except the ones `src/java.base/share/classes/java/lang/System.java`, which, I presume, is left out intentionally. ------------- Marked as reviewed by vyazici (Committer). PR Review: https://git.openjdk.org/jdk/pull/25860#pullrequestreview-2937989243 From alanb at openjdk.org Wed Jun 18 07:55:28 2025 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 18 Jun 2025 07:55:28 GMT Subject: RFR: 8359732: Make standard i/o encoding related system properties `StaticProperty` In-Reply-To: References: Message-ID: On Tue, 17 Jun 2025 20:16:05 GMT, Naoto Sato wrote: > Refactored the internal handling of `stdin/out/err.encoding` to allow setting them only via command-line options by converting them into `StaticProperty`. This change prevents unexpected behavior caused by applications modifying these properties at runtime using `System.setProperty()`. src/java.base/share/classes/module-info.java line 287: > 285: jdk.jpackage, > 286: jdk.jshell, > 287: jdk.net; At some point we will need to re-visit all these qualified exports so that java.base exports as few of these internal packages as possible. src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CLHSDB.java line 111: > 109: > 110: > 111: Charset charset = Charset.forName(StaticProperty.stdinEncoding(), Charset.defaultCharset()); This is the jhsdb tool, just wondering why it needs to be changed. src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java line 802: > 800: } > 801: try { > 802: Charset charset = Charset.forName(StaticProperty.stdinEncoding(), Charset.defaultCharset()); This is the example jdb debugger, I assume okay to let it read the stdin.encoding property. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25860#discussion_r2153907749 PR Review Comment: https://git.openjdk.org/jdk/pull/25860#discussion_r2153910478 PR Review Comment: https://git.openjdk.org/jdk/pull/25860#discussion_r2153913162 From alanb at openjdk.org Wed Jun 18 07:59:27 2025 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 18 Jun 2025 07:59:27 GMT Subject: RFR: 8359732: Make standard i/o encoding related system properties `StaticProperty` In-Reply-To: References: Message-ID: On Tue, 17 Jun 2025 20:16:05 GMT, Naoto Sato wrote: > Refactored the internal handling of `stdin/out/err.encoding` to allow setting them only via command-line options by converting them into `StaticProperty`. This change prevents unexpected behavior caused by applications modifying these properties at runtime using `System.setProperty()`. src/java.scripting/share/classes/javax/script/SimpleScriptContext.java line 100: > 98: > 99: private static InputStreamReader stdinReader() { > 100: Charset charset = Charset.forName(StaticProperty.stdinEncoding(), Charset.defaultCharset()); This is the jrunscript command line tool. I suppose it's possible it could run a script that changes stdin.encoding. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25860#discussion_r2153921907 From jbachorik at openjdk.org Wed Jun 18 11:50:29 2025 From: jbachorik at openjdk.org (Jaroslav Bachorik) Date: Wed, 18 Jun 2025 11:50:29 GMT Subject: RFR: 8358619: Fix interval recomputation in CPU Time Profiler In-Reply-To: <3WRVvy_UqE4zZX60ZmDPb23PnJN2_pinfrcKVD-uQR8=.253cb8cd-8c39-49e5-b7f1-9e9f16bd76ea@github.com> References: <3WRVvy_UqE4zZX60ZmDPb23PnJN2_pinfrcKVD-uQR8=.253cb8cd-8c39-49e5-b7f1-9e9f16bd76ea@github.com> Message-ID: On Thu, 12 Jun 2025 09:27:30 GMT, Johannes Bechberger wrote: > Fixes the recomputation issue by passing either the rate or the period directly to the sampler (instead of just the rate value with the period value converted into a rate). This prevents issues when the number of cores changes during the JFR recording. src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 171: > 169: double _rate; > 170: u8 _period_nanos; > 171: bool _is_rate; Can this be turned into `union`? Only one of `_rate` or `_period_nanos` will ever be set at a time. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25775#discussion_r2154393526 From jbechberger at openjdk.org Wed Jun 18 11:50:30 2025 From: jbechberger at openjdk.org (Johannes Bechberger) Date: Wed, 18 Jun 2025 11:50:30 GMT Subject: RFR: 8358619: Fix interval recomputation in CPU Time Profiler In-Reply-To: References: <3WRVvy_UqE4zZX60ZmDPb23PnJN2_pinfrcKVD-uQR8=.253cb8cd-8c39-49e5-b7f1-9e9f16bd76ea@github.com> Message-ID: On Wed, 18 Jun 2025 11:45:48 GMT, Jaroslav Bachorik wrote: >> Fixes the recomputation issue by passing either the rate or the period directly to the sampler (instead of just the rate value with the period value converted into a rate). This prevents issues when the number of cores changes during the JFR recording. > > src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 171: > >> 169: double _rate; >> 170: u8 _period_nanos; >> 171: bool _is_rate; > > Can this be turned into `union`? > Only one of `_rate` or `_period_nanos` will ever be set at a time. good idea ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25775#discussion_r2154397271 From jbachorik at openjdk.org Wed Jun 18 11:54:28 2025 From: jbachorik at openjdk.org (Jaroslav Bachorik) Date: Wed, 18 Jun 2025 11:54:28 GMT Subject: RFR: 8358619: Fix interval recomputation in CPU Time Profiler In-Reply-To: <3WRVvy_UqE4zZX60ZmDPb23PnJN2_pinfrcKVD-uQR8=.253cb8cd-8c39-49e5-b7f1-9e9f16bd76ea@github.com> References: <3WRVvy_UqE4zZX60ZmDPb23PnJN2_pinfrcKVD-uQR8=.253cb8cd-8c39-49e5-b7f1-9e9f16bd76ea@github.com> Message-ID: On Thu, 12 Jun 2025 09:27:30 GMT, Johannes Bechberger wrote: > Fixes the recomputation issue by passing either the rate or the period directly to the sampler (instead of just the rate value with the period value converted into a rate). This prevents issues when the number of cores changes during the JFR recording. src/jdk.jfr/share/classes/jdk/jfr/internal/util/TimespanRateOrPeriod.java line 37: > 35: public static final TimespanRateOrPeriod OFF = new TimespanRateOrPeriod(0, 0, false); > 36: > 37: public static TimespanRateOrPeriod of(String text) { Please add the doc about the allowed format for the `text` input ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25775#discussion_r2154403402 From egahlin at openjdk.org Wed Jun 18 12:23:08 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 18 Jun 2025 12:23:08 GMT Subject: RFR: 8359895: JFR: method-timing view doesn't work Message-ID: Could I have review of PR that fixes the method timing view. Testing: jdk/jdk/jfr Thanks Erik ------------- Commit messages: - Initial Changes: https://git.openjdk.org/jdk/pull/25869/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25869&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359895 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/25869.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25869/head:pull/25869 PR: https://git.openjdk.org/jdk/pull/25869 From mgronlun at openjdk.org Wed Jun 18 12:23:08 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Wed, 18 Jun 2025 12:23:08 GMT Subject: RFR: 8359895: JFR: method-timing view doesn't work In-Reply-To: References: Message-ID: On Wed, 18 Jun 2025 12:11:58 GMT, Erik Gahlin wrote: > Could I have review of PR that fixes the method timing view. > > Testing: jdk/jdk/jfr > > Thanks > Erik Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25869#pullrequestreview-2938977502 From egahlin at openjdk.org Wed Jun 18 14:46:33 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 18 Jun 2025 14:46:33 GMT Subject: Integrated: 8359895: JFR: method-timing view doesn't work In-Reply-To: References: Message-ID: <6fzzSsc1Uer_tVyG8Ayv8FSv_-s9_qvPF5HXlpaiC_s=.26febdaf-f475-47d2-b905-38220ba5f334@github.com> On Wed, 18 Jun 2025 12:11:58 GMT, Erik Gahlin wrote: > Could I have review of PR that fixes the method timing view. > > Testing: jdk/jdk/jfr > > Thanks > Erik This pull request has now been integrated. Changeset: 984d7f9c Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/984d7f9cdfb0d75ea906ce32df0b6c447f4d5954 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod 8359895: JFR: method-timing view doesn't work Reviewed-by: mgronlun ------------- PR: https://git.openjdk.org/jdk/pull/25869 From rriggs at openjdk.org Wed Jun 18 15:08:28 2025 From: rriggs at openjdk.org (Roger Riggs) Date: Wed, 18 Jun 2025 15:08:28 GMT Subject: RFR: 8359732: Make standard i/o encoding related system properties `StaticProperty` In-Reply-To: References: Message-ID: On Tue, 17 Jun 2025 20:16:05 GMT, Naoto Sato wrote: > Refactored the internal handling of `stdin/out/err.encoding` to allow setting them only via command-line options by converting them into `StaticProperty`. This change prevents unexpected behavior caused by applications modifying these properties at runtime using `System.setProperty()`. Static properties should not be used outside of java.base. The "for internal use only" should have said "java.base internal use only" Adding a comment to that effect would be a good idea. ------------- Changes requested by rriggs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25860#pullrequestreview-2939624079 From rriggs at openjdk.org Wed Jun 18 15:08:30 2025 From: rriggs at openjdk.org (Roger Riggs) Date: Wed, 18 Jun 2025 15:08:30 GMT Subject: RFR: 8359732: Make standard i/o encoding related system properties `StaticProperty` In-Reply-To: References: Message-ID: <0gpDp3XapnEa-4BfqTDt7AAHV7_qDLoKHy3-2xzJ7ro=.faa1279d-82a8-4a68-a026-94f325f904e7@github.com> On Wed, 18 Jun 2025 07:50:31 GMT, Alan Bateman wrote: >> Refactored the internal handling of `stdin/out/err.encoding` to allow setting them only via command-line options by converting them into `StaticProperty`. This change prevents unexpected behavior caused by applications modifying these properties at runtime using `System.setProperty()`. > > src/java.base/share/classes/module-info.java line 287: > >> 285: jdk.jpackage, >> 286: jdk.jshell, >> 287: jdk.net; > > At some point we will need to re-visit all these qualified exports so that java.base exports as few of these internal packages as possible. The original intent of StaticProperties was to limit it to the base module. Other modules are free to read the property themselves. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25860#discussion_r2154852609 From egahlin at openjdk.org Wed Jun 18 20:50:04 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 18 Jun 2025 20:50:04 GMT Subject: [jdk25] RFR: 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated Message-ID: 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated ------------- Commit messages: - Backport fedd0a0ee3aea9f73cfce34172a764e63c1ba46b Changes: https://git.openjdk.org/jdk/pull/25885/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25885&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359248 Stats: 9 lines in 2 files changed: 3 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/25885.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25885/head:pull/25885 PR: https://git.openjdk.org/jdk/pull/25885 From egahlin at openjdk.org Wed Jun 18 21:39:09 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Wed, 18 Jun 2025 21:39:09 GMT Subject: [jdk25] RFR: 8359593: JFR: Instrumentation of java.lang.String corrupts recording Message-ID: 8359593: JFR: Instrumentation of java.lang.String corrupts recording ------------- Commit messages: - Backport 2f2acb2e3f292517456f5b328a35182863188653 Changes: https://git.openjdk.org/jdk/pull/25886/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25886&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359593 Stats: 122 lines in 2 files changed: 110 ins; 5 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/25886.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25886/head:pull/25886 PR: https://git.openjdk.org/jdk/pull/25886 From mgronlun at openjdk.org Thu Jun 19 09:54:35 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Thu, 19 Jun 2025 09:54:35 GMT Subject: [jdk25] RFR: 8359593: JFR: Instrumentation of java.lang.String corrupts recording In-Reply-To: References: Message-ID: On Wed, 18 Jun 2025 21:17:51 GMT, Erik Gahlin wrote: > 8359593: JFR: Instrumentation of java.lang.String corrupts recording Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25886#pullrequestreview-2942338168 From mgronlun at openjdk.org Thu Jun 19 09:54:49 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Thu, 19 Jun 2025 09:54:49 GMT Subject: [jdk25] RFR: 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated In-Reply-To: References: Message-ID: On Wed, 18 Jun 2025 20:27:17 GMT, Erik Gahlin wrote: > 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25885#pullrequestreview-2942337584 From egahlin at openjdk.org Thu Jun 19 12:59:51 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 19 Jun 2025 12:59:51 GMT Subject: [jdk25] Integrated: 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated In-Reply-To: References: Message-ID: On Wed, 18 Jun 2025 20:27:17 GMT, Erik Gahlin wrote: > 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated This pull request has now been integrated. Changeset: b79ca5f0 Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/b79ca5f03b5c827212f854d39a26a6f6b7579589 Stats: 9 lines in 2 files changed: 3 ins; 0 del; 6 mod 8359248: JFR: Help text for-XX:StartFlightRecording:report-on-exit should explain option can be repeated Reviewed-by: mgronlun Backport-of: fedd0a0ee3aea9f73cfce34172a764e63c1ba46b ------------- PR: https://git.openjdk.org/jdk/pull/25885 From egahlin at openjdk.org Thu Jun 19 14:26:51 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 19 Jun 2025 14:26:51 GMT Subject: [jdk25] Integrated: 8359593: JFR: Instrumentation of java.lang.String corrupts recording In-Reply-To: References: Message-ID: On Wed, 18 Jun 2025 21:17:51 GMT, Erik Gahlin wrote: > 8359593: JFR: Instrumentation of java.lang.String corrupts recording This pull request has now been integrated. Changeset: c832f001 Author: Erik Gahlin URL: https://git.openjdk.org/jdk/commit/c832f001e47c0eb64948e90291991e678f6b2619 Stats: 122 lines in 2 files changed: 110 ins; 5 del; 7 mod 8359593: JFR: Instrumentation of java.lang.String corrupts recording Reviewed-by: mgronlun Backport-of: 2f2acb2e3f292517456f5b328a35182863188653 ------------- PR: https://git.openjdk.org/jdk/pull/25886 From egahlin at openjdk.org Thu Jun 19 15:04:08 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 19 Jun 2025 15:04:08 GMT Subject: [jdk25] RFR: 8359242: JFR: Missing help text for method trace and timing Message-ID: <46Bx5apRRtfaMPLPUC4GYrx-ptArCi63I1AHfYZnCgw=.ec42f056-9570-4171-97f3-57108afa8694@github.com> 8359242: JFR: Missing help text for method trace and timing ------------- Commit messages: - Backport e57a214e2a1059109dd028369d518298cfa5d5b4 Changes: https://git.openjdk.org/jdk/pull/25899/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25899&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359242 Stats: 50 lines in 7 files changed: 35 ins; 4 del; 11 mod Patch: https://git.openjdk.org/jdk/pull/25899.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25899/head:pull/25899 PR: https://git.openjdk.org/jdk/pull/25899 From egahlin at openjdk.org Thu Jun 19 15:19:45 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 19 Jun 2025 15:19:45 GMT Subject: [jdk25] RFR: 8359895: JFR: method-timing view doesn't work Message-ID: <-wCIbDMiqJuDZvXgZlMnhPYPNiONxYW9P0TvtYOAuMM=.6b53c34e-65fc-4a67-935d-70ae2473c2dd@github.com> 8359895: JFR: method-timing view doesn't work ------------- Commit messages: - Backport 984d7f9cdfb0d75ea906ce32df0b6c447f4d5954 Changes: https://git.openjdk.org/jdk/pull/25901/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25901&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359895 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/25901.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25901/head:pull/25901 PR: https://git.openjdk.org/jdk/pull/25901 From egahlin at openjdk.org Thu Jun 19 15:39:06 2025 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 19 Jun 2025 15:39:06 GMT Subject: RFR: 8360039: JFR: Improve parser logging of constants Message-ID: <7KEf12IUWBnN6BHHiKTT0mh7e0sPhHqzu8PPH4CUmgA=.c1d47d86-d046-4b16-a778-6dcb216d7016@github.com> Could I have a review of the PR that improves logging in the JFR parser for arrays? Testing: test/jdk/jdk/jfr Thanks Erik ------------- Commit messages: - Initial Changes: https://git.openjdk.org/jdk/pull/25903/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25903&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8360039 Stats: 23 lines in 1 file changed: 18 ins; 3 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/25903.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25903/head:pull/25903 PR: https://git.openjdk.org/jdk/pull/25903 From mgronlun at openjdk.org Thu Jun 19 16:44:26 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Thu, 19 Jun 2025 16:44:26 GMT Subject: [jdk25] RFR: 8359895: JFR: method-timing view doesn't work In-Reply-To: <-wCIbDMiqJuDZvXgZlMnhPYPNiONxYW9P0TvtYOAuMM=.6b53c34e-65fc-4a67-935d-70ae2473c2dd@github.com> References: <-wCIbDMiqJuDZvXgZlMnhPYPNiONxYW9P0TvtYOAuMM=.6b53c34e-65fc-4a67-935d-70ae2473c2dd@github.com> Message-ID: On Thu, 19 Jun 2025 15:02:32 GMT, Erik Gahlin wrote: > 8359895: JFR: method-timing view doesn't work Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25901#pullrequestreview-2943630260 From mgronlun at openjdk.org Thu Jun 19 16:45:33 2025 From: mgronlun at openjdk.org (Markus =?UTF-8?B?R3LDtm5sdW5k?=) Date: Thu, 19 Jun 2025 16:45:33 GMT Subject: [jdk25] RFR: 8359242: JFR: Missing help text for method trace and timing In-Reply-To: <46Bx5apRRtfaMPLPUC4GYrx-ptArCi63I1AHfYZnCgw=.ec42f056-9570-4171-97f3-57108afa8694@github.com> References: <46Bx5apRRtfaMPLPUC4GYrx-ptArCi63I1AHfYZnCgw=.ec42f056-9570-4171-97f3-57108afa8694@github.com> Message-ID: On Thu, 19 Jun 2025 14:38:12 GMT, Erik Gahlin wrote: > 8359242: JFR: Missing help text for method trace and timing Marked as reviewed by mgronlun (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/25899#pullrequestreview-2943631380