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

Unified Diff: apps/benchmark/event.h

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/benchmark_app.cc ('k') | apps/benchmark/event.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/benchmark/event.h
diff --git a/apps/benchmark/event.h b/apps/benchmark/event.h
index 14060accfba6787fa002fea1caf7d4f9ba357356..31f645ddbe31e9045ffcea63de5d396a824f204d 100644
--- a/apps/benchmark/event.h
+++ b/apps/benchmark/event.h
@@ -13,15 +13,20 @@
namespace benchmark {
+// Event types as per the Trace Event format spec.
+enum class EventType {COMPLETE, INSTANT};
+
// Represents a single trace event.
struct Event {
+ EventType type;
std::string name;
- std::string category;
+ std::string categories;
base::TimeTicks timestamp;
base::TimeDelta duration;
Event();
- Event(std::string name,
+ Event(EventType type,
+ std::string name,
std::string category,
base::TimeTicks timestamp,
base::TimeDelta duration);
@@ -29,7 +34,17 @@ struct Event {
};
// Parses a JSON string representing a list of trace events. Stores the outcome
-// in |result| and returns true on success. Returns false on error.
+// in |result| and returns true on success, returns false on error.
+//
+// The supported event types as per the Trace Event format spec:
+// - duration events (phase "B" or "E")
+// - complete events (phase "X")
+// - instant events (phase "I")
+//
+// All other types are accepted, but ignored, ie. they don't appear in
+// |result|. All duration events are joined to form the corresponding complete
+// events and the resulting complete events appear in |result| instead of the
+// the duration events.
bool GetEvents(const std::string& trace_json, std::vector<Event>* result);
} // namespace benchmark
« no previous file with comments | « apps/benchmark/benchmark_app.cc ('k') | apps/benchmark/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698