Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

There's problem with sampling summary when --sample-display-row is used #53

@PrzemekWirkus

Description

@PrzemekWirkus

Description

With --sample-display-row flag set, we can see that sampling "total" summary is "shifted" under "sample source" line and above sampling symbols list:

======================== sample source: ld_spec, top 5 hot functions ========================
           93.75%  1200  top 5 in total
        overhead  count  symbol
        ========  =====  ======
           80.86   1035  static struct _longobject * x_mul(struct _longobject *, struct _longobject *):python312_d.dll

For above 93.75% 1200 top 5 in total should be under symbol list. See example below with full listing of the example sampling with and without troublesome flag.

Example

>wperf record -e ld_spec:100000 -c 1 --sample-display-row 5  --sample-display-long --timeout 30 -- cpython\PCbuild\arm64\python_d.exe -c 10**10**100
base address of 'cpython\PCbuild\arm64\python_d.exe': 0x7ff765fe1288, runtime delta: 0x7ff625fe0000
sampling .....e..e..e..e..e done!
======================== sample source: ld_spec, top 5 hot functions ========================
           93.75%  1200  top 5 in total
        overhead  count  symbol
        ========  =====  ======
           80.86   1035  static struct _longobject * x_mul(struct _longobject *, struct _longobject *):python312_d.dll
            5.08     65  static unsigned int v_isub(unsigned int *, __int64, unsigned int *, __int64):python312_d.dll
            3.52     45  _Py_atomic_load_32bit_impl:python312_d.dll
            2.19     28  static unsigned int v_iadd(unsigned int *, __int64, unsigned int *, __int64):python312_d.dll
            2.11     27  PyErr_CheckSignals:python312_d.dll

              17.297 seconds time elapsed
>wperf record -e ld_spec:100000 -c 1 --sample-display-long --timeout 30 -- cpython\PCbuild\arm64\python_d.exe -c 10**10**100
base address of 'cpython\PCbuild\arm64\python_d.exe': 0x7ff765fe1288, runtime delta: 0x7ff625fe0000
sampling .....e..e..e..e..e done!
======================== sample source: ld_spec, top 50 hot functions ========================
        overhead  count  symbol
        ========  =====  ======
           77.89    997  static struct _longobject * x_mul(struct _longobject *, struct _longobject *):python312_d.dll
            4.69     60  static unsigned int v_isub(unsigned int *, __int64, unsigned int *, __int64):python312_d.dll
            4.38     56  _Py_atomic_load_32bit_impl:python312_d.dll
            3.28     42  static unsigned int v_iadd(unsigned int *, __int64, unsigned int *, __int64):python312_d.dll
            2.66     34  PyErr_CheckSignals:python312_d.dll
            2.03     26  unknown
            1.41     18  static struct _longobject * x_add(struct _longobject *, struct _longobject *):python312_d.dll
            0.78     10  _Py_atomic_load_64bit_impl:python312_d.dll
            0.62      8  static int _Py_ThreadCanHandleSignals(struct _is *):python312_d.dll
            0.55      7  static unsigned __int64 read_size_t(const void *):python312_d.dll
            0.31      4  static void _PyMem_DebugCheckAddress(const char *, char, const void *):python312_d.dll
            0.31      4  _PyErr_CheckSignalsTstate:python312_d.dll
            0.16      2  static void _Py_DECREF_SPECIALIZED(struct _object *,  *):python312_d.dll
            0.16      2  static void write_size_t(void *, unsigned __int64):python312_d.dll
            0.16      2  static struct _longobject * k_mul(struct _longobject *, struct _longobject *):python312_d.dll
            0.16      2  static struct _longobject * long_normalize(struct _longobject *):python312_d.dll
            0.08      1  static void _PyObject_Init(struct _object *, struct _typeobject *):python312_d.dll
            0.08      1  _PyMem_DebugRawFree:python312_d.dll
            0.08      1  static void * _PyMem_DebugRawAlloc(int, void *, unsigned __int64):python312_d.dll
            0.08      1  _PyMem_RawFree:python312_d.dll
            0.08      1  _PyMem_DebugMalloc:python312_d.dll
            0.08      1  static struct _ts * tstate_tss_get(struct _Py_tss_t *):python312_d.dll
          100.00%  1280  top 22 in total

              17.053 seconds time elapsed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions