nvdv / vprof

Visual profiler for Python
BSD 2-Clause "Simplified" License
3.95k stars 154 forks source link

SIGPROF does not work on Windows #62

Closed adrientetar closed 7 years ago

adrientetar commented 7 years ago
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
PS C:\Users\Admin\Downloads\trufont> vprof -c c Lib/trufont
Running FlameGraphProfiler...
Traceback (most recent call last):
  File "C:\Python35\Scripts\vprof-script.py", line 9, in <module>
    load_entry_point('vprof==0.34', 'console_scripts', 'vprof')()
  File "c:\python35\lib\site-packages\vprof\__main__.py", line 88, in main
    source, config, verbose=True)
  File "c:\python35\lib\site-packages\vprof\runner.py", line 78, in run_profilers
    run_stats[option] = curr_profiler.run()
  File "c:\python35\lib\site-packages\vprof\flame_graph.py", line 169, in run
    prof = run_dispatcher()
  File "c:\python35\lib\site-packages\vprof\flame_graph.py", line 142, in run_as_package
    with _StatProfiler() as prof:
  File "c:\python35\lib\site-packages\vprof\flame_graph.py", line 29, in __enter__
    signal.signal(signal.SIGPROF, self.sample)
AttributeError: module 'signal' has no attribute 'SIGPROF'
adrientetar commented 7 years ago

Apparently SIGPROF isn't present on Windows:

On Windows, signal() can only be called with SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, or SIGTERM. A ValueError will be raised in any other case. Note that not all systems define the same set of signal names; an AttributeError will be raised if a signal name is not defined as SIG* module level constant.

https://docs.python.org/3/library/signal.html

nvdv commented 7 years ago

Thanks for reporting! I am aware that some of the signals do not exist in Windows, but current implementation of flame graph profiling should work under Windows Subsystem for Linux. I haven't done any extensive testing on Windows though.

Zireael07 commented 7 years ago

Why close? Do the flame graphs work on Windows now?

nvdv commented 7 years ago

Flame graphs don't work on Windows, because signal module is partially supported on Windows and I can't do much about that.

RDCH106 commented 5 years ago

@nvdv A note warning about this problem could be good.

imagen

rrousselot commented 1 year ago

Why not just ignore the c config, throw a warning and go on?