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
16
16
@Category(" Services" , BuildConfig .name)
17
17
@Period(" 1 s" )
18
18
@StackTrace(false )
19
+ @Throttle(" 100/s" )
19
20
class Counter (@Label(" Count" ) private var count : Long = 0 ) : Event() {
20
21
fun inc () = count++
21
22
}
Original file line number Diff line number Diff line change @@ -99,8 +99,10 @@ fun IntArray.codePointsToString(separator: String = "") =
99
99
/* * Adds a periodic event to the JFR stream. */
100
100
inline fun <reified T : Event > addPeriodicJFREvent (event : T , crossinline block : T .() -> Unit ) {
101
101
FlightRecorder .addPeriodicEvent(T ::class .java) {
102
- block(event)
103
- event.commit()
102
+ if (event.shouldCommit()) {
103
+ block(event)
104
+ event.commit()
105
+ }
104
106
}
105
107
}
106
108
You can’t perform that action at this time.
0 commit comments