ThreadPool tasks not included in results

I have a large, computationally intensive application that spins off tasks using ThreadPool.QueueUserWorkItem. It is clear from hit counts and timing data that some of these tasks are being overlooked (execution completely ignored) in the reported results. In some cases, the same method is queued twice at different times and only one of the invocations contributes to the profiled results.

This is a .NET 2.0 application (C#). I am using Ants 3.1.0.20 on Windows XP Pro SP 2 and a dual-core machine.

I am not expecting you can do anything about this - don't have time to try and simplify the code to something I can share with you - but I wanted to report the issue.

Sincerely,

Chris Stover

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Chris,

    If I remember correctly, Profiler has a problem on multi-processor systems in that threads that end up running concurrently on a processor other than the one the main thread is running on disappear in the results. The workaround for v3 would be to get a third-party utility to set the processor affinity for the process.

    This may be getting fixed in v4 -- let me check with the developers tomorrow and see if this will work in v4 and if there is a better solution for v3.
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi,

    Just to confirm what I'd said yesterday, ANTS Profiler v4 will force all threads in a process to use the same core or physical processor.

    ANTS Profiler 3 cannot do this, so you may want to use something like Process Lasso to permanently set affinity for the process whenever it starts up.

    I hope this helps!
Sign In or Register to comment.