diff options
author | Tiancong Wang <tcwang@google.com> | 2019-07-12 15:27:03 -0700 |
---|---|---|
committer | Tiancong Wang <tcwang@google.com> | 2019-07-16 20:38:09 +0000 |
commit | 85a91c55bb20805c443a15cdee90f3a9a32b6aed (patch) | |
tree | cbf82c98f108af7894b91a2c4390dda3f6154761 /heatmaps/heat_map.py | |
parent | 5442a253004a1e42f1b635d4428e4522c440c523 (diff) | |
download | toolchain-utils-85a91c55bb20805c443a15cdee90f3a9a32b6aed.tar.gz |
heatmap: Fix symbolization of hot pages in heatmap tool.
This patch fixes the heatmap tool that was broken to display
hot symbols within hot pages with newly added customized hugepage
region. It also adds unit tests to avoid regression in the future.
BUG=chromium:956109
TEST=Pass unittests and tested with one image locally.
Change-Id: I5aba39b6f27582b060248d756ddb9b869345065e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1699094
Commit-Queue: Tiancong Wang <tcwang@google.com>
Tested-by: Tiancong Wang <tcwang@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'heatmaps/heat_map.py')
-rwxr-xr-x | heatmaps/heat_map.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/heatmaps/heat_map.py b/heatmaps/heat_map.py index b7006e3d..2fd742d2 100755 --- a/heatmaps/heat_map.py +++ b/heatmaps/heat_map.py @@ -82,10 +82,7 @@ class HeatMapProducer(object): generator.draw() # Analyze top N hottest symbols with the binary, if provided if self.binary: - if top_n_pages is not None: - generator.analyze(self.binary, top_n_pages) - else: - generator.analyze(self.binary) + generator.analyze(self.binary, top_n_pages) def _RemoveFiles(self): files = [ @@ -95,7 +92,7 @@ class HeatMapProducer(object): if os.path.exists(f): os.remove(f) - def Run(self, top_n_pages=None): + def Run(self, top_n_pages): try: self._EnsureFileInChroot() self._GeneratePerfReport() @@ -105,6 +102,9 @@ class HeatMapProducer(object): msg = ('heat map and time histogram genereated in the current ' 'directory with name heat_map.png and timeline.png ' 'accordingly.') + if self.binary: + msg += ('\nThe hottest %d pages inside and outside hugepage ' + 'is symbolized and saved to addr2symbol.txt' % top_n_pages) if self.logger: self.logger.LogOutput(msg) else: @@ -142,9 +142,10 @@ def main(argv): parser.add_argument( '--top_n', dest='top_n', + type=int, + default=10, help='Print out top N hottest pages within/outside huge page range. ' - 'Must be used with --hugepage and --binary.', - default=None) + 'Must be used with --hugepage and --binary. (Default: %(default)s)') parser.add_argument( '--title', dest='title', help='Title of the heatmap', default='') parser.add_argument( |