MCPcopy Create free account
hub / github.com/Snapchat/Valdi / toThreadPriority

Method toThreadPriority

valdi/src/java/com/snap/valdi/utils/QoSClass.kt:12–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10 MAX(4);
11
12 fun toThreadPriority(): Int {
13 val qosClassRatio = value.toDouble() / MAX.value.toDouble()
14 val threadPriorityOffset = (Thread.MAX_PRIORITY - Thread.MIN_PRIORITY).toDouble() * qosClassRatio
15 val threadPriority = Thread.MIN_PRIORITY + threadPriorityOffset.roundToInt()
16
17 return Math.min(Math.max(threadPriority, Thread.MIN_PRIORITY), Thread.MAX_PRIORITY)
18 }
19
20 companion object {
21 @JvmStatic

Callers 2

startMethod · 0.80
ValdiThreadClass · 0.80

Calls 1

toDoubleMethod · 0.45

Tested by

no test coverage detected