Skip to content

Instantly share code, notes, and snippets.

import java.lang.management.ManagementFactory
import kotlin.math.abs
class CpuBurner(val timePeriodMs: Long, val totalCpu: Int) {
fun burnCpu() {
burnCpuInternal( totalCpu , 1 )
}
fun burnCpuInternal( remainingPercentage: Int, idx: Int) {
if (remainingPercentage <= 0) return

Keybase proof

I hereby claim:

  • I am lifey on github.
  • I am lifey (https://keybase.io/lifey) on keybase.
  • I have a public key whose fingerprint is AC73 2FE2 8078 8D30 A452 12B1 C842 339E FE24 14EE

To claim this, I am signing this object:

/*
Welcome to the game show "lies and benchmarks".
We will present the participants a required result, and they would build a
benchmark that reaches the predetermined conclusions.
When done professionally, this activity is called "benchmarketing".
Our task for today is to prove LongAdder is slower than AtomicLong. Our
observation is, LongAdder prevents write contention to a single a atomic