Commit 2a3abf4b authored by paulwhitton's avatar paulwhitton Committed by Commit bot

[Android] memory_inspector: truncate process_name in CLI dumps.

If process_name is greater than 50 characters, display truncated process_name

BUG=340294
NOTRY=true

Review URL: https://codereview.chromium.org/559113002

Cr-Commit-Position: refs/heads/master@{#295275}
parent b5ddc3c4
...@@ -86,8 +86,8 @@ def main(): ...@@ -86,8 +86,8 @@ def main():
stats = process.GetStats() stats = process.GetStats()
run_time_min, run_time_sec = divmod(stats.run_time, 60) run_time_min, run_time_sec = divmod(stats.run_time, 60)
print '%10s : %-50s : %6s m %2s s %8s %12s' % ( print '%10s : %-50s : %6s m %2s s %8s %12s' % (
process.pid, process.name, run_time_min, run_time_sec, process.pid, _Truncate(process.name, 50), run_time_min,
stats.threads, stats.vm_rss) run_time_sec, stats.threads, stats.vm_rss)
return 0 return 0
if not options.process_id: if not options.process_id:
...@@ -131,7 +131,7 @@ def _ListProcessStats(process): ...@@ -131,7 +131,7 @@ def _ListProcessStats(process):
stats = process.GetStats() stats = process.GetStats()
run_time_min, run_time_sec = divmod(stats.run_time, 60) run_time_min, run_time_sec = divmod(stats.run_time, 60)
print '%10s : %-50s : %6s m %2s s %8s %12s %13s %11s' % ( print '%10s : %-50s : %6s m %2s s %8s %12s %13s %11s' % (
process.pid, process.name, run_time_min, run_time_sec, process.pid, _Truncate(process.name, 50), run_time_min, run_time_sec,
stats.threads, stats.cpu_usage, stats.vm_rss, stats.page_faults) stats.threads, stats.cpu_usage, stats.vm_rss, stats.page_faults)
time.sleep(1) time.sleep(1)
...@@ -167,3 +167,7 @@ def _ListProcessClassifiedMmaps(process, mmap_rule): ...@@ -167,3 +167,7 @@ def _ListProcessClassifiedMmaps(process, mmap_rule):
print json.dumps(classified_results_tree, cls=serialization.Encoder) print json.dumps(classified_results_tree, cls=serialization.Encoder)
def _Truncate(name, max_length):
if len(name) <= max_length:
return name
return '%s...' % name[0:(max_length - 3)]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment