forked from mirrors/gecko-dev
Bug 1470268 - Add allocation filter to dmd.py. r=njn
This adds an '--allocation-filter' param that can be used to limit output to only allocations that include the filter in their stack. For example: dmd.py --allocation-filter fontconfig dmd.json.gz limits its output to just allocations that have an instance of 'fontconfig' in in one of their stack frames. --HG-- extra : rebase_source : 9ed34d5c7a6a2b76e96455e66b2e8196686ade16
This commit is contained in:
parent
3af306752a
commit
ca834a09a7
1 changed files with 8 additions and 0 deletions
|
|
@ -195,6 +195,9 @@ variable is used to find breakpad symbols for stack fixing.
|
||||||
p.add_argument('--filter-stacks-for-testing', action='store_true',
|
p.add_argument('--filter-stacks-for-testing', action='store_true',
|
||||||
help='filter stack traces; only useful for testing purposes')
|
help='filter stack traces; only useful for testing purposes')
|
||||||
|
|
||||||
|
p.add_argument('--allocation-filter',
|
||||||
|
help='Only print entries that have a stack that matches the filter')
|
||||||
|
|
||||||
p.add_argument('input_file',
|
p.add_argument('input_file',
|
||||||
help='a file produced by DMD')
|
help='a file produced by DMD')
|
||||||
|
|
||||||
|
|
@ -550,6 +553,11 @@ def printDigest(args, digest):
|
||||||
kindUsableSize = 0
|
kindUsableSize = 0
|
||||||
maxRecord = 1000
|
maxRecord = 1000
|
||||||
|
|
||||||
|
if args.allocation_filter:
|
||||||
|
sortedRecords = list(filter(
|
||||||
|
lambda x: any(map(lambda y: args.allocation_filter in y, x.allocatedAtDesc)),
|
||||||
|
sortedRecords))
|
||||||
|
|
||||||
# First iteration: get totals, etc.
|
# First iteration: get totals, etc.
|
||||||
for record in sortedRecords:
|
for record in sortedRecords:
|
||||||
kindBlocks += record.numBlocks
|
kindBlocks += record.numBlocks
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue