File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
backend/profiling/src/main/kotlin/dev/suresh
shared/src/jvmMain/kotlin/dev/suresh Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import kotlin.time.toJavaDuration
1616@Category(" Services" , BuildConfig .name)
1717@Period(" 1 s" )
1818@StackTrace(false )
19+ @Throttle(" 100/s" )
1920class Counter (@Label(" Count" ) private var count : Long = 0 ) : Event() {
2021 fun inc () = count++
2122}
Original file line number Diff line number Diff line change @@ -99,8 +99,10 @@ fun IntArray.codePointsToString(separator: String = "") =
9999/* * Adds a periodic event to the JFR stream. */
100100inline fun <reified T : Event > addPeriodicJFREvent (event : T , crossinline block : T .() -> Unit ) {
101101 FlightRecorder .addPeriodicEvent(T ::class .java) {
102- block(event)
103- event.commit()
102+ if (event.shouldCommit()) {
103+ block(event)
104+ event.commit()
105+ }
104106 }
105107}
106108
You can’t perform that action at this time.
0 commit comments