This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import 'package:vm/snapshot/ascii_table.dart';
1414
1515import 'package:vm/snapshot/program_info.dart' ;
1616import 'package:vm/snapshot/utils.dart' ;
17+ import 'package:vm/snapshot/v8_profile.dart' ;
1718
1819class CompareCommand extends Command <void > {
1920 @override
@@ -143,5 +144,9 @@ precisely based on their source position (which is included in their name).
143144 print ('Old : ${totalOld } bytes.' );
144145 print ('New : ${totalNew } bytes.' );
145146 print ('Change: ${totalDiff > 0 ? '+' : '' }${totalDiff } bytes.' );
147+
148+ if (oldSizes.snapshotInfo != null ) {
149+ print (bucketLegend);
150+ }
146151 }
147152}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import 'package:args/command_runner.dart';
1515import 'package:vm/snapshot/ascii_table.dart' ;
1616import 'package:vm/snapshot/program_info.dart' ;
1717import 'package:vm/snapshot/utils.dart' ;
18+ import 'package:vm/snapshot/v8_profile.dart' ;
1819
1920class SummaryCommand extends Command <void > {
2021 @override
@@ -123,5 +124,7 @@ void outputSummary(File input,
123124 computeHistogram (info, HistogramType .byNodeType, filter: filter);
124125 printHistogram (info, typeHistogram,
125126 prefix: typeHistogram.bySize, maxWidth: maxWidth);
127+
128+ print (bucketLegend);
126129 }
127130}
Original file line number Diff line number Diff line change @@ -537,3 +537,28 @@ class _ProgramInfoBuilder {
537537 return pathA[i];
538538 }
539539}
540+
541+ final bucketLegend = '''
542+
543+ --------------------------------------------------------------------------------
544+ IMPORTANT: Dart AOT snapshot is a serialized representation of Dart VM heap.
545+ Outside of few specific cases (e.g. an object representing a library clearly
546+ originates from the library it represents) there is no well defined relationship
547+ between snapshot bytes and a specific method/class/library to which these
548+ bytes can be attributed with certainty. This snapshot analysis tool tries
549+ to attribute bytes to specific program structure elements based on their
550+ reachability from objects with well defined origin - meaning that this analysis
551+ has some margin of error and imprecision.
552+
553+ - @other bucket denotes bytes attributed to entities outside of the current
554+ granularity. For example, when breaking down the size by method name there
555+ might be bytes which exist outside of any specific symbol - in which case
556+ they will be attributed to @other.
557+ - @stubs bucket accumulates bytes attributed to stubs (pieces of machine code
558+ produced by the VM for internal purposes).
559+ - @shared bucket accumulates bytes shared between otherwise unrelated program
560+ entities
561+ - @unknown bucket accumulates bytes which are not reachable from any program
562+ structure nodes (usually VM internal objects).
563+ --------------------------------------------------------------------------------
564+ ''' ;
You can’t perform that action at this time.
0 commit comments