During profiling exclude time taken by sleeps called from a specific class

98 Views Asked by At

I am profiling my application and I see a lot of time is taken in sleep. There a lot of places where sleep is called. Sleep gets called because a thread is waiting on a resource in a lot of places. But there are background tasks that run from time to time performing some cleanup activities, etc. These jobs sleep between every run.

I would like to profile my application in such a way that it does not include any time taken by sleep when called from the background jobs(which is a specific class, lets call it "class BackGroundJobs"). I just want to get the time the application/thread sleeps which is not because of this. Basically, I would like to exclude the sleeps because of this. Can somebody tell me how to do this?

I tried doing this,

vsinstr.exe /exclude="BackGroundJobs::*" Executable.exe

and collected the profiling data.

This only does not work done by the class BackGroundJobs, but still includes the sleep time that the BackGroundJobs calls since sleep is not part of the BackGroundJobs. Can somebody tell me how to exclude that?

Just for an example, numbers are all imaginary examples,

Class::A::meth(time taken by the class in its activities 5s) --> Calls Sleep 20s Class::B::meth(time taken by the class in its activities 5s) --> Class Sleep 20s BackGroundJobs(time taken by the class in its activities 10s) --> Class Sleep 20s

In the profiling results : Time taken by Class A::meth : 5s Time taken by Class B::meth : 5s Time taken by BackGroundJobs : 0s(not present in the report, since it is excluded) Time taken by Sleep : 20s(by A::meth)+20s(B::meth)+20s(BackGroundJobs::xxx) = 60s

I would like the Sleep to be calculated as follows, Time taken by Sleep : 20s(by A::meth)+20s(B::meth)+0s(BackGroundJobs::xxx) = 40s

How do I achieve this?

TIA

0

There are 0 best solutions below