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

Side by Side Diff: runtime/vm/timeline_test.cc

Issue 1377663002: Add Timeline to dart:developer (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « runtime/vm/timeline.cc ('k') | runtime/vm/zone.h » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <cstring> 5 #include <cstring>
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 EventCounterRecorder() { 209 EventCounterRecorder() {
210 for (intptr_t i = 0; i < TimelineEvent::kNumEventTypes; i++) { 210 for (intptr_t i = 0; i < TimelineEvent::kNumEventTypes; i++) {
211 counts_[i] = 0; 211 counts_[i] = 0;
212 } 212 }
213 } 213 }
214 214
215 void StreamEvent(TimelineEvent* event) { 215 void StreamEvent(TimelineEvent* event) {
216 counts_[event->event_type()]++; 216 counts_[event->event_type()]++;
217 } 217 }
218 218
219 void StreamDartEvent(const char* event) {
220 // NOOP.
221 }
222
219 intptr_t CountFor(TimelineEvent::EventType type) { 223 intptr_t CountFor(TimelineEvent::EventType type) {
220 return counts_[type]; 224 return counts_[type];
221 } 225 }
222 226
223 private: 227 private:
224 intptr_t counts_[TimelineEvent::kNumEventTypes]; 228 intptr_t counts_[TimelineEvent::kNumEventTypes];
225 }; 229 };
226 230
227 231
228 TEST_CASE(TimelineEventStreamingRecorderBasic) { 232 TEST_CASE(TimelineEventStreamingRecorderBasic) {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 EXPECT(!pauses.has_error()); 603 EXPECT(!pauses.has_error());
600 EXPECT_EQ(10, pauses.InclusiveTime("a")); 604 EXPECT_EQ(10, pauses.InclusiveTime("a"));
601 EXPECT_EQ(10, pauses.ExclusiveTime("a")); 605 EXPECT_EQ(10, pauses.ExclusiveTime("a"));
602 EXPECT_EQ(10, pauses.MaxInclusiveTime("a")); 606 EXPECT_EQ(10, pauses.MaxInclusiveTime("a"));
603 EXPECT_EQ(8, pauses.MaxExclusiveTime("a")); 607 EXPECT_EQ(8, pauses.MaxExclusiveTime("a"));
604 } 608 }
605 TimelineTestHelper::Clear(recorder); 609 TimelineTestHelper::Clear(recorder);
606 } 610 }
607 611
608 } // namespace dart 612 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/timeline.cc ('k') | runtime/vm/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698