Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 04a3598

Browse files
mralephcommit-bot@chromium.org
authored andcommitted
[vm/tool] Add legend to snapshot_analysis compare/summary output.
Issue dart-lang/sdk#41249 Change-Id: I9939ebc6bbebb32284dd55692d65482fc3ae3f2f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151387 Commit-Queue: Vyacheslav Egorov <[email protected]> Reviewed-by: Alexander Markov <[email protected]>
1 parent 88ad237 commit 04a3598

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

pkg/vm/lib/snapshot/commands/compare.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import 'package:vm/snapshot/ascii_table.dart';
1414

1515
import 'package:vm/snapshot/program_info.dart';
1616
import 'package:vm/snapshot/utils.dart';
17+
import 'package:vm/snapshot/v8_profile.dart';
1718

1819
class 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
}

pkg/vm/lib/snapshot/commands/summary.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import 'package:args/command_runner.dart';
1515
import 'package:vm/snapshot/ascii_table.dart';
1616
import 'package:vm/snapshot/program_info.dart';
1717
import 'package:vm/snapshot/utils.dart';
18+
import 'package:vm/snapshot/v8_profile.dart';
1819

1920
class 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
}

pkg/vm/lib/snapshot/v8_profile.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
''';

0 commit comments

Comments
 (0)