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

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

Issue 9187015: Remove usage of using namespace, and cleanup trace_analyzer namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile Created 8 years, 11 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
« no previous file with comments | « base/test/trace_event_analyzer.h ('k') | base/test/trace_event_analyzer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/test/trace_event_analyzer.h" 5 #include "base/test/trace_event_analyzer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <math.h> 8 #include <math.h>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 bool TraceAnalyzer::SetEvents(const std::string& json_events) { 667 bool TraceAnalyzer::SetEvents(const std::string& json_events) {
668 raw_events_.clear(); 668 raw_events_.clear();
669 if (!ParseEventsFromJson(json_events, &raw_events_)) 669 if (!ParseEventsFromJson(json_events, &raw_events_))
670 return false; 670 return false;
671 std::stable_sort(raw_events_.begin(), raw_events_.end()); 671 std::stable_sort(raw_events_.begin(), raw_events_.end());
672 ParseMetadata(); 672 ParseMetadata();
673 return true; 673 return true;
674 } 674 }
675 675
676 void TraceAnalyzer::AssociateBeginEndEvents() { 676 void TraceAnalyzer::AssociateBeginEndEvents() {
677 using namespace trace_analyzer; 677 using trace_analyzer::Query;
678 678
679 Query begin(Query(EVENT_PHASE) == Query::Phase(TRACE_EVENT_PHASE_BEGIN)); 679 Query begin(Query::EventPhase() == Query::Phase(TRACE_EVENT_PHASE_BEGIN));
680 Query end(Query(EVENT_PHASE) == Query::Phase(TRACE_EVENT_PHASE_END)); 680 Query end(Query::EventPhase() == Query::Phase(TRACE_EVENT_PHASE_END));
681 Query match(Query(EVENT_NAME) == Query(OTHER_NAME) && 681 Query match(Query::EventName() == Query::OtherName() &&
682 Query(EVENT_CATEGORY) == Query(OTHER_CATEGORY) && 682 Query::EventCategory() == Query::OtherCategory() &&
683 Query(EVENT_TID) == Query(OTHER_TID) && 683 Query::EventTid() == Query::OtherTid() &&
684 Query(EVENT_PID) == Query(OTHER_PID)); 684 Query::EventPid() == Query::OtherPid());
685 685
686 AssociateEvents(begin, end, match); 686 AssociateEvents(begin, end, match);
687 } 687 }
688 688
689 void TraceAnalyzer::AssociateStartFinishEvents() { 689 void TraceAnalyzer::AssociateStartFinishEvents() {
690 using namespace trace_analyzer; 690 using trace_analyzer::Query;
691 691
692 Query begin(Query(EVENT_PHASE) == Query::Phase(TRACE_EVENT_PHASE_START)); 692 Query begin(Query::EventPhase() == Query::Phase(TRACE_EVENT_PHASE_START));
693 Query end(Query(EVENT_PHASE) == Query::Phase(TRACE_EVENT_PHASE_FINISH)); 693 Query end(Query::EventPhase() == Query::Phase(TRACE_EVENT_PHASE_FINISH));
694 Query match(Query(EVENT_NAME) == Query(OTHER_NAME) && 694 Query match(Query::EventName() == Query::OtherName() &&
695 Query(EVENT_CATEGORY) == Query(OTHER_CATEGORY) && 695 Query::EventCategory() == Query::OtherCategory() &&
696 Query(EVENT_ID) == Query(OTHER_ID)); 696 Query::EventId() == Query::OtherId());
697 697
698 AssociateEvents(begin, end, match); 698 AssociateEvents(begin, end, match);
699 } 699 }
700 700
701 void TraceAnalyzer::AssociateEvents(const Query& first, 701 void TraceAnalyzer::AssociateEvents(const Query& first,
702 const Query& second, 702 const Query& second,
703 const Query& match) { 703 const Query& match) {
704 DCHECK(allow_assocation_changes_) << "AssociateEvents not allowed after " 704 DCHECK(allow_assocation_changes_) << "AssociateEvents not allowed after "
705 "FindEvents"; 705 "FindEvents";
706 706
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 size_t count = 0u; 904 size_t count = 0u;
905 for (size_t i = begin_position; i < end_position; ++i) { 905 for (size_t i = begin_position; i < end_position; ++i) {
906 if (query.Evaluate(*events.at(i))) 906 if (query.Evaluate(*events.at(i)))
907 ++count; 907 ++count;
908 } 908 }
909 return count; 909 return count;
910 } 910 }
911 911
912 } // namespace trace_analyzer 912 } // namespace trace_analyzer
913 913
OLDNEW
« no previous file with comments | « base/test/trace_event_analyzer.h ('k') | base/test/trace_event_analyzer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698