Commit 0ecc9f7b authored by bulach@chromium.org's avatar bulach@chromium.org

Deep Memory Profiler: skip non-existing or empty files.

Sometimes the dump series is not complete, or contains files with 0 bytes.

Rather than bailing out entirely, just skip those files.

This can happen for instance when using Telemetry-driven tests:
- each "page" on a "page set" is a different test, and will
contain its own set of "heap dumps"
- however, the "page set" itself is long running, so whilst
telemetry fetches heap dumps, chrome is still running and
generating dumps that aren't interesting.
- before starting the next page, telemetry removes all
those spurious dumps
- the final set of dump files contains "holes", but that's fine.

BUG=

Review URL: https://chromiumcodereview.appspot.com/15861007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202859 0039d316-1c4b-4281-b951-d872f2087c98
parent 23790f25
...@@ -744,17 +744,20 @@ class BucketSet(object): ...@@ -744,17 +744,20 @@ class BucketSet(object):
LOGGER.info('Loading bucket files.') LOGGER.info('Loading bucket files.')
n = 0 n = 0
skipped = 0
while True: while True:
path = '%s.%04d.buckets' % (prefix, n) path = '%s.%04d.buckets' % (prefix, n)
if not os.path.exists(path): if not os.path.exists(path) or not os.stat(path).st_size:
if n > 10: if skipped > 10:
break break
n += 1 n += 1
skipped += 1
continue continue
LOGGER.info(' %s' % path) LOGGER.info(' %s' % path)
with open(path, 'r') as f: with open(path, 'r') as f:
self._load_file(f) self._load_file(f)
n += 1 n += 1
skipped = 0
def _load_file(self, bucket_f): def _load_file(self, bucket_f):
for line in bucket_f: for line in bucket_f:
...@@ -1213,12 +1216,15 @@ class Command(object): ...@@ -1213,12 +1216,15 @@ class Command(object):
n = int(dump_path[len(dump_path) - 9 : len(dump_path) - 5]) n = int(dump_path[len(dump_path) - 9 : len(dump_path) - 5])
n += 1 n += 1
skipped = 0
while True: while True:
p = '%s.%04d.heap' % (prefix, n) 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) dump_path_list.append(p)
else: else:
break if skipped > 10:
break
skipped += 1
n += 1 n += 1
return dump_path_list return dump_path_list
......
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