Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: tools/stats-viewer.py

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/ll_prof.py ('k') | tools/test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/stats-viewer.py
===================================================================
--- tools/stats-viewer.py (revision 8618)
+++ tools/stats-viewer.py (working copy)
@@ -104,10 +104,12 @@
sys.exit(1)
maps_file = open(maps_name, "r")
try:
- m = re.search(r"/dev/shm/\S*", maps_file.read())
- if m is not None and os.path.exists(m.group(0)):
- self.data_name = m.group(0)
- else:
+ self.data_name = None
+ for m in re.finditer(r"/dev/shm/\S*", maps_file.read()):
+ if os.path.exists(m.group(0)):
+ self.data_name = m.group(0)
+ break
+ if self.data_name is None:
print "Can't find counter file in maps for PID %s." % self.data_name
sys.exit(1)
finally:
@@ -414,7 +416,8 @@
individual counters contained in the file."""
_HEADER_SIZE = 4 * 4
- _NAME_SIZE = 32
+ _COUNTER_NAME_SIZE = 64
+ _THREAD_NAME_SIZE = 32
def __init__(self, data):
"""Create a new instance.
@@ -426,22 +429,23 @@
self.max_counters = data.IntAt(8)
self.max_threads = data.IntAt(12)
self.counter_names_offset = \
- self._HEADER_SIZE + self.max_threads * (self._NAME_SIZE + 2 * 4)
+ self._HEADER_SIZE + self.max_threads * (self._THREAD_NAME_SIZE + 2 * 4)
self.counter_values_offset = \
- self.counter_names_offset + self.max_counters * self._NAME_SIZE
+ self.counter_names_offset + self.max_counters * self._COUNTER_NAME_SIZE
def CountersInUse(self):
"""Return the number of counters in active use."""
for i in xrange(self.max_counters):
- if self.data.ByteAt(self.counter_names_offset + i * self._NAME_SIZE) == 0:
+ name_offset = self.counter_names_offset + i * self._COUNTER_NAME_SIZE
+ if self.data.ByteAt(name_offset) == 0:
return i
return self.max_counters
def Counter(self, i):
"""Return the i'th counter."""
- return ChromeCounter(self.data,
- self.counter_names_offset + i * self._NAME_SIZE,
- self.counter_values_offset + i * self.max_threads * 4)
+ name_offset = self.counter_names_offset + i * self._COUNTER_NAME_SIZE
+ value_offset = self.counter_values_offset + i * self.max_threads * 4
+ return ChromeCounter(self.data, name_offset, value_offset)
def Main(data_file, name_filter):
« no previous file with comments | « tools/ll_prof.py ('k') | tools/test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698