Skip to content

Create `record` command.

  • Creates record command which automatically spawns the executable named by the pe_file command line option
  • For now you can't spawn anything on CPUs with more than 64 processors.
  • Waits for 1s after spawning the process to start reading information, this should be configurable in the future.

@PrzemekWirkus two things are different here than the other MR. First I let the application create its own console, this was breaking python_d.exe. I also found a bug where I was using a DWORD variable instead of DWORD_PTR for the affinity. Hopefully this fixes stuff for at least 64 processors but I of course cant test.

Output for record using main.exe

PS C:\Users\everton> .\wperf record -e ld_spec:100000 -pe_file main.exe -c 1 --timeout 5 --verbose --annotate
deduced image name 'main.exe'
deduced image PDB file 'main.pdb'
main.exe pid is 8172
================================
                    KERNEL32.DLL          0x000000007ff922d90000          C:\WINDOWS\System32\KERNEL32.DLL
                  KERNELBASE.dll          0x000000007ff920cb0000          C:\WINDOWS\System32\KERNELBASE.dll
                        main.exe          0x000000007ff714e50000          C:\Users\everton\main.exe
                       ntdll.dll          0x000000007ff924dd0000          C:\WINDOWS\SYSTEM32\ntdll.dll
================================
                        main.exe          C:\Users\everton\main.exe
                           .text          0x00000000000000001000                         0xb793b
                          .rdata          0x000000000000000b9000                          0xfc7e
                           .data          0x000000000000000c9000                          0x2f71
                          .pdata          0x000000000000000cc000                          0x3a20
                          .idata          0x000000000000000d0000                          0x0ea1
                          .00cfg          0x000000000000000d1000                          0x0151
                          .reloc          0x000000000000000d2000                          0x11e2
base address of 'main.exe': 0x7ff714e55e78, runtime delta: 0x7ff5d4e50000
sampling ....eeee done!
=================
sample generated: 129
sample dropped  : 1
sample drop rate: 0.78%
Sampling stopped, process pid=8172 exited with code 0x0103
======================== sample source: ld_spec, top 50 hot functions ========================
                   0x000000007ff714e6ba2c       40
                   0x000000007ff714e6ba30       20
                   0x000000007ff714e6ba28       16
                   0x000000007ff714e6ba34       16
                   0x000000007ff714e6ba3c       10
                   0x000000007ff714e6ba20        9
                   0x000000007ff714e6ba48        5
                   0x000000007ff714e6ba50        4
                   0x000000007ff714e6ba58        4
                   0x000000007ff714e6ba38        2
simd_hot
        filename                                                line_number  hits
        ========                                                ===========  ====
        C:\Users\przemek\Desktop\wperf\merge-retquest\94\lib.c  23           128
        overhead  count  symbol
        ========  =====  ======
          100.00    128  simd_hot
100.00%       128  top 1 in total

Output for record command using python_d.exe executable

PS C:\Users\everton> .\wperf record -e ld_spec:100000 -pe_file local\arm64\python_d.exe  -c 1 --timeout 30 --verbose --annotate
deduced image name 'local\arm64\python_d.exe'
deduced image PDB file 'local\arm64\python_d.pdb'
local\arm64\python_d.exe pid is 4940
================================
                    ADVAPI32.dll          0x000000007ff924280000          C:\WINDOWS\System32\ADVAPI32.dll
                    KERNEL32.DLL          0x000000007ff922d90000          C:\WINDOWS\System32\KERNEL32.DLL
                  KERNELBASE.dll          0x000000007ff920cb0000          C:\WINDOWS\System32\KERNELBASE.dll
                      RPCRT4.dll          0x000000007ff924b70000          C:\WINDOWS\System32\RPCRT4.dll
               VCRUNTIME140D.dll          0x000000007ff8f2920000          C:\WINDOWS\SYSTEM32\VCRUNTIME140D.dll
                     VERSION.dll          0x000000007ff900a20000          C:\WINDOWS\SYSTEM32\VERSION.dll
                      WS2_32.dll          0x000000007ff9240e0000          C:\WINDOWS\System32\WS2_32.dll
                      bcrypt.dll          0x000000007ff91f570000          C:\WINDOWS\SYSTEM32\bcrypt.dll
            bcryptprimitives.dll          0x000000007ff920760000          C:\WINDOWS\System32\bcryptprimitives.dll
                      msvcrt.dll          0x000000007ff9228f0000          C:\WINDOWS\System32\msvcrt.dll
                       ntdll.dll          0x000000007ff924dd0000          C:\WINDOWS\SYSTEM32\ntdll.dll
                 python313_d.dll          0x000000007ff8b7ae0000          C:\Users\everton\local\arm64\python313_d.dll
                    python_d.exe          0x000000007ff72c940000          C:\Users\everton\local\arm64\python_d.exe
                     sechost.dll          0x000000007ff924420000          C:\WINDOWS\System32\sechost.dll
                   ucrtbased.dll          0x000000007ff8d07d0000          C:\WINDOWS\SYSTEM32\ucrtbased.dll
================================
                 python313_d.dll          C:\Users\everton\local\arm64\python313_d.dll
                           .text          0x00000000000000001000                        0x83e85d
                          .rdata          0x00000000000000840000                        0x3104a7
                           .data          0x00000000000000b51000                        0x133ff9
                          .pdata          0x00000000000000c85000                         0x1a378
                          .idata          0x00000000000000ca0000                          0x3b19
                        PyRuntim          0x00000000000000ca4000                         0x89a53
                            .tls          0x00000000000000d2e000                          0x0312
                          .00cfg          0x00000000000000d2f000                          0x0151
                           .rsrc          0x00000000000000d30000                          0x0d96
                          .reloc          0x00000000000000d31000                         0x20e29
                    python_d.exe          C:\Users\everton\local\arm64\python_d.exe
                           .text          0x00000000000000001000                          0x6b81
                          .rdata          0x00000000000000008000                          0x1a46
                           .data          0x0000000000000000a000                          0x01e1
                          .pdata          0x0000000000000000b000                          0x0320
                          .idata          0x0000000000000000c000                          0x0b34
                          .00cfg          0x0000000000000000d000                          0x0151
                           .rsrc          0x0000000000000000e000                         0x17cc9
                          .reloc          0x00000000000000026000                          0x01af
base address of 'local\arm64\python_d.exe': 0x7ff72c941270, runtime delta: 0x7ff5ec940000
sampling .....eeeeeee.eeeeeeee.eeeeeee.eee done!
=================
sample generated: 544
sample dropped  : 4
sample drop rate: 0.74%
Sampling stopped, process pid=4940 exited with code 0x0103
======================== sample source: ld_spec, top 50 hot functions ========================
                   0x000000007ff8b7e47f98       32
                   0x000000007ff8b7e47fa8       28
                   0x000000007ff8b7e47f8c       25
                   0x000000007ff8b7e47f40       24
                   0x000000007ff8b7e47f4c       21
                   0x000000007ff8b7e47f54       21
                   0x000000007ff8b7e47f3c       19
                   0x000000007ff8b7e47f78       18
                   0x000000007ff8b7e47f6c       18
                   0x000000007ff8b7e47f30       17
x_mul:python313_d.dll
        filename                                                  line_number  hits
        ========                                                  ===========  ====
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,559        152
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,560        75
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,561        38
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,562        37
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,558        26
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,563        7
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,540        3
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,550        3
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,564        3
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,570        3
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,538        1
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,541        1
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,542        1
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,549        1
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,552        1
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,557        1
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,586        1
                   0x000000007ff9165d87d4        9
                   0x000000007ff9165d87d0        7
                   0x000000007ff9165d87e4        3
                   0x000000007ff92056b778        3
                   0x000000007ff9165d87dc        3
                   0x000000007ff924de1780        2
                   0x000000007ff91b1533ec        2
                   0x000000007ff9165d86c0        2
                   0x000000007ff8ffa731d8        2
                   0x000000007ff8b7ae6b34        2
                   0x000000007ff8b7e46a38        3
                   0x000000007ff8b7e46a10        2
                   0x000000007ff8b7e46a04        2
                   0x000000007ff8b7e469b8        2
                   0x000000007ff8b7e46a1c        2
                   0x000000007ff8b7e469c8        2
                   0x000000007ff8b7e469dc        1
                   0x000000007ff8b7e469ec        1
                   0x000000007ff8b7e469a8        1
                   0x000000007ff8b7e469f8        1
v_iadd:python313_d.dll
        filename                                                  line_number  hits
        ========                                                  ===========  ====
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,521        6
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,520        5
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,523        4
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,519        3
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,522        1
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,524        1
                   0x000000007ff8b7e46c3c        3
                   0x000000007ff8b7e46c34        2
                   0x000000007ff8b7e46c74        2
                   0x000000007ff8b7e46c20        2
                   0x000000007ff8b7e46c48        2
                   0x000000007ff8b7e46c44        2
                   0x000000007ff8b7e46c50        2
                   0x000000007ff8b7e46c88        1
                   0x000000007ff8b7e46c0c        1
                   0x000000007ff8b7e46c70        1
v_isub:python313_d.dll
        filename                                                  line_number  hits
        ========                                                  ===========  ====
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,546        14
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,547        3
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,545        2
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  1,549        1
                   0x000000007ff8b7c431b0        3
                   0x000000007ff8b7c431d8        1
                   0x000000007ff8b7c430a0        1
                   0x000000007ff8b7c43094        1
                   0x000000007ff8b7c43184        1
                   0x000000007ff8b7c431a4        1
                   0x000000007ff8b7c43174        1
                   0x000000007ff8b7c431c4        1
_Py_atomic_load_32bit_impl:python313_d.dll
        filename                                                              line_number  hits
        ========                                                              ===========  ====
        C:\Users\evert\source\repos\cpython\Include\internal\pycore_atomic.h  492          5
        C:\Users\evert\source\repos\cpython\Include\internal\pycore_atomic.h  468          1
        C:\Users\evert\source\repos\cpython\Include\internal\pycore_atomic.h  470          1
        C:\Users\evert\source\repos\cpython\Include\internal\pycore_atomic.h  486          1
        C:\Users\evert\source\repos\cpython\Include\internal\pycore_atomic.h  491          1
        C:\Users\evert\source\repos\cpython\Include\internal\pycore_atomic.h  496          1
                   0x000000007ff8b7e47150        1
                   0x000000007ff8b7e47114        1
                   0x000000007ff8b7e47148        1
                   0x000000007ff8b7e470e0        1
                   0x000000007ff8b7e47120        1
                   0x000000007ff8b7e470f0        1
                   0x000000007ff8b7e470ec        1
x_add:python313_d.dll
        filename                                                  line_number  hits
        ========                                                  ===========  ====
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,370        4
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,371        2
        C:\Users\evert\source\repos\cpython\Objects\longobject.c  3,369        1
                   0x000000007ff8b7cb0688        1
                   0x000000007ff8b7cb0528        1
                   0x000000007ff8b7cb0574        1
                   0x000000007ff8b7cb0564        1
                   0x000000007ff8b7cb0670        1
PyErr_CheckSignals:python313_d.dll
        filename                                                    line_number  hits
        ========                                                    ===========  ====
        C:\Users\evert\source\repos\cpython\Modules\signalmodule.c  1,769        2
        C:\Users\evert\source\repos\cpython\Modules\signalmodule.c  1,760        1
        C:\Users\evert\source\repos\cpython\Modules\signalmodule.c  1,774        1
        C:\Users\evert\source\repos\cpython\Modules\signalmodule.c  1,778        1
                   0x000000007ff8b7cb2174        1
                   0x000000007ff8b7cb2188        1
                   0x000000007ff8b7cb2148        1
                   0x000000007ff8b7cb217c        1
                   0x000000007ff8b7cb2130        1
_Py_ThreadCanHandleSignals:python313_d.dll
        filename                                                               line_number  hits
        ========                                                               ===========  ====
        C:\Users\evert\source\repos\cpython\Include\internal\pycore_pystate.h  59           4
        C:\Users\evert\source\repos\cpython\Include\internal\pycore_pystate.h  58           1
                   0x000000007ff8b8296104        1
                   0x000000007ff8b82960f8        1
PyThread_get_thread_ident:python313_d.dll
        filename                                                line_number  hits
        ========                                                ===========  ====
        C:\Users\evert\source\repos\cpython\Python\thread_nt.h  227          1
        C:\Users\evert\source\repos\cpython\Python\thread_nt.h  230          1
                   0x000000007ff8b7cb0c7c        1
                   0x000000007ff8b7cb0c8c        1
_PyErr_CheckSignalsTstate:python313_d.dll
        filename                                                    line_number  hits
        ========                                                    ===========  ====
        C:\Users\evert\source\repos\cpython\Modules\signalmodule.c  1,787        1
        C:\Users\evert\source\repos\cpython\Modules\signalmodule.c  1,788        1
                   0x000000007ff8b807c710        1
sum_raw:python313_d.dll
        filename                                             line_number  hits
        ========                                             ===========  ====
        C:\Users\evert\source\repos\cpython\Parser\parser.c  13,525       1
                   0x000000007ff8b7e6d1d4        1
_PyMem_DebugFree:python313_d.dll
        filename                                                line_number  hits
        ========                                                ===========  ====
        C:\Users\evert\source\repos\cpython\Objects\obmalloc.c  2,171        1
                   0x000000007ff8b7e6d400        1
_PyMem_DebugRawAlloc:python313_d.dll
        filename                                                line_number  hits
        ========                                                ===========  ====
        C:\Users\evert\source\repos\cpython\Objects\obmalloc.c  1,988        1
                   0x000000007ff8b7e6d590        1
_PyMem_DebugRawFree:python313_d.dll
        filename                                                line_number  hits
        ========                                                ===========  ====
        C:\Users\evert\source\repos\cpython\Objects\obmalloc.c  2,024        1
                   0x000000007ff8b7e742dc        1
write_size_t:python313_d.dll
        filename                                                line_number  hits
        ========                                                ===========  ====
        C:\Users\evert\source\repos\cpython\Objects\obmalloc.c  1,906        1
        overhead  count  symbol
        ========  =====  ======
           65.56    354  x_mul:python313_d.dll
           20.37    110  unknown
            3.70     20  v_iadd:python313_d.dll
            3.70     20  v_isub:python313_d.dll
            1.85     10  _Py_atomic_load_32bit_impl:python313_d.dll
            1.30      7  x_add:python313_d.dll
            0.93      5  PyErr_CheckSignals:python313_d.dll
            0.93      5  _Py_ThreadCanHandleSignals:python313_d.dll
            0.37      2  PyThread_get_thread_ident:python313_d.dll
            0.37      2  _PyErr_CheckSignalsTstate:python313_d.dll
            0.19      1  sum_raw:python313_d.dll
            0.19      1  _PyMem_DebugFree:python313_d.dll
            0.19      1  _PyMem_DebugRawAlloc:python313_d.dll
            0.19      1  _PyMem_DebugRawFree:python313_d.dll
            0.19      1  write_size_t:python313_d.dll
100.00%       540  top 15 in total

Merge request reports