Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Unified Diff: runtime/vm/metrics.cc

Issue 2572873003: Add --print-benchmarking-metrics to the VM for Golem. (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/dart.cc ('K') | « runtime/vm/metrics.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/metrics.cc
diff --git a/runtime/vm/metrics.cc b/runtime/vm/metrics.cc
index 5a2f5a70319f784b3df3580f68844d73e1125051..cd391e8fbde3bf9e5d697476329b1114e37105d5 100644
--- a/runtime/vm/metrics.cc
+++ b/runtime/vm/metrics.cc
@@ -75,6 +75,8 @@ static const char* UnitString(intptr_t unit) {
return "counter";
case Metric::kByte:
return "byte";
+ case Metric::kMicrosecond:
+ return "us";
default:
UNREACHABLE();
}
@@ -113,19 +115,32 @@ char* Metric::ValueToString(int64_t value, Unit unit) {
case kCounter:
return zone->PrintToString("%" Pd64 "", value);
case kByte: {
- const char* scaled_suffix = "b";
+ const char* scaled_suffix = "B";
double scaled_value = static_cast<double>(value);
- if (value > KB) {
- scaled_suffix = "kb";
- scaled_value /= KB;
+ if (value > GB) {
Cutch 2016/12/16 21:49:07 nice fix.
+ scaled_suffix = "GB";
+ scaled_value /= GB;
} else if (value > MB) {
- scaled_suffix = "mb";
+ scaled_suffix = "MB";
scaled_value /= MB;
- } else if (value > GB) {
- scaled_suffix = "gb";
- scaled_value /= GB;
+ } else if (value > KB) {
+ scaled_suffix = "kB";
+ scaled_value /= KB;
+ }
+ return zone->PrintToString("%.3f %s (%" Pd64 " B)", scaled_value,
+ scaled_suffix, value);
+ }
+ case kMicrosecond: {
+ const char* scaled_suffix = "us";
+ double scaled_value = static_cast<double>(value);
+ if (value > kMicrosecondsPerSecond) {
+ scaled_suffix = "s";
+ scaled_value /= kMicrosecondsPerSecond;
+ } else if (value > kMicrosecondsPerMillisecond) {
+ scaled_suffix = "ms";
+ scaled_value /= kMicrosecondsPerMillisecond;
}
- return zone->PrintToString("%.3f %s (%" Pd64 ")", scaled_value,
+ return zone->PrintToString("%.3f %s (%" Pd64 " us)", scaled_value,
scaled_suffix, value);
}
default:
@@ -305,7 +320,7 @@ void Metric::InitOnce() {
}
void Metric::Cleanup() {
- if (FLAG_print_metrics) {
+ if (FLAG_print_metrics || FLAG_print_benchmarking_metrics) {
// Create a zone to allocate temporary strings in.
StackZone sz(Thread::Current());
OS::PrintErr("Printing metrics for VM\n");
« runtime/vm/dart.cc ('K') | « runtime/vm/metrics.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698