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

Side by Side Diff: base/test/trace_event_analyzer.h

Issue 277883002: Add cpu count to trace metadata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Use trace_analyzer::Query and trace_analyzer::TraceAnalyzer to search for 5 // Use trace_analyzer::Query and trace_analyzer::TraceAnalyzer to search for
6 // specific trace events that were generated by the trace_event.h API. 6 // specific trace events that were generated by the trace_event.h API.
7 // 7 //
8 // Basic procedure: 8 // Basic procedure:
9 // - Get trace events JSON string from base::debug::TraceLog. 9 // - Get trace events JSON string from base::debug::TraceLog.
10 // - Create TraceAnalyzer with JSON string. 10 // - Create TraceAnalyzer with JSON string.
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // TraceAnalyzer helps tests search for trace events. 556 // TraceAnalyzer helps tests search for trace events.
557 class TraceAnalyzer { 557 class TraceAnalyzer {
558 public: 558 public:
559 ~TraceAnalyzer(); 559 ~TraceAnalyzer();
560 560
561 // Use trace events from JSON string generated by tracing API. 561 // Use trace events from JSON string generated by tracing API.
562 // Returns non-NULL if the JSON is successfully parsed. 562 // Returns non-NULL if the JSON is successfully parsed.
563 static TraceAnalyzer* Create(const std::string& json_events) 563 static TraceAnalyzer* Create(const std::string& json_events)
564 WARN_UNUSED_RESULT; 564 WARN_UNUSED_RESULT;
565 565
566 void SetIgnoreMetadataEvents(bool ignore) { ignore_metadata_events_ = true; }
567
566 // Associate BEGIN and END events with each other. This allows Query(OTHER_*) 568 // Associate BEGIN and END events with each other. This allows Query(OTHER_*)
567 // to access the associated event and enables Query(EVENT_DURATION). 569 // to access the associated event and enables Query(EVENT_DURATION).
568 // An end event will match the most recent begin event with the same name, 570 // An end event will match the most recent begin event with the same name,
569 // category, process ID and thread ID. This matches what is shown in 571 // category, process ID and thread ID. This matches what is shown in
570 // about:tracing. After association, the BEGIN event will point to the 572 // about:tracing. After association, the BEGIN event will point to the
571 // matching END event, but the END event will not point to the BEGIN event. 573 // matching END event, but the END event will not point to the BEGIN event.
572 void AssociateBeginEndEvents(); 574 void AssociateBeginEndEvents();
573 575
574 // Associate ASYNC_BEGIN, ASYNC_STEP and ASYNC_END events with each other. 576 // Associate ASYNC_BEGIN, ASYNC_STEP and ASYNC_END events with each other.
575 // An ASYNC_END event will match the most recent ASYNC_BEGIN or ASYNC_STEP 577 // An ASYNC_END event will match the most recent ASYNC_BEGIN or ASYNC_STEP
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 private: 625 private:
624 TraceAnalyzer(); 626 TraceAnalyzer();
625 627
626 bool SetEvents(const std::string& json_events) WARN_UNUSED_RESULT; 628 bool SetEvents(const std::string& json_events) WARN_UNUSED_RESULT;
627 629
628 // Read metadata (thread names, etc) from events. 630 // Read metadata (thread names, etc) from events.
629 void ParseMetadata(); 631 void ParseMetadata();
630 632
631 std::map<TraceEvent::ProcessThreadID, std::string> thread_names_; 633 std::map<TraceEvent::ProcessThreadID, std::string> thread_names_;
632 std::vector<TraceEvent> raw_events_; 634 std::vector<TraceEvent> raw_events_;
635 bool ignore_metadata_events_;
633 bool allow_assocation_changes_; 636 bool allow_assocation_changes_;
634 637
635 DISALLOW_COPY_AND_ASSIGN(TraceAnalyzer); 638 DISALLOW_COPY_AND_ASSIGN(TraceAnalyzer);
636 }; 639 };
637 640
638 // Utility functions for TraceEventVector. 641 // Utility functions for TraceEventVector.
639 642
640 struct RateStats { 643 struct RateStats {
641 double min_us; 644 double min_us;
642 double max_us; 645 double max_us;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 696
694 // Count all matches. 697 // Count all matches.
695 static inline size_t CountMatches(const TraceEventVector& events, 698 static inline size_t CountMatches(const TraceEventVector& events,
696 const Query& query) { 699 const Query& query) {
697 return CountMatches(events, query, 0u, events.size()); 700 return CountMatches(events, query, 0u, events.size());
698 } 701 }
699 702
700 } // namespace trace_analyzer 703 } // namespace trace_analyzer
701 704
702 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_ 705 #endif // BASE_TEST_TRACE_EVENT_ANALYZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698