summaryrefslogtreecommitdiffstats
path: root/tools/stats-viewer.py
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-07-08 12:39:36 +0100
committerSteve Block <steveblock@google.com>2010-07-08 12:41:04 +0100
commit8defd9ff6930b4e24729971a61cf7469daf119be (patch)
tree3be589af44201dcaead530f4046cb63e7c9b68c4 /tools/stats-viewer.py
parent85dec77e821ae98054f8e09ba3180c148a9264d6 (diff)
downloadandroid_external_v8-8defd9ff6930b4e24729971a61cf7469daf119be.tar.gz
android_external_v8-8defd9ff6930b4e24729971a61cf7469daf119be.tar.bz2
android_external_v8-8defd9ff6930b4e24729971a61cf7469daf119be.zip
Update V8 to r5017 as required by WebKit r62496
Change-Id: I1b4b7718d1d77ceef07f543e9150a2cb3a628f3a
Diffstat (limited to 'tools/stats-viewer.py')
-rwxr-xr-xtools/stats-viewer.py38
1 files changed, 25 insertions, 13 deletions
diff --git a/tools/stats-viewer.py b/tools/stats-viewer.py
index 14b21476..05cb7628 100755
--- a/tools/stats-viewer.py
+++ b/tools/stats-viewer.py
@@ -34,8 +34,8 @@ The stats viewer reads counters from a binary file and displays them
in a window, re-reading and re-displaying with regular intervals.
"""
-
import mmap
+import optparse
import os
import re
import struct
@@ -60,13 +60,15 @@ CHROME_COUNTERS_FILE_MAGIC_NUMBER = 0x13131313
class StatsViewer(object):
"""The main class that keeps the data used by the stats viewer."""
- def __init__(self, data_name):
+ def __init__(self, data_name, name_filter):
"""Creates a new instance.
Args:
data_name: the name of the file containing the counters.
+ name_filter: The regexp filter to apply to counter names.
"""
self.data_name = data_name
+ self.name_filter = name_filter
# The handle created by mmap.mmap to the counters file. We need
# this to clean it up on exit.
@@ -224,17 +226,19 @@ class StatsViewer(object):
sorted_groups.sort()
for counter_name in sorted_groups:
counter_objs = groups[counter_name]
- name = Tkinter.Label(self.root, width=50, anchor=Tkinter.W,
- text=counter_name)
- name.grid(row=index, column=0, padx=1, pady=1)
+ if self.name_filter.match(counter_name):
+ name = Tkinter.Label(self.root, width=50, anchor=Tkinter.W,
+ text=counter_name)
+ name.grid(row=index, column=0, padx=1, pady=1)
count = len(counter_objs)
for i in xrange(count):
counter = counter_objs[i]
name = counter.Name()
var = Tkinter.StringVar()
- value = Tkinter.Label(self.root, width=15, anchor=Tkinter.W,
- textvariable=var)
- value.grid(row=index, column=(1 + i), padx=1, pady=1)
+ if self.name_filter.match(name):
+ value = Tkinter.Label(self.root, width=15, anchor=Tkinter.W,
+ textvariable=var)
+ value.grid(row=index, column=(1 + i), padx=1, pady=1)
# If we know how to interpret the prefix of this counter then
# add an appropriate formatting to the variable
@@ -440,17 +444,25 @@ class ChromeCounterCollection(object):
self.counter_values_offset + i * self.max_threads * 4)
-def Main(data_file):
+def Main(data_file, name_filter):
"""Run the stats counter.
Args:
data_file: The counters file to monitor.
+ name_filter: The regexp filter to apply to counter names.
"""
- StatsViewer(data_file).Run()
+ StatsViewer(data_file, name_filter).Run()
if __name__ == "__main__":
- if len(sys.argv) != 2:
- print "Usage: stats-viewer.py <stats data>|<test_shell pid>"
+ parser = optparse.OptionParser("usage: %prog [--filter=re] "
+ "<stats data>|<test_shell pid>")
+ parser.add_option("--filter",
+ default=".*",
+ help=("regexp filter for counter names "
+ "[default: %default]"))
+ (options, args) = parser.parse_args()
+ if len(args) != 1:
+ parser.print_help()
sys.exit(1)
- Main(sys.argv[1])
+ Main(args[0], re.compile(options.filter))