Skip to content

3.15 what's new profiling example arguments seem incorrect #140727

@dimaqq

Description

@dimaqq

Documentation

The doc states at https://docs.python.org/3.15/whatsnew/3.15.html#pep-799-high-frequency-statistical-sampling-profiler:

Profile process 1234 for 10 seconds with default settings:

python -m profiling.sampling 1234 

At least on macOS, the argument "1234" is interpreted as a Python script to run, not a PID:

(jgol-peer) 🦐/c/j/peer (main)> sudo -E env PYTHONPATH=src python -m profiling.sampling 1234 Profiler coordinator error: Script not found: /code/jgol/peer/1234 ... ... TypeError: Cannot create or construct a <class 'pstats.SampledStats'> object from <profiling.sampling.pstats_collector.PstatsCollector object at 0x1036441a0>

Meanwhile a Python script is accepted:

(jgol-peer) 🦐/c/j/peer (main)> echo "import ops" > foo.py (jgol-peer) 🦐/c/j/peer (main)> sudo -E env PYTHONPATH=src python -m profiling.sampling foo.py Captured 586 samples in 0.06 seconds Sample rate: 10000.02 samples/sec Error rate: 7.17% Profile Stats: ... ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions