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

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

Issue 1411783004: More timeline cleanups (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/dart_api_impl.cc ('k') | runtime/vm/json_stream.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "bin/builtin.h" 5 #include "bin/builtin.h"
6 #include "include/dart_api.h" 6 #include "include/dart_api.h"
7 #include "include/dart_mirrors_api.h" 7 #include "include/dart_mirrors_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "include/dart_tools_api.h" 9 #include "include/dart_tools_api.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 9410 matching lines...) Expand 10 before | Expand all | Expand 10 after
9421 // Grab embedder stream. 9421 // Grab embedder stream.
9422 TimelineStream* stream = isolate->GetEmbedderStream(); 9422 TimelineStream* stream = isolate->GetEmbedderStream();
9423 // Make sure it is enabled. 9423 // Make sure it is enabled.
9424 stream->set_enabled(true); 9424 stream->set_enabled(true);
9425 // Add a duration event. 9425 // Add a duration event.
9426 Dart_TimelineDuration("testDurationEvent", 0, 1); 9426 Dart_TimelineDuration("testDurationEvent", 0, 1);
9427 // Check that it is in the output. 9427 // Check that it is in the output.
9428 TimelineEventRecorder* recorder = Timeline::recorder(); 9428 TimelineEventRecorder* recorder = Timeline::recorder();
9429 Timeline::ReclaimCachedBlocksFromThreads(); 9429 Timeline::ReclaimCachedBlocksFromThreads();
9430 JSONStream js; 9430 JSONStream js;
9431 IsolateTimelineEventFilter filter(isolate); 9431 IsolateTimelineEventFilter filter(isolate->main_port());
9432 recorder->PrintJSON(&js, &filter); 9432 recorder->PrintJSON(&js, &filter);
9433 EXPECT_SUBSTRING("testDurationEvent", js.ToCString()); 9433 EXPECT_SUBSTRING("testDurationEvent", js.ToCString());
9434 } 9434 }
9435 9435
9436 9436
9437 TEST_CASE(Timeline_Dart_TimelineInstant) { 9437 TEST_CASE(Timeline_Dart_TimelineInstant) {
9438 Isolate* isolate = Isolate::Current(); 9438 Isolate* isolate = Isolate::Current();
9439 // Grab embedder stream. 9439 // Grab embedder stream.
9440 TimelineStream* stream = isolate->GetEmbedderStream(); 9440 TimelineStream* stream = isolate->GetEmbedderStream();
9441 // Make sure it is enabled. 9441 // Make sure it is enabled.
9442 stream->set_enabled(true); 9442 stream->set_enabled(true);
9443 Dart_TimelineInstant("testInstantEvent"); 9443 Dart_TimelineInstant("testInstantEvent");
9444 // Check that it is in the output. 9444 // Check that it is in the output.
9445 TimelineEventRecorder* recorder = Timeline::recorder(); 9445 TimelineEventRecorder* recorder = Timeline::recorder();
9446 Timeline::ReclaimCachedBlocksFromThreads(); 9446 Timeline::ReclaimCachedBlocksFromThreads();
9447 JSONStream js; 9447 JSONStream js;
9448 IsolateTimelineEventFilter filter(isolate); 9448 IsolateTimelineEventFilter filter(isolate->main_port());
9449 recorder->PrintJSON(&js, &filter); 9449 recorder->PrintJSON(&js, &filter);
9450 EXPECT_SUBSTRING("testInstantEvent", js.ToCString()); 9450 EXPECT_SUBSTRING("testInstantEvent", js.ToCString());
9451 } 9451 }
9452 9452
9453 9453
9454 TEST_CASE(Timeline_Dart_TimelineAsyncDisabled) { 9454 TEST_CASE(Timeline_Dart_TimelineAsyncDisabled) {
9455 Isolate* isolate = Isolate::Current(); 9455 Isolate* isolate = Isolate::Current();
9456 // Grab embedder stream. 9456 // Grab embedder stream.
9457 TimelineStream* stream = isolate->GetEmbedderStream(); 9457 TimelineStream* stream = isolate->GetEmbedderStream();
9458 // Make sure it is disabled. 9458 // Make sure it is disabled.
(...skipping 24 matching lines...) Expand all
9483 Dart_TimelineAsyncBegin("testAsyncEvent", &async_id); 9483 Dart_TimelineAsyncBegin("testAsyncEvent", &async_id);
9484 // Expect that the |async_id| is >= 0. 9484 // Expect that the |async_id| is >= 0.
9485 EXPECT(async_id >= 0); 9485 EXPECT(async_id >= 0);
9486 9486
9487 Dart_TimelineAsyncEnd("testAsyncEvent", async_id); 9487 Dart_TimelineAsyncEnd("testAsyncEvent", async_id);
9488 9488
9489 // Check that it is in the output. 9489 // Check that it is in the output.
9490 TimelineEventRecorder* recorder = Timeline::recorder(); 9490 TimelineEventRecorder* recorder = Timeline::recorder();
9491 Timeline::ReclaimCachedBlocksFromThreads(); 9491 Timeline::ReclaimCachedBlocksFromThreads();
9492 JSONStream js; 9492 JSONStream js;
9493 IsolateTimelineEventFilter filter(isolate); 9493 IsolateTimelineEventFilter filter(isolate->main_port());
9494 recorder->PrintJSON(&js, &filter); 9494 recorder->PrintJSON(&js, &filter);
9495 EXPECT_SUBSTRING("testAsyncEvent", js.ToCString()); 9495 EXPECT_SUBSTRING("testAsyncEvent", js.ToCString());
9496 } 9496 }
9497 9497
9498 9498
9499 struct AppendData { 9499 struct AppendData {
9500 uint8_t* buffer; 9500 uint8_t* buffer;
9501 intptr_t buffer_length; 9501 intptr_t buffer_length;
9502 }; 9502 };
9503 9503
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
9788 9788
9789 // Heartbeat test for new events. 9789 // Heartbeat test for new events.
9790 EXPECT_SUBSTRING("\"name\":\"TestVMDuration2\"", buffer); 9790 EXPECT_SUBSTRING("\"name\":\"TestVMDuration2\"", buffer);
9791 EXPECT_SUBSTRING("\"function\":\"::_bar\"", buffer); 9791 EXPECT_SUBSTRING("\"function\":\"::_bar\"", buffer);
9792 9792
9793 // Free buffer allocated by AppendStreamConsumer 9793 // Free buffer allocated by AppendStreamConsumer
9794 free(data.buffer); 9794 free(data.buffer);
9795 } 9795 }
9796 9796
9797 } // namespace dart 9797 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/json_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698