Skip to content

Add -m switch to vmprof cli - #259

Merged
mattip merged 1 commit into
vmprof:masterfrom
BarrensZeppelin:master
Sep 26, 2024
Merged

mattip merged 1 commit into
vmprof:masterfrom
BarrensZeppelin:master

Conversation

@BarrensZeppelin

Copy link
Copy Markdown
Contributor

It makes vmprof run the specified program with runpy.run_module instead of runpy.run_path.

@mattip

mattip commented Mar 6, 2024

Copy link
Copy Markdown
Contributor

Could you add a test for this, and add it to the documentation?

It makes vmprof run the specified program with `runpy.run_module`
instead of `runpy.run_path`.
@BarrensZeppelin

Copy link
Copy Markdown
Contributor Author

Like this? 🙂

@mattip

mattip commented Mar 7, 2024

Copy link
Copy Markdown
Contributor

Yes, thanks. I assume you have run this and it successfully calls the module as expected?

@BarrensZeppelin

Copy link
Copy Markdown
Contributor Author

Yeah. http.server is a bad example for performance profiling, but it seems to work:

$ python3 -m vmprof --output file.prof -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [07/Mar/2024 17:56:57] "GET / HTTP/1.1" 200 -
^C
Keyboard interrupt received, exiting.
$ vmprofshow file.prof flat
   100.000% - <unknown code>:None:None
     0.000% - <module>:/opt/pypy3/lib/pypy3.10/http/server.py:1
     0.000% - __import__:<frozen importlib._bootstrap>:1117
     0.000% - _gcd_import:<frozen importlib._bootstrap>:1038
     0.000% - _find_and_load:<frozen importlib._bootstrap>:1022
     0.000% - _find_and_load_unlocked:<frozen importlib._bootstrap>:987
     0.000% - _load_unlocked:<frozen importlib._bootstrap>:664
     0.000% - exec_module:<builtin>/frozen importlib._bootstrap_external:891
     0.000% - _call_with_frames_removed:<frozen importlib._bootstrap>:233
     0.000% - <module>:/opt/pypy3/lib/pypy3.10/html/__init__.py:1
     0.000% - get_code:<builtin>/frozen importlib._bootstrap_external:964
     0.000% - source_to_code:<builtin>/frozen importlib._bootstrap_external:956
     0.000% - _code_to_timestamp_pyc:<builtin>/frozen importlib._bootstrap_external:697

@mattip
mattip merged commit 5d0f397 into vmprof:master Sep 26, 2024
@mattip

mattip commented Sep 26, 2024

Copy link
Copy Markdown
Contributor

Thanks @BarrensZeppelin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants