If you are looking to do this in Java, then the API doesn't provide such means. You will have to resort to a platform dependent way of doing this.
You could perhaps use JNI/JNA to do this natively for different operating systems:
- Windows - Performance Counters
- Linux - getrusage
If you mean to do this with pidstat, then you should really ask this question in SuperUser.com. However, as far as I know you can add -t
to your pidstat
command, so that it looks like so:
pidstat -w -I -t -p <pid> 3
It will list stats for all the threads of the process.