mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[ijent benchmarks] Reinit open telemetry histogram in benchmark tests
GitOrigin-RevId: 7a0d77425ad6aa5ef462b6023c94c4d780a1a644
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2854780d0a
commit
3a254ff47c
@@ -23,7 +23,7 @@ internal val eventsCounterMeter = ijentMeter.counterBuilder("ijent.events.count"
|
||||
}
|
||||
|
||||
// TODO: probably should avoid initialization of ~ 30 histograms each with ~ 10K elements in production (use special flag?)
|
||||
private val histograms: Map<Measurer.Operation, LongHistogram> = Measurer.Operation.entries.associate { it to initHistogram(it) }
|
||||
private lateinit var histograms: Map<Measurer.Operation, LongHistogram>
|
||||
|
||||
|
||||
/**
|
||||
@@ -52,13 +52,17 @@ private fun generateHistogramBucketsBoundaries(): List<Double> {
|
||||
.map { it.toDouble() }
|
||||
}
|
||||
|
||||
private fun initHistogram(operation: Measurer.Operation): LongHistogram = ijentMeter.histogramBuilder("ijent.${operation.name}")
|
||||
internal fun initHistogram(operation: Measurer.Operation): LongHistogram = ijentMeter.histogramBuilder("ijent.${operation.name}")
|
||||
.setExplicitBucketBoundariesAdvice(generateHistogramBucketsBoundaries())
|
||||
.setUnit("ns")
|
||||
.ofLongs()
|
||||
.build()
|
||||
|
||||
object Measurer {
|
||||
init {
|
||||
reInitTelemetryHistograms()
|
||||
}
|
||||
|
||||
enum class Operation {
|
||||
directoryStreamClose,
|
||||
directoryStreamIteratorNext,
|
||||
@@ -91,6 +95,10 @@ object Measurer {
|
||||
seekableByteChannelWrite,
|
||||
supportedFileAttributeViews;
|
||||
}
|
||||
|
||||
fun reInitTelemetryHistograms() {
|
||||
histograms = Measurer.Operation.entries.associate { it to initHistogram(it) }
|
||||
}
|
||||
}
|
||||
|
||||
internal inline fun <T> Measurer.measure(operation: Measurer.Operation, body: () -> T): T {
|
||||
|
||||
Reference in New Issue
Block a user