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

Unified Diff: apps/benchmark/measurements.cc

Issue 1316163003: Support duration events in `benchmark.mojo`. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 months 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
« no previous file with comments | « apps/benchmark/measurements.h ('k') | apps/benchmark/measurements_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/benchmark/measurements.cc
diff --git a/apps/benchmark/measurements.cc b/apps/benchmark/measurements.cc
index 187d8114275f2237a931c89fee792dd024a52986..59014b1313ac4571089b4c8e10be50a476851d70 100644
--- a/apps/benchmark/measurements.cc
+++ b/apps/benchmark/measurements.cc
@@ -8,15 +8,15 @@ namespace benchmark {
namespace {
bool Match(const Event& event, const EventSpec& spec) {
- return event.name == spec.name && event.category == spec.category;
+ return event.name == spec.name && event.categories == spec.categories;
}
} // namespace
EventSpec::EventSpec() {}
-EventSpec::EventSpec(std::string name, std::string category)
- : name(name), category(category) {}
+EventSpec::EventSpec(std::string name, std::string categories)
+ : name(name), categories(categories) {}
EventSpec::~EventSpec() {}
@@ -24,8 +24,8 @@ Measurement::Measurement() {}
Measurement::Measurement(MeasurementType type,
std::string target_name,
- std::string target_category)
- : type(type), target_event(target_name, target_category) {}
+ std::string target_categories)
+ : type(type), target_event(target_name, target_categories) {}
Measurement::~Measurement() {}
@@ -51,9 +51,6 @@ double Measurements::TimeUntil(const EventSpec& event_spec) {
base::TimeTicks earliest;
bool found = false;
for (const Event& event : events_) {
- if (event.category == "__metadata")
- continue;
-
if (!Match(event, event_spec))
continue;
@@ -73,7 +70,7 @@ double Measurements::AvgDuration(const EventSpec& event_spec) {
double sum = 0.0;
int count = 0;
for (const Event& event : events_) {
- if (event.category == "__metadata")
+ if (event.type != EventType::COMPLETE)
continue;
if (!Match(event, event_spec))
« no previous file with comments | « apps/benchmark/measurements.h ('k') | apps/benchmark/measurements_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698