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

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

Issue 8590015: trace_event: distinguish between scoped begin/end and global start/finish events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jam, nduca feedback Created 9 years 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) 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/bind.h" 5 #include "base/bind.h"
6 #include "base/test/trace_event_analyzer.h" 6 #include "base/test/trace_event_analyzer.h"
7 #include "testing/gmock/include/gmock/gmock.h" 7 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace trace_analyzer { 10 namespace trace_analyzer {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 TEST_F(TraceEventAnalyzerTest, QueryEventMember) { 103 TEST_F(TraceEventAnalyzerTest, QueryEventMember) {
104 using namespace trace_analyzer; 104 using namespace trace_analyzer;
105 ManualSetUp(); 105 ManualSetUp();
106 106
107 TraceEvent event; 107 TraceEvent event;
108 event.thread.process_id = 3; 108 event.thread.process_id = 3;
109 event.thread.thread_id = 4; 109 event.thread.thread_id = 4;
110 event.timestamp = 1.5; 110 event.timestamp = 1.5;
111 event.phase = base::debug::TRACE_EVENT_PHASE_BEGIN; 111 event.phase = TRACE_EVENT_PHASE_BEGIN;
112 event.category = "category"; 112 event.category = "category";
113 event.name = "name"; 113 event.name = "name";
114 event.arg_numbers["num"] = 7.0; 114 event.arg_numbers["num"] = 7.0;
115 event.arg_strings["str"] = "the string"; 115 event.arg_strings["str"] = "the string";
116 116
117 // Other event with all different members: 117 // Other event with all different members:
118 TraceEvent other; 118 TraceEvent other;
119 other.thread.process_id = 5; 119 other.thread.process_id = 5;
120 other.thread.thread_id = 6; 120 other.thread.thread_id = 6;
121 other.timestamp = 2.5; 121 other.timestamp = 2.5;
122 other.phase = base::debug::TRACE_EVENT_PHASE_END; 122 other.phase = TRACE_EVENT_PHASE_END;
123 other.category = "category2"; 123 other.category = "category2";
124 other.name = "name2"; 124 other.name = "name2";
125 other.arg_numbers["num2"] = 8.0; 125 other.arg_numbers["num2"] = 8.0;
126 other.arg_strings["str2"] = "the string 2"; 126 other.arg_strings["str2"] = "the string 2";
127 127
128 event.other_event = &other; 128 event.other_event = &other;
129 ASSERT_TRUE(event.has_other_event()); 129 ASSERT_TRUE(event.has_other_event());
130 double duration = event.GetAbsTimeToOtherEvent(); 130 double duration = event.GetAbsTimeToOtherEvent();
131 131
132 Query event_pid = (Query(EVENT_PID) == Query::Int(event.thread.process_id)); 132 Query event_pid = (Query(EVENT_PID) == Query::Int(event.thread.process_id));
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 few_event_ptrs.push_back(&event); 566 few_event_ptrs.push_back(&event);
567 few_event_ptrs.push_back(&event); 567 few_event_ptrs.push_back(&event);
568 ASSERT_FALSE(TraceAnalyzer::GetRateStats(few_event_ptrs, &stats)); 568 ASSERT_FALSE(TraceAnalyzer::GetRateStats(few_event_ptrs, &stats));
569 few_event_ptrs.push_back(&event); 569 few_event_ptrs.push_back(&event);
570 ASSERT_TRUE(TraceAnalyzer::GetRateStats(few_event_ptrs, &stats)); 570 ASSERT_TRUE(TraceAnalyzer::GetRateStats(few_event_ptrs, &stats));
571 } 571 }
572 572
573 573
574 } // namespace trace_analyzer 574 } // namespace trace_analyzer
575 575
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698