Index: runtime/vm/snapshot.cc |
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc |
index b7a1b83c5e8e6aa1d04e29462b6fd0e7ea240616..22a61b29d4c4b51707eab5f5d86655cffe8d83ab 100644 |
--- a/runtime/vm/snapshot.cc |
+++ b/runtime/vm/snapshot.cc |
@@ -20,6 +20,7 @@ |
#include "vm/symbols.h" |
#include "vm/timeline.h" |
#include "vm/version.h" |
+#include "vm/code_statistics.h" |
// We currently only expect the Dart mutator to read snapshots. |
#define ASSERT_NO_SAFEPOINT_SCOPE() \ |
@@ -708,6 +709,35 @@ int32_t InstructionsWriter::GetObjectOffsetFor(RawObject* raw_object) { |
} |
+void InstructionsWriter::DumpCombinedCodeStatistics() const { |
+ CombinedCodeStatistics instruction_stats; |
+ intptr_t count = instructions_.length(); |
+ intptr_t missing_count = 0; |
+ for (intptr_t i = 0; i < count; i++) { |
+ const Code &code = *instructions_[i].code_; |
+ CodeStatistics* stats = code.stats(); |
+ if (stats != NULL) { |
+ stats->AppendTo(&instruction_stats); |
+ } else { |
+ missing_count++; |
+ } |
+ } |
+ instruction_stats.DumpStatistics(); |
+ if (missing_count > 0) { |
+ fprintf(stderr, "--------------------\n"); |
+ fprintf( |
+ stderr, |
+ "Missed statistics for %" Pd " out of %" Pd " functions\n", |
+ missing_count, count); |
+ fprintf(stderr, "--------------------\n"); |
+ } |
+ |
+ fprintf(stderr, "--------------------\n"); |
+ fprintf(stderr, "Emitted %" Pd " functions\n", count); |
+ fprintf(stderr, "--------------------\n"); |
+} |
+ |
+ |
static void EnsureIdentifier(char* label) { |
for (char c = *label; c != '\0'; c = *++label) { |
if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || |