So I am writing a profiler and the time the threads were not executing is relevant to my calculation. However, all the libraries I know provide the time for which the threads were executing e.g getrusage.
getrusage returns the time the threads were executing, so if I can somehow get the time elapsed since the thread was made (or the time the thread was made at), in principle, I can subtract getrusage's time from it and that will be the blocking time?
I instrument the code to know my metrics through an LLVM pass.