Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -m switch to vmprof cli #259

Merged
merged 1 commit into from
Sep 26, 2024
Merged

Add -m switch to vmprof cli #259

merged 1 commit into from
Sep 26, 2024

Conversation

BarrensZeppelin
Copy link
Contributor

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

@mattip
Copy link
Contributor

mattip commented Mar 6, 2024

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
Contributor Author

Like this? 🙂

@mattip
Copy link
Contributor

mattip commented Mar 7, 2024

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

@BarrensZeppelin
Copy link
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
6 of 7 checks passed
@mattip
Copy link
Contributor

mattip commented Sep 26, 2024

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