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

Unified Diff: tools/deep_memory_profiler/dmprof.py

Issue 15861007: Deep Memory Profiler: skip non-existing or empty files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/deep_memory_profiler/dmprof.py
diff --git a/tools/deep_memory_profiler/dmprof.py b/tools/deep_memory_profiler/dmprof.py
index 8327f96e5a56d209ef5498ac7d668a953af2b773..0a695ed992344d53fa86a30ae9a213a05195d97a 100644
--- a/tools/deep_memory_profiler/dmprof.py
+++ b/tools/deep_memory_profiler/dmprof.py
@@ -707,17 +707,20 @@ class BucketSet(object):
LOGGER.info('Loading bucket files.')
n = 0
+ skipped = 0
while True:
path = '%s.%04d.buckets' % (prefix, n)
- if not os.path.exists(path):
- if n > 10:
+ if not os.path.exists(path) or not os.stat(path).st_size:
+ if skipped > 10:
break
n += 1
+ skipped += 1
continue
LOGGER.info(' %s' % path)
with open(path, 'r') as f:
self._load_file(f)
n += 1
+ skipped = 0
def _load_file(self, bucket_f):
for line in bucket_f:
@@ -1142,12 +1145,15 @@ class Command(object):
n = int(dump_path[len(dump_path) - 9 : len(dump_path) - 5])
n += 1
+ skipped = 0
while True:
p = '%s.%04d.heap' % (prefix, n)
- if os.path.exists(p):
+ if os.path.exists(p) and os.stat(p).st_size:
dump_path_list.append(p)
else:
- break
+ if skipped > 10:
+ break
+ skipped += 1
n += 1
return dump_path_list
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698