How can I get the runtime a thread in java such as: at 00:30 minutes of Thread[n], something() happened.
I'm basically looking to make a log file for a program dealing with audio files.
Thank you.
You can get the System.nanoTime()
in the beginning and then calculate the difference at the end. Then use TimeUnit
to convert to a more useful unit.
Also check the ThreadMXBean
which is an MBean giving info about threads.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With