Index: base/test/trace_event_analyzer.h |
diff --git a/base/test/trace_event_analyzer.h b/base/test/trace_event_analyzer.h |
index 5e40a062727e9b74755b299d9f4f591973c5e281..cd9a8b3645f22ecfe0c4c702687d38c7388666bc 100644 |
--- a/base/test/trace_event_analyzer.h |
+++ b/base/test/trace_event_analyzer.h |
@@ -415,18 +415,55 @@ class QueryNode : public base::RefCounted<QueryNode> { |
Query query_; |
}; |
-// TraceAnalyzer helps tests search for trace events. |
-class TraceAnalyzer { |
+class TraceEventVector : public std::vector<const TraceEvent*> { |
Paweł Hajdan Jr.
2011/12/12 17:21:51
Inheritance from std::vector? I'm suspicious. Coul
jbates
2011/12/12 22:00:32
Done.
|
public: |
- typedef std::vector<const TraceEvent*> TraceEventVector; |
- |
- struct Stats { |
+ struct RateStats { |
double min_us; |
double max_us; |
double mean_us; |
double standard_deviation_us; |
}; |
+ // Calculate min/max/mean and standard deviation from the times between |
+ // adjacent events. |
+ bool GetRateStats(RateStats* stats); |
+ |
+ // Starting from |position|, find the first event that matches |query|. |
+ // Returns true if found, false otherwise. |
+ bool FindFirstOf(Query query, |
+ size_t position, |
+ size_t* return_index) const; |
+ |
+ // Starting from |position|, find the last event that matches |query|. |
+ // Returns true if found, false otherwise. |
+ bool FindLastOf(Query query, |
+ size_t position, |
+ size_t* return_index) const; |
+ |
+ // Find the closest events to |position| in time that match |query|. |
+ // return_second_closest may be NULL. Closeness is determined by comparing |
+ // with the event timestamp. |
+ // Returns true if found, false otherwise. If both return parameters are |
+ // requested, both must be found for a successful result. |
+ bool FindClosest(Query query, |
+ size_t position, |
+ size_t* return_closest, |
+ size_t* return_second_closest) const; |
Paweł Hajdan Jr.
2011/12/12 17:21:51
nit: If second_closest is there, why not third_clo
jbates
2011/12/12 22:00:32
Returning a sorted vector did occur to me, but one
|
+ |
+ // Count matches, inclusive of |begin_position|, exclusive of |end_position|. |
+ int CountMatches(Query query, |
Paweł Hajdan Jr.
2011/12/12 17:21:51
nit: If size_t is generally used, why this and met
jbates
2011/12/12 22:00:32
Done.
|
+ size_t begin_position, |
+ size_t end_position) const; |
+ |
+ // Count all matches. |
+ int CountMatches(Query query) const { |
+ return CountMatches(query, 0, size()); |
+ } |
+}; |
+ |
+// TraceAnalyzer helps tests search for trace events. |
+class TraceAnalyzer { |
+ public: |
~TraceAnalyzer(); |
// Use trace events from JSON string generated by tracing API. |
@@ -474,6 +511,10 @@ class TraceAnalyzer { |
const Query& second, |
const Query& match); |
+ // For each event, copy its arguments to the other_event argument map. If |
+ // argument name already exists, it will not be overwritten. |
+ void MergeAssociatedEventArgs(); |
+ |
// Find all events that match query and replace output vector. |
size_t FindEvents(const Query& query, TraceEventVector* output); |
@@ -482,10 +523,6 @@ class TraceAnalyzer { |
const std::string& GetThreadName(const TraceEvent::ProcessThreadID& thread); |
- // Calculate min/max/mean and standard deviation from the times between |
- // adjacent events. |
- static bool GetRateStats(const TraceEventVector& events, Stats* stats); |
- |
private: |
TraceAnalyzer(); |