what-studio / profiling Goto Github PK
View Code? Open in Web Editor NEWWas an interactive continuous Python profiler.
License: BSD 3-Clause "New" or "Revised" License
Was an interactive continuous Python profiler.
License: BSD 3-Clause "New" or "Revised" License
There is a small typo in test/test_sampling.py.
Should read expected,
rather than expaected,
.
Traceback (most recent call last):
File "/apps/python/2.7.6/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/apps/python/2.7.6/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/apps/python/2.7.6/lib/python2.7/site-packages/profiling/__main__.py", line 592, in <module>
cli(prog_name='python -m profiling')
File "/apps/python/2.7.6/lib/python2.7/site-packages/click/core.py", line 664, in __call__
return self.main(*args, **kwargs)
File "/apps/python/2.7.6/lib/python2.7/site-packages/click/core.py", line 644, in main
rv = self.invoke(ctx)
File "/apps/python/2.7.6/lib/python2.7/site-packages/click/core.py", line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/apps/python/2.7.6/lib/python2.7/site-packages/click/core.py", line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/apps/python/2.7.6/lib/python2.7/site-packages/click/core.py", line 464, in invoke
return callback(*args, **kwargs)
File "/apps/python/2.7.6/lib/python2.7/site-packages/profiling/__main__.py", line 347, in profile
dump_filename=dump_filename, mono=mono)
File "/apps/python/2.7.6/lib/python2.7/site-packages/profiling/__main__.py", line 314, in __profile__
loop.run()
File "/apps/python/2.7.6/lib/python2.7/site-packages/urwid/main_loop.py", line 278, in run
self._run()
File "/apps/python/2.7.6/lib/python2.7/site-packages/urwid/main_loop.py", line 375, in _run
self.event_loop.run()
File "/apps/python/2.7.6/lib/python2.7/site-packages/urwid/main_loop.py", line 678, in run
self._loop()
File "/apps/python/2.7.6/lib/python2.7/site-packages/urwid/main_loop.py", line 699, in _loop
ready, w, err = select.select(fds, [], fds, timeout)
select.error: (9, 'Bad file descriptor')
I have a docker container that runs uwsgi to lunch my flask app, how do I profile thing? I'd like to see performance of one of my routes that's slow.
I tried:
environment:
PYTHONPATH: ".:/code:/code/libs"
FLASK_APP: "pinqueue"
FLASK_DEBUG: "true"
PINQUEUE_ENV: "development"
USER: ${USER}
TLS_ENABLED: "true"
command: uwsgi --gevent 10 --gevent-monkey-patch --http-socket 0.0.0.0:10001 --http-websockets --module pinqueue:app --master --processes 4 --enable-threads --honour-stdin --py-autoreload=3 --buffer-size=65535
profiling script should cd to current directory because currently all relative path of profiled app are broken
e.g. if I do this:
import sys, os
PROJECT_PATH = os.path.normpath(os.path.join(sys.modules[__name__].__file__,'../'))
I will get wrong path and won't be able to add needed modules
currently __file__
reference points to: python2.7/site-packages/profiling/__main__.py
In my use case, there is an algorithm that ends up stalling after running for a long time. I would like to use live-profiling to find the exact cause when the stall happens. It would be inconvenient to dump and post analyze since the stall happens sporadically, and restarting the run is relatively expensive.
The issue I'm facing with this tool is that the profiling updates stop after a while, even though the main program is running as normal. One work around I found was to run in remote-profile mode, where even if the profiling updates stop, I can restart it again by reconnecting the viewer. However, repeating doing this eventually causes the below exception.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 35, in serve_forever
self.dispatch_sockets()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 105, in dispatch_sockets
self.connected(sock)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/init.py", line 228, in connected
self._start_profiling()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 53, in _start_profiling
self.profile_periodically()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 57, in profile_periodically
self.dispatch_sockets(self.interval)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 105, in dispatch_sockets
self.connected(sock)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/init.py", line 228, in connected
self._start_profiling()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 53, in _start_profiling
self.profile_periodically()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 57, in profile_periodically
self.dispatch_sockets(self.interval)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 105, in dispatch_sockets
self.connected(sock)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/init.py", line 228, in connected
self._start_profiling()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 53, in _start_profiling
self.profile_periodically()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 57, in profile_periodically
self.dispatch_sockets(self.interval)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 105, in dispatch_sockets
self.connected(sock)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/init.py", line 228, in connected
self._start_profiling()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 53, in _start_profiling
self.profile_periodically()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 57, in profile_periodically
self.dispatch_sockets(self.interval)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 105, in dispatch_sockets
self.connected(sock)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/init.py", line 228, in connected
self._start_profiling()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 53, in _start_profiling
self.profile_periodically()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 57, in profile_periodically
self.dispatch_sockets(self.interval)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 105, in dispatch_sockets
self.connected(sock)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/init.py", line 228, in connected
self._start_profiling()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 53, in _start_profiling
self.profile_periodically()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 57, in profile_periodically
self.dispatch_sockets(self.interval)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 105, in dispatch_sockets
self.connected(sock)
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/init.py", line 228, in connected
self._start_profiling()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 53, in _start_profiling
self.profile_periodically()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/select.py", line 56, in profile_periodically
for __ in self.profiling():
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/remote/init.py", line 180, in profiling
self.profiler.stop()
File "/home/wzli/.local/lib/python3.5/site-packages/profiling/utils.py", line 63, in stop
raise RuntimeError('Not started')
RuntimeError: Not started
getting an exception directly at starting:
Traceback (most recent call last):
File "C:\Program Files\Python27\lib\runpy.py", line 162, in run_module_as_main
"main", fname, loader, pkg_name)
File "C:\Program Files\Python27\lib\runpy.py", line 72, in run_code
exec code in run_globals
File "C:\Program Files\Python27\lib\site-packages\profiling__main.py", line 33, in
from .remote.background import START_SIGNO, STOP_SIGNO, BackgroundProfiler
File "C:\Program Files\Python27\lib\site-packages\profiling\remote\background.py", line 20, in
START_SIGNO = signal.SIGUSR1
AttributeError: 'module' object has no attribute 'SIGUSR1'
Can't profile a server with eventlet. I tried remote and live profile, but didn't work.
cmdline: python -m profiling remote-profile --timer=greenlet --bind 127.0.0.1:1234 ....
Traceback is displayed on server when I execute view.
Traceback (most recent call last):
File "/home/...../lib/python2.7/site-packages/eventlet/hubs/hub.py", line 346, in fire_timers
timer()
File "/home/...../lib/python2.7/site-packages/eventlet/hubs/timer.py", line 56, in call
cb(_args, *_kw)
File "/home/...../lib/python2.7/site-packages/eventlet/semaphore.py", line 121, in _do_acquire
waiter.switch()
error: cannot switch to a different thread
cmdline: python -m profiling live-profile --timer=greenlet ...
Only displays not available and server doesn't start..
Attempt to install profiling on Windows 7, Python 2.7 (32bit):
building 'profiling.speedup' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\profiling
C:\Program Files\TDM-GCC\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-IC:\Program Files (x86)\Python\include" "-IC:\Program Files (x86)\Python\PC" -c profiling/speedup.c -o build\temp.win32-2.7\Release\profiling\speedup.o
gcc: error: unrecognized command line option '-mno-cygwin'
Tried with MinGW-gcc 4.7.2, and TDM-gcc 4.8 and 5.1.
Hello,
I tried to profile django's dev server with profiling live-profile manage.py runserver
, but without success. The viewer seems that is showing only calls for bootstrapping django. Nothing happens as requests are made to the server. Am I missing something? Or is what I am trying to do currently not supported?
In remote/asyncio.py on line 69 the new Python 3 only syntax yield from
was used, making it not anymore compatible with Python 2 as stated in the README. It raises a SyntaxError.
When I run $ profiling live-profile manage.py runserver
on a tweaked manage.py
file that only prints the current path, I get
Exception TypeError: "'NoneType' object is not callable" in <function _remove at 0x7f75f23457d0> ignored
The contents of manage.py
are:
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
from pprint import pprint as p
p(sys.path)
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_app.settings")
# from django.core.management import execute_from_command_line
# execute_from_command_line(sys.argv)
For replication (in case you are not familiar with Django): you can start a brand new Django 1.7 project with $ django-admin startproject test_app
and then tweak manage.py
to only figure what the path is.
time.clock_gettime(clk_id)
Return the time of the specified clock clk_id.
Availability: Unix.
New in version 3.3.
time.clock_gettime is only used in Unix,can you have some method to add support to MacOS?
$ python -m profiling live-profile --timer=greenlet `which gunicorn` myweb:app
should work well.
I'm running into a weird issue while trying to profile a simple project. I isolated the problem to the Requests library.
Just by importing requests (I tested 2.6.2 and 2.7.0), profiling will throw a recursion runtime error.
I'm using OSX 10.10.5 and python 3.4. Can anyone replicate this behaviour?
Here is the isolated script:
import requests
print('Hello World')
This is the console output after it does nothing for a while:
(NOTE: It does execute the Hello World print)
(testenv)Mac:active-monitoring-plugin carlo$ python -m profiling profile ~/Desktop/weird.py
Hello World
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/__main__.py", line 674, in <module>
cli(prog_name='python -m profiling')
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/click/core.py", line 700, in __call__
return self.main(*args, **kwargs)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/click/core.py", line 680, in main
rv = self.invoke(ctx)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/click/core.py", line 1027, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/click/core.py", line 873, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/click/core.py", line 508, in invoke
return callback(*args, **kwargs)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/__main__.py", line 399, in wrapped
return f(**kwargs)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/__main__.py", line 376, in wrapped
return f(profiler_factory=profiler_factory, **kwargs)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/__main__.py", line 488, in profile
mono=mono)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/__main__.py", line 447, in __profile__
stats, cpu_time, wall_time = profiler.result()
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/tracing/__init__.py", line 123, in result
frozen_stats, cpu_time, wall_time = base.result()
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/profiler.py", line 63, in result
frozen_stats = FrozenStatistics(self.stats)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 50, in __call__
obj = super(StatisticsMeta, cls).__call__(*args, **kwargs)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 257, in __init__
self._children = self._freeze_children(stats)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 262, in _freeze_children
return [cls(s) for s in children]
...
...
...
return [cls(s) for s in children]
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 262, in <listcomp>
return [cls(s) for s in children]
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 50, in __call__
obj = super(StatisticsMeta, cls).__call__(*args, **kwargs)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 257, in __init__
self._children = self._freeze_children(stats)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 262, in _freeze_children
return [cls(s) for s in children]
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 262, in <listcomp>
return [cls(s) for s in children]
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 50, in __call__
obj = super(StatisticsMeta, cls).__call__(*args, **kwargs)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 252, in __init__
value = getattr(stats, attr)
File "/Users/carlo/.virtualenvs/testenv/lib/python3.4/site-packages/profiling/stats.py", line 186, in module
module = inspect.getmodule(self.code)
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 612, in getmodule
file = getabsfile(object, _filename)
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 595, in getabsfile
_filename = getsourcefile(object) or getfile(object)
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 583, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None:
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 612, in getmodule
file = getabsfile(object, _filename)
File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 596, in getabsfile
return os.path.normcase(os.path.abspath(_filename))
File "/Users/carlo/.virtualenvs/testenv/bin/../lib/python3.4/posixpath.py", line 357, in abspath
if not isabs(path):
File "/Users/carlo/.virtualenvs/testenv/bin/../lib/python3.4/posixpath.py", line 62, in isabs
sep = _get_sep(s)
RuntimeError: maximum recursion depth exceeded
python -m profiling live-profile -i 5 ./runtests.py '-k test_full_stack_benchmarks.py -v --bench --bench-only'
Usage: main.py live-profile [OPTIONS] SCRIPT [ARGV]...
Error: no such option: -k
The test coverage is too low. Now it's only 49%. I should make more test cases.
By default, a profiling result is a tree of frame stacks. If we can see the result as a flat list, it is also helpful to find a hotspot. We already have profiling.stats.FlatStatistics
but we can't see this look on the viewer. This feature should be mapped with a some human-friendly key command.
sudo pip3 install profiling
t always shows same error
[Installing collected packages: profiling
Running setup.py install for profiling ... error
Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-emh1dfcl/profiling/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-x7q4tkex/install-record.txt --single-version-externally-managed --compile:]
Hello, is there anyway that I can profile a flask app with profiling?
File "profiling\tracing\timers.py", line 24, in Timer
clock = time.clock
AttributeError: module 'time' has no attribute 'clock'
Seems need change function clock on time.perf_counter() or time.process_time()
A sampling profiler is more efficient for live-profile
or remote-profile
. Profiling should implement that also.
https://github.com/what-studio/profiling#profiling-from-code
while running : profiler.dump('path/to/file'),
It says, AttributeError: 'TracingProfiler' object has no attribute 'dump'
I have to save profiling results.. can someone provide a solution / alternatives?
We use timeit
to compare performance of similar code:
$ python -m timeit -s 'import foo' 'foo.egg()'
10000 loops, best of 3: 25.2 usec per loop
$ python -m timeit -s 'import foo' 'foo.spam()'
10000 loops, best of 3: 40.3 usec per loop
Now we know foo.spam()
is slower. But why?
profiling should provide timeit
as a command. It will be helpful to inquire into the cause of the performance loss.
$ python -m profiling timeit -s 'import foo' 'foo.spam()'
^^^^^^^^^
Just add it.
Wheels are very convenient especially when one wants to install with missing compilation requirements.
On profiling/speedup.c:15-21
const PySetObject* ignored_codes;
if (!PyArg_ParseTuple(args, "OOOOO", &frame, &base_frame, &base_code,
&ignored_frames, &ignored_codes))
{
return NULL;
}
PyObject* frame_stack = PyList_New(0);
However Visual C++ for Python 2.7 (VC 9.0) raises C2275 error:
profiling/speedup.c(21) : error C2275: 'PyObject' : illegal use of this type as an expression
Workaround (for VC 9.0):
const PySetObject* ignored_codes;
PyObject* frame_stack;
if (!PyArg_ParseTuple(args, "OOOOO", &frame, &base_frame, &base_code,
&ignored_frames, &ignored_codes))
{
return NULL;
}
frame_stack = PyList_New(0);
OS X El Capitan
❯ python --version
Python 2.7.10
~/work/python/profiling .venv master*
❯ pip --version
pip 8.1.2 from /Users/me/work/python/profiling/.venv/lib/python2.7/site-packages (python 2.7)
~/work/python/profiling master*
❯ virtualenv .venv
New python executable in /Users/me/work/python/profiling/.venv/bin/python
Installing setuptools, pip, wheel.... .venv/bin/actdone.
~/work/python/profiling master*
❯ . .venv/bin/activate
~/work/python/profiling .venv master*
❯ pip install -e .
❯ python setup.py test
running test
Searching for yappi>=0.92
Best match: yappi 0.94
Processing yappi-0.94-py2.7-macosx-10.11-intel.egg
Using /Users/me/work/python/profiling/.eggs/yappi-0.94-py2.7-macosx-10.11-intel.egg
Searching for greenlet>=0.4.4
Reading https://pypi.python.org/simple/greenlet/
Best match: greenlet 0.4.9
Downloading https://pypi.python.org/packages/ba/19/7ae57aa8b66f918859206532b1afd7f876582e3c87434ff33261da1cf50c/greenlet-0.4.9.tar.gz#md5=00bb1822d8511cc85f052e89d1fd919b
Processing greenlet-0.4.9.tar.gz
Writing /var/folders/kx/gmc5nl8x2hg370c3nktpc7vm0000gn/T/easy_install-lVzsh8/greenlet-0.4.9/setup.cfg
Running greenlet-0.4.9/setup.py -q bdist_egg --dist-dir /var/folders/kx/gmc5nl8x2hg370c3nktpc7vm0000gn/T/easy_install-lVzsh8/greenlet-0.4.9/egg-dist-tmp-gCLetw
creating /Users/me/work/python/profiling/.eggs/greenlet-0.4.9-py2.7-macosx-10.11-intel.egg
Extracting greenlet-0.4.9-py2.7-macosx-10.11-intel.egg to /Users/me/work/python/profiling/.eggs
Installed /Users/me/work/python/profiling/.eggs/greenlet-0.4.9-py2.7-macosx-10.11-intel.egg
Searching for gevent>=1.1rc2
Best match: gevent 1.1.1
Processing gevent-1.1.1-py2.7-macosx-10.11-intel.egg
Using /Users/me/work/python/profiling/.eggs/gevent-1.1.1-py2.7-macosx-10.11-intel.egg
Traceback (most recent call last):
File "setup.py", line 135, in <module>
test_suite='...',
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/Users/me/work/python/profiling/.venv/lib/python2.7/site-packages/setuptools/command/test.py", line 152, in run
self.distribution.fetch_build_eggs(self.distribution.tests_require)
File "/Users/me/work/python/profiling/.venv/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs
replace_conflicting=True,
File "/Users/me/work/python/profiling/.venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 834, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (gevent 1.1.1 (/Users/me/work/python/profiling/.eggs/gevent-1.1.1-py2.7-macosx-10.11-intel.egg), Requirement.parse('gevent==1.1rc1'))
https://pypi.org/project/profiling/#files
could you download this and check profiler.py
?
there's no dump method in there.
for some reason, there's mismatch between github master branch and latest pypi package.
Add the ability to filter out entire packages and/or modules from the profiling report.
I noticed that the README mentions support for greenlets. How about Python 3.4+'s asyncio?
Should we just use --timer=greenlet
for all the varieties of asynchronous programming that Python supports (greenlets, threading, multiprocessing, asyncio, etc.)?
I'm trying to profile a (rather complex) asyncio application (https://github.com/kharidiron/StarryPy3k) and am running into the issue that profiling will not import from other files in the same directory.
$ profiling live-profile --eventloop-aware=asyncio server.py
Traceback (most recent call last):
File "/Users/kharidiron/Workspace/PyCharm/VEnvs/StarryPy3k/bin/profiling", line 9, in
load_entry_point('profiling==0.0.0.dev0', 'console_scripts', 'profiling')()
File "/Users/kharidiron/Workspace/PyCharm/VEnvs/StarryPy3k/lib/python3.5/site-packages/click/core.py", line 716, in call
return self.main(_args, *_kwargs)
File "/Users/kharidiron/Workspace/PyCharm/VEnvs/StarryPy3k/lib/python3.5/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/Users/kharidiron/Workspace/PyCharm/VEnvs/StarryPy3k/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/kharidiron/Workspace/PyCharm/VEnvs/StarryPy3k/lib/python3.5/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, _ctx.params)
File "/Users/kharidiron/Workspace/PyCharm/VEnvs/StarryPy3k/lib/python3.5/site-packages/click/core.py", line 534, in invoke
return callback(_args, **kwargs)
File "/Users/kharidiron/Workspace/PyCharm/VEnvs/StarryPy3k/lib/python3.5/site-packages/profiling/main.py", line 525, in wrapped
return f(kwargs)
File "/Users/kharidiron/Workspace/PyCharm/VEnvs/StarryPy3k/lib/python3.5/site-packages/profiling/main.py", line 502, in wrapped
return f(profiler_factory=profiler_factory, *kwargs)
File "/Users/kharidiron/Workspace/PyCharm/VEnvs/StarryPy3k/lib/python3.5/site-packages/profiling/main.py", line 679, in live_profile
exec(code, globals)
File "server.py", line 5, in
from configuration_manager import ConfigurationManager
ImportError: No module named 'configuration_manager'
Am I doing something wrong?
(edit formatting)
Is there anyway I can run profile with twisted?
I tried running like python -m profiling profile =twistd -y server.py
but it doesn't seem to work. Any idea?
Thanks.
my code run with only 2 second , and then it used at least 180s by profiling -.- is something wrong with it ??
I realize the README says this: "This project is still under development, so you should install it via GitHub instead of PyPI:" but IMO, profiling
is definitely in a good enough position where a stable release can be thrown onto PyPI.
Getting a usage error when I try and profile my tests:
python -m profiling TestTransfer.py
Usage: main.py [OPTIONS] COMMAND [ARGS]...
Obviously just running without profile works. The test harness does the usual:
if __name__ == '__main__':
unittest.main()
Under
centos 6.3
Python 2.6.6
# pip install git+https://github.com/what-studio/profiling.git
# python -m profiling live-profile api.py 9000
Above cmd give me
/usr/bin/python: profiling is a package and cannot be directly executed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.