Overview
========
Script to help visualize profiling data collected with the cProfile
Python module with the kcachegrind_ (screenshots_) graphical calltree
analyser.
This is a rebranding of the venerable
http://www.gnome.org/~johan/lsprofcalltree.py script by David Allouche
et Al. It aims at making it easier to distribute (e.g. through PyPI)
and behave more like the scripts of the debian kcachegrind-converters_
package. The final goal is to make it part of the official upstream
kdesdk_ package.
.. _kcachegrind: http://kcachegrind.sourceforge.net
.. _kcachegrind-converters: https://packages.debian.org/en/stable/kcachegrind-converters
.. _kdesdk: http://websvn.kde.org/trunk/KDE/kdesdk/kcachegrind/converters/
.. _screenshots: http://images.google.fr/images?q=kcachegrind
Command line usage
==================
Upon installation you should have a `pyprof2calltree` script in your path::
$ pyprof2calltree --help
usage: pyprof2calltree [-h] [-o output_file_path] [-i input_file_path] [-k]
[-r scriptfile [args ...]]
optional arguments:
-h, --help show this help message and exit
-o output_file_path, --outfile output_file_path
Save calltree stats to <outfile>
-i input_file_path, --infile input_file_path
Read Python stats from <infile>
-k, --kcachegrind Run the kcachegrind tool on the converted data
-r scriptfile [args ...], --run-script scriptfile [args ...]
Name of the Python script to run to collect profiling
data
Python shell usage
==================
`pyprof2calltree` is also best used from an interactive Python shell such as
the default shell. For instance let us profile XML parsing::
>>> from xml.etree import ElementTree
>>> from cProfile import Profile
>>> xml_content = '<a>\n' + '\t<b/><c><d>text</d></c>\n' * 100 + '</a>'
>>> profiler = Profile()
>>> profiler.runctx(
... "ElementTree.fromstring(xml_content)",
... locals(), globals())
>>> from pyprof2calltree import convert, visualize
>>> visualize(profiler.getstats()) # run kcachegrind
>>> convert(profiler.getstats(), 'profiling_results.kgrind') # save for later
or with the ipython_::
In [1]: %doctest_mode
Exception reporting mode: Plain
Doctest mode is: ON
>>> from xml.etree import ElementTree
>>> xml_content = '<a>\n' + '\t<b/><c><d>text</d></c>\n' * 100 + '</a>'
>>> %prun -D out.stats ElementTree.fromstring(xml_content)
*** Profile stats marshalled to file 'out.stats'
>>> from pyprof2calltree import convert, visualize
>>> visualize('out.stats')
>>> convert('out.stats', 'out.kgrind')
>>> results = %prun -r ElementTree.fromstring(xml_content)
>>> visualize(results)
.. _ipython: https://ipython.org/
Change log
==========
- 1.4.5 - 2020-04-19: Nothing user facing - changes to testing and remove deprecated eggecutable
- 1.4.4 - 2018-10-19: Numerous small improvements, drop support for EOL python versions
- 1.4.3 - 2017-07-28: Windows support (fixed is_installed check - #21)
- 1.4.2 - 2017-07-19: No feature or bug fixes, just license clarification (#20)
- 1.4.1 - 2017-05-20: No feature or bug fixes, just test distribution (#17)
- 1.4.0 - 2016-09-03: Support multiple functions with the same name, tick unit from millis to nanos, tests added (#15)
- 1.3.2 - 2014-07-05: Bugfix: correct source file paths (#12)
- 1.3.1 - 2013-11-27: Bugfix for broken output writing on Python 3 (#8)
- 1.3.0 - 2013-11-19: qcachegrind support
- 1.2.0 - 2013-11-09: Python 3 support
- 1.1.1 - 2013-09-25: Miscellaneous bugfixes
- 1.1.0 - 2008-12-21: integrate fix in conversion by David Glick
- 1.0.3 - 2008-10-16: fix typos in 1.0 release
- 1.0 - 2008-10-16: initial release under the pyprof2calltree name
Raw data
{
"_id": null,
"home_page": "https://github.com/pwaller/pyprof2calltree/",
"name": "pyprof2calltree",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "profiler visualization programming tool kde kcachegrind qcachegrind",
"author": "Peter Waller",
"author_email": "p@pwaller.net",
"download_url": "https://files.pythonhosted.org/packages/ca/2a/e9a76261183b4b5e059a6625d7aae0bcb0a77622bc767d4497148ce2e218/pyprof2calltree-1.4.5.tar.gz",
"platform": "",
"description": "Overview\n========\n\nScript to help visualize profiling data collected with the cProfile\nPython module with the kcachegrind_ (screenshots_) graphical calltree\nanalyser.\n\nThis is a rebranding of the venerable\nhttp://www.gnome.org/~johan/lsprofcalltree.py script by David Allouche\net Al. It aims at making it easier to distribute (e.g. through PyPI)\nand behave more like the scripts of the debian kcachegrind-converters_\npackage. The final goal is to make it part of the official upstream\nkdesdk_ package.\n\n.. _kcachegrind: http://kcachegrind.sourceforge.net\n.. _kcachegrind-converters: https://packages.debian.org/en/stable/kcachegrind-converters\n.. _kdesdk: http://websvn.kde.org/trunk/KDE/kdesdk/kcachegrind/converters/\n.. _screenshots: http://images.google.fr/images?q=kcachegrind\n\nCommand line usage\n==================\n\nUpon installation you should have a `pyprof2calltree` script in your path::\n\n $ pyprof2calltree --help\n usage: pyprof2calltree [-h] [-o output_file_path] [-i input_file_path] [-k]\n [-r scriptfile [args ...]]\n\n optional arguments:\n -h, --help show this help message and exit\n -o output_file_path, --outfile output_file_path\n Save calltree stats to <outfile>\n -i input_file_path, --infile input_file_path\n Read Python stats from <infile>\n -k, --kcachegrind Run the kcachegrind tool on the converted data\n -r scriptfile [args ...], --run-script scriptfile [args ...]\n Name of the Python script to run to collect profiling\n data\n\n\nPython shell usage\n==================\n\n`pyprof2calltree` is also best used from an interactive Python shell such as\nthe default shell. For instance let us profile XML parsing::\n\n >>> from xml.etree import ElementTree\n >>> from cProfile import Profile\n >>> xml_content = '<a>\\n' + '\\t<b/><c><d>text</d></c>\\n' * 100 + '</a>'\n >>> profiler = Profile()\n >>> profiler.runctx(\n ... \"ElementTree.fromstring(xml_content)\",\n ... locals(), globals())\n\n >>> from pyprof2calltree import convert, visualize\n >>> visualize(profiler.getstats()) # run kcachegrind\n >>> convert(profiler.getstats(), 'profiling_results.kgrind') # save for later\n\nor with the ipython_::\n\n In [1]: %doctest_mode\n Exception reporting mode: Plain\n Doctest mode is: ON\n\n >>> from xml.etree import ElementTree\n >>> xml_content = '<a>\\n' + '\\t<b/><c><d>text</d></c>\\n' * 100 + '</a>'\n >>> %prun -D out.stats ElementTree.fromstring(xml_content)\n\n *** Profile stats marshalled to file 'out.stats'\n\n >>> from pyprof2calltree import convert, visualize\n >>> visualize('out.stats')\n >>> convert('out.stats', 'out.kgrind')\n\n >>> results = %prun -r ElementTree.fromstring(xml_content)\n >>> visualize(results)\n\n.. _ipython: https://ipython.org/\n\n\nChange log\n==========\n\n - 1.4.5 - 2020-04-19: Nothing user facing - changes to testing and remove deprecated eggecutable\n - 1.4.4 - 2018-10-19: Numerous small improvements, drop support for EOL python versions\n - 1.4.3 - 2017-07-28: Windows support (fixed is_installed check - #21)\n - 1.4.2 - 2017-07-19: No feature or bug fixes, just license clarification (#20)\n - 1.4.1 - 2017-05-20: No feature or bug fixes, just test distribution (#17)\n - 1.4.0 - 2016-09-03: Support multiple functions with the same name, tick unit from millis to nanos, tests added (#15)\n - 1.3.2 - 2014-07-05: Bugfix: correct source file paths (#12)\n - 1.3.1 - 2013-11-27: Bugfix for broken output writing on Python 3 (#8)\n - 1.3.0 - 2013-11-19: qcachegrind support\n - 1.2.0 - 2013-11-09: Python 3 support\n - 1.1.1 - 2013-09-25: Miscellaneous bugfixes\n - 1.1.0 - 2008-12-21: integrate fix in conversion by David Glick\n - 1.0.3 - 2008-10-16: fix typos in 1.0 release\n - 1.0 - 2008-10-16: initial release under the pyprof2calltree name\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Help visualize profiling data from cProfile with kcachegrind and qcachegrind",
"version": "1.4.5",
"split_keywords": [
"profiler",
"visualization",
"programming",
"tool",
"kde",
"kcachegrind",
"qcachegrind"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "a1f14800fb001a16c1dde5fb5c094356",
"sha256": "a635672ff31677486350b2be9a823ef92f740e6354a6aeda8fa4a8a3768e8f2f"
},
"downloads": -1,
"filename": "pyprof2calltree-1.4.5.tar.gz",
"has_sig": false,
"md5_digest": "a1f14800fb001a16c1dde5fb5c094356",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10080,
"upload_time": "2020-04-19T10:39:09",
"upload_time_iso_8601": "2020-04-19T10:39:09.819344Z",
"url": "https://files.pythonhosted.org/packages/ca/2a/e9a76261183b4b5e059a6625d7aae0bcb0a77622bc767d4497148ce2e218/pyprof2calltree-1.4.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-04-19 10:39:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "pwaller",
"github_project": "pyprof2calltree",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "pyprof2calltree"
}