How to find downtime (and network entry time, etc.) in XPerf?

Let's say I have a far-fetched program:

#include <Windows.h>

void useless_function()
{
    Sleep(5000);
}

void useful_function()
{
    // ... do some work
    useless_function();
    // ... do some more work
}

int main()
{
    useful_function();
    return 0;
}

Purpose . I want the profiler to tell me what is useful_function()useless causing useless_function(), which does not wait for obvious reasons. In XPerf, this is not displayed on any of the graphs that I have, because the call WaitForMultipleObjects()seems to be taken into account Idle.exeinstead of my own program.

And here is the xperf command line that I am running now:

xperf -on Latency -stackwalk Profile

Any ideas?

(This is not limited to standby functions. The above can be solved by placing breakpoints in NtWaitForMultipleObjects. Ideally, there might be a way to see a stack sample that takes a lot of wall clock time, unlike just CPU time)

+3
3

, , , - Ready Thread Xperf. , ( ). sleep (5000), , .

. , , :

Xperf

+2

- . :

  • CSWITCH, .
  • , + CSWITCH -stackwalk
  • , , , (.. Mutex CS ), + READYTHREAD -stackwalk

CPU (Precise) WPA ( xperfview, ), , TimeSinceLast , . (Precise) :

  • NewProcess ( )
  • NewThreadId
  • NewThreadStack
  • ReadyingProcess ( )
  • ReadyingThreadId ()
  • ReadyThreadStack (, + ReadyThread on -stackwalk)
  • Count
  • TimeSinceLast (us) - ,
  • ,

. :  - https://randomascii.wordpress.com/2014/08/19/etw-training-videos-available-now/  - https://randomascii.wordpress.com/2012/06/19/wpaxperf-trace-analysis-reimagined/

+1

"" - . do some work 5 , do some more work 5 , 33% :

main: calling useful_function
useful_function: calling useless_function
useless_function: calling Sleep

, 33% . , , .

, .

, , Zoom LTProf, .

xperf doc, , . , Windows 7 Vista. , , , , . , , , , , , .

0

Source: https://habr.com/ru/post/1774717/


All Articles