New Upstream Snapshot - pyprof2calltree
Ready changes
Summary
Merged new upstream version: 1.4.5+git20210228.2.366af4c (was: 1.4.5+git20210228.1.366af4c).
Resulting package
Built on 2022-12-19T16:30 (took 2m49s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots pyprof2calltree
Lintian Result
Diff
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 0ed839b..3b6a8d0 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -47,6 +47,9 @@ In chronological order:
* A huge number of small fixes and consistency
improvements across code, docs and setup.py alike.
+* Meesha <44530786+meesha7@users.noreply.github.com>
+ * Support for multiple time units
+
* [Your name or handle] <[email or website]>
* [Brief summary of your changes]
diff --git a/PKG-INFO b/PKG-INFO
index 9f52e80..ed23f0c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,113 +1,14 @@
-Metadata-Version: 1.2
+Metadata-Version: 2.1
Name: pyprof2calltree
-Version: 1.4.5
-Summary: Help visualize profiling data from cProfile with kcachegrind and qcachegrind
+Version: 1.4.4
+Summary: Help visualize profiling data from cProfile with kcachegrind and qcachegrind
Home-page: https://github.com/pwaller/pyprof2calltree/
Author: Olivier Grisel
Author-email: olivier.grisel@ensta.org
Maintainer: Peter Waller
Maintainer-email: p@pwaller.net
License: MIT
-Description: 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
-
-Keywords: profiler visualization programming tool kde kcachegrind qcachegrind
-Platform: UNKNOWN
+Keywords: kcachegrind,kde,profiler,programming,qcachegrind,tool,visualization
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Environment :: X11 Applications :: KDE
@@ -128,4 +29,110 @@ Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: System :: System Shells
Classifier: Topic :: Utilities
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7
+License-File: LICENSE
+
+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
+
+Installation
+============
+
+On Debian ≥ 11, or derivatives such as Ubuntu ≥ 20.04, `sudo apt
+install kcachegrind pyprof2calltree`.
+
+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
+ -s {s,ms,us,ns}, --scale {s,ms,us,ns}
+ Time scale
+
+
+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.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
diff --git a/README.rst b/README.rst
index 0441f18..760df13 100644
--- a/README.rst
+++ b/README.rst
@@ -17,6 +17,12 @@ kdesdk_ package.
.. _kdesdk: http://websvn.kde.org/trunk/KDE/kdesdk/kcachegrind/converters/
.. _screenshots: http://images.google.fr/images?q=kcachegrind
+Installation
+============
+
+On Debian ≥ 11, or derivatives such as Ubuntu ≥ 20.04, `sudo apt
+install kcachegrind pyprof2calltree`.
+
Command line usage
==================
@@ -36,6 +42,8 @@ Upon installation you should have a `pyprof2calltree` script in your path::
-r scriptfile [args ...], --run-script scriptfile [args ...]
Name of the Python script to run to collect profiling
data
+ -s {s,ms,us,ns}, --scale {s,ms,us,ns}
+ Time scale
Python shell usage
@@ -81,7 +89,6 @@ or with the ipython_::
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)
diff --git a/debian/changelog b/debian/changelog
index 7a793a5..d1342d8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+pyprof2calltree (1.4.5+git20210228.2.366af4c-1) UNRELEASED; urgency=low
+
+ * New upstream snapshot.
+ * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk> Mon, 19 Dec 2022 16:28:35 -0000
+
pyprof2calltree (1.4.5-1) unstable; urgency=medium
[ Aurélien COUDERC ]
diff --git a/pyprof2calltree.egg-info/PKG-INFO b/pyprof2calltree.egg-info/PKG-INFO
index 9f52e80..ed23f0c 100644
--- a/pyprof2calltree.egg-info/PKG-INFO
+++ b/pyprof2calltree.egg-info/PKG-INFO
@@ -1,113 +1,14 @@
-Metadata-Version: 1.2
+Metadata-Version: 2.1
Name: pyprof2calltree
-Version: 1.4.5
-Summary: Help visualize profiling data from cProfile with kcachegrind and qcachegrind
+Version: 1.4.4
+Summary: Help visualize profiling data from cProfile with kcachegrind and qcachegrind
Home-page: https://github.com/pwaller/pyprof2calltree/
Author: Olivier Grisel
Author-email: olivier.grisel@ensta.org
Maintainer: Peter Waller
Maintainer-email: p@pwaller.net
License: MIT
-Description: 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
-
-Keywords: profiler visualization programming tool kde kcachegrind qcachegrind
-Platform: UNKNOWN
+Keywords: kcachegrind,kde,profiler,programming,qcachegrind,tool,visualization
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Environment :: X11 Applications :: KDE
@@ -128,4 +29,110 @@ Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: System :: System Shells
Classifier: Topic :: Utilities
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7
+License-File: LICENSE
+
+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
+
+Installation
+============
+
+On Debian ≥ 11, or derivatives such as Ubuntu ≥ 20.04, `sudo apt
+install kcachegrind pyprof2calltree`.
+
+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
+ -s {s,ms,us,ns}, --scale {s,ms,us,ns}
+ Time scale
+
+
+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.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
diff --git a/pyprof2calltree.egg-info/entry_points.txt b/pyprof2calltree.egg-info/entry_points.txt
index 2a66bdb..482c961 100644
--- a/pyprof2calltree.egg-info/entry_points.txt
+++ b/pyprof2calltree.egg-info/entry_points.txt
@@ -1,3 +1,2 @@
[console_scripts]
pyprof2calltree = pyprof2calltree:main
-
diff --git a/pyprof2calltree.py b/pyprof2calltree.py
index 4942c54..699883b 100755
--- a/pyprof2calltree.py
+++ b/pyprof2calltree.py
@@ -48,7 +48,17 @@ from collections import defaultdict
__all__ = ['convert', 'visualize', 'CalltreeConverter']
-SCALE = 1e9
+
+class Scale(object):
+ def __init__(self, unit):
+ SCALES = {
+ 's': (1, 's', 'Seconds'),
+ 'ms': (1e3, 'ms', 'Milliseconds'),
+ 'us': (1e6, 'us', 'Microseconds'),
+ 'ns': (1e9, 'ns', 'Nanoseconds')
+ }
+
+ self.scale, self.unit, self.name = SCALES[unit]
class Code(object):
@@ -169,7 +179,7 @@ KCACHEGRIND_EXECUTABLES = ["kcachegrind", "qcachegrind"]
class CalltreeConverter(object):
"""Convert raw cProfile or pstats data to the calltree format"""
- def __init__(self, profiling_data):
+ def __init__(self, profiling_data, scale=None):
if is_basestring(profiling_data):
# treat profiling_data as a filename of pstats serialized data
self.entries = pstats2entries(pstats.Stats(profiling_data))
@@ -180,6 +190,11 @@ class CalltreeConverter(object):
# assume this are direct cProfile entries
self.entries = profiling_data
self.out_file = None
+ self.scale = scale
+
+ if not scale:
+ self.scale = Scale('ns')
+
self._code_by_position = defaultdict(set)
self._populate_code_by_position()
@@ -204,8 +219,8 @@ class CalltreeConverter(object):
def output(self, out_file):
"""Write the converted entries to out_file"""
self.out_file = out_file
- out_file.write('event: ns : Nanoseconds\n')
- out_file.write('events: ns\n')
+ out_file.write('event: {} : {}\n'.format(self.scale.unit, self.scale.name))
+ out_file.write('events: {}\n'.format(self.scale.unit))
self._output_summary()
for entry in sorted(self.entries, key=_entry_sort_key):
self._output_entry(entry)
@@ -249,7 +264,7 @@ class CalltreeConverter(object):
def _output_summary(self):
max_cost = 0
for entry in self.entries:
- totaltime = int(entry.totaltime * SCALE)
+ totaltime = int(entry.totaltime * self.scale.scale)
max_cost = max(max_cost, totaltime)
# Version 0.7.4 of kcachegrind appears to ignore the summary line and
# calculate the total cost by summing the exclusive cost of all
@@ -265,7 +280,7 @@ class CalltreeConverter(object):
munged_name = self.munged_function_name(code)
out_file.write('fl=%s\nfn=%s\n' % (co_filename, munged_name))
- inlinetime = int(entry.inlinetime * SCALE)
+ inlinetime = int(entry.inlinetime * self.scale.scale)
out_file.write('%d %d\n' % (co_firstlineno, inlinetime))
# recursive calls are counted in entry.calls
@@ -273,7 +288,7 @@ class CalltreeConverter(object):
for subentry in sorted(entry.calls, key=_entry_sort_key):
self._output_subentry(co_firstlineno, subentry.code,
subentry.callcount,
- int(subentry.totaltime * SCALE))
+ int(subentry.totaltime * self.scale.scale))
out_file.write('\n')
@@ -303,9 +318,13 @@ def main():
dest='script',
help="Name of the Python script to run to collect"
" profiling data")
+ parser.add_argument('-s', '--scale', choices=['s', 'ms', 'us', 'ns'],
+ default='ns',
+ help='Time scale')
args = parser.parse_args()
outfile = args.outfile
+ scale = Scale(args.scale)
if args.script is not None:
# collect profiling data by running the given script
@@ -323,7 +342,7 @@ def main():
cmd.extend(args.script)
subprocess.check_call(cmd)
- kg = CalltreeConverter(tmp_path)
+ kg = CalltreeConverter(tmp_path, scale)
finally:
os.remove(tmp_path)
@@ -336,7 +355,7 @@ def main():
# prevent name collisions by appending another extension
outfile += ".log"
- kg = CalltreeConverter(pstats.Stats(args.infile))
+ kg = CalltreeConverter(pstats.Stats(args.infile), scale)
else:
# at least an input file or a script to run is required
diff --git a/setup.cfg b/setup.cfg
index c74cb9e..4709d07 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,9 +1,57 @@
+[metadata]
+name = pyprof2calltree
+version = 1.4.4
+description = Help visualize profiling data from cProfile with kcachegrind and qcachegrind
+long_description = file: README.rst
+url = https://github.com/pwaller/pyprof2calltree/
+author = Olivier Grisel
+author_email = olivier.grisel@ensta.org
+maintainer = Peter Waller
+maintainer_email = p@pwaller.net
+license = MIT
+keywords =
+ kcachegrind
+ kde
+ profiler
+ programming
+ qcachegrind
+ tool
+ visualization
+classifiers =
+ Development Status :: 5 - Production/Stable
+ Environment :: Console
+ Environment :: X11 Applications :: KDE
+ License :: OSI Approved :: MIT License
+ Operating System :: POSIX
+ Operating System :: Unix
+ Programming Language :: Python
+ Programming Language :: Python :: 2
+ Programming Language :: Python :: 2.7
+ Programming Language :: Python :: 3
+ Programming Language :: Python :: 3.4
+ Programming Language :: Python :: 3.5
+ Programming Language :: Python :: 3.6
+ Programming Language :: Python :: 3.7
+ Programming Language :: Python :: 3.8
+ Topic :: Desktop Environment :: K Desktop Environment (KDE)
+ Topic :: Software Development
+ Topic :: Software Development :: Quality Assurance
+ Topic :: System :: System Shells
+ Topic :: Utilities
+
+[options]
+python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+py_modules =
+ pyprof2calltree
+zip_safe = true
+
+[options.entry_points]
+console_scripts =
+ pyprof2calltree = pyprof2calltree:main
+
[bdist_wheel]
universal = 1
-[metadata]
-license_file = LICENSE
-
[flake8]
max-line-length = 88
@@ -13,8 +61,6 @@ force_grid_wrap = 0
include_trailing_comma = True
line_length = 88
multi_line_output = 3
-not_skip = __init__.py
-skip = .tox/
[egg_info]
tag_build =
diff --git a/setup.py b/setup.py
index 60c535d..6068493 100644
--- a/setup.py
+++ b/setup.py
@@ -1,55 +1,3 @@
from setuptools import setup
-version = '1.4.5'
-
-
-def readall(path):
- with open(path) as f:
- return f.read()
-
-
-setup(
- name='pyprof2calltree',
- version=version,
- description=(
- "Help visualize profiling data from cProfile with kcachegrind and qcachegrind"
- ),
- long_description=readall('README.rst'),
- keywords='profiler visualization programming tool kde kcachegrind qcachegrind',
- classifiers=[
- "Development Status :: 5 - Production/Stable",
- "Environment :: Console",
- "Environment :: X11 Applications :: KDE",
- "License :: OSI Approved :: MIT License",
- "Operating System :: POSIX",
- "Operating System :: Unix",
- "Programming Language :: Python",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 2.7",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.4",
- "Programming Language :: Python :: 3.5",
- "Programming Language :: Python :: 3.6",
- "Programming Language :: Python :: 3.7",
- "Programming Language :: Python :: 3.8",
- "Topic :: Desktop Environment :: K Desktop Environment (KDE)",
- "Topic :: Software Development",
- "Topic :: Software Development :: Quality Assurance",
- "Topic :: System :: System Shells",
- "Topic :: Utilities",
- ],
- author='Olivier Grisel',
- author_email='olivier.grisel@ensta.org',
- maintainer='Peter Waller',
- maintainer_email='p@pwaller.net',
- url='https://github.com/pwaller/pyprof2calltree/',
- license='MIT',
- py_modules=['pyprof2calltree'],
- python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
- zip_safe=True,
- entry_points={
- 'console_scripts': [
- 'pyprof2calltree = pyprof2calltree:main',
- ],
- }
-)
+setup()
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.4.egg-info/PKG-INFO -rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.4.egg-info/dependency_links.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.4.egg-info/entry_points.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.4.egg-info/top_level.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.4.egg-info/zip-safe
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.5.egg-info/PKG-INFO -rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.5.egg-info/dependency_links.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.5.egg-info/entry_points.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.5.egg-info/top_level.txt -rw-r--r-- root/root /usr/lib/python3/dist-packages/pyprof2calltree-1.4.5.egg-info/zip-safe
No differences were encountered in the control files