Skip to content

Commit bd461b4

Browse files
committed
Sort timer entries
1 parent 8cf4302 commit bd461b4

File tree

1 file changed

+6
-2
lines changed
  • src/main/java/org/radarbase/hdfs/util

1 file changed

+6
-2
lines changed

src/main/java/org/radarbase/hdfs/util/Timer.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ import java.util.concurrent.ConcurrentHashMap
2121
import java.util.concurrent.ConcurrentMap
2222
import java.util.concurrent.atomic.LongAdder
2323
import org.radarbase.hdfs.util.ProgressBar.Companion.appendTime
24+
import java.util.*
2425

2526
/** Timer for multi-threaded timings. The timer may be disabled to increase program performance. */
2627
object Timer {
2728
private val shutdownHook = Thread({ println(Timer) }, "Timer")
2829
private val times: ConcurrentMap<String, MutableTimerEntry> = ConcurrentHashMap()
2930

30-
/** All currently measured timings. This returns a thread-safe snapshot of the current state. */
31+
/**
32+
* All currently measured timings.
33+
* This returns a thread-safe sorted snapshot of the current state.
34+
*/
3135
val timings: Map<String, TimerEntry>
32-
get() = times.mapValues { it.value.toTimerEntry() }
36+
get() = times.mapValuesTo(TreeMap()) { it.value.toTimerEntry() }
3337

3438
/**
3539
* Whether the timer is enabled. A disabled timer will have much less performance impact on

0 commit comments

Comments
 (0)