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

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

Issue 1849643002: Add support for async, metadata, and counter timeline events to be reported by the embedder (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/timeline.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 9521 matching lines...) Expand 10 before | Expand all | Expand 10 after
9532 9532
9533 { 9533 {
9534 // Add something to the embedder stream. 9534 // Add something to the embedder stream.
9535 Dart_TimelineEvent("TRACE_EVENT", 9535 Dart_TimelineEvent("TRACE_EVENT",
9536 Dart_TimelineGetMicros(), 9536 Dart_TimelineGetMicros(),
9537 0, 9537 0,
9538 Dart_Timeline_Event_Begin, 9538 Dart_Timeline_Event_Begin,
9539 1, 9539 1,
9540 &arg_names[0], 9540 &arg_names[0],
9541 &arg_values[0]); 9541 &arg_values[0]);
9542 // Add metadata to the embedder stream.
9543 Dart_TimelineEvent("METADATA_EVENT",
9544 Dart_TimelineGetMicros(),
9545 0,
9546 Dart_Timeline_Event_Metadata,
9547 0,
9548 NULL,
9549 NULL);
9550 // Add counter to the embedder stream.
9551 Dart_TimelineEvent("COUNTER_EVENT",
9552 Dart_TimelineGetMicros(),
9553 0,
9554 Dart_Timeline_Event_Counter,
9555 0,
9556 NULL,
9557 NULL);
9542 } 9558 }
9543 9559
9544 // Invoke main, which will be compiled resulting in a compiler event in 9560 // Invoke main, which will be compiled resulting in a compiler event in
9545 // the timeline. 9561 // the timeline.
9546 Dart_Handle result = Dart_Invoke(lib, 9562 Dart_Handle result = Dart_Invoke(lib,
9547 NewString("main"), 9563 NewString("main"),
9548 0, 9564 0,
9549 NULL); 9565 NULL);
9550 EXPECT_VALID(result); 9566 EXPECT_VALID(result);
9551 9567
(...skipping 24 matching lines...) Expand all
9576 9592
9577 // Heartbeat test. 9593 // Heartbeat test.
9578 EXPECT_SUBSTRING("\"name\":\"TestVMDuration\"", buffer); 9594 EXPECT_SUBSTRING("\"name\":\"TestVMDuration\"", buffer);
9579 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer); 9595 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer);
9580 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer); 9596 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer);
9581 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer); 9597 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer);
9582 EXPECT_NOTSUBSTRING("\"function\":\"::_bar\"", buffer); 9598 EXPECT_NOTSUBSTRING("\"function\":\"::_bar\"", buffer);
9583 EXPECT_SUBSTRING("TRACE_EVENT", buffer); 9599 EXPECT_SUBSTRING("TRACE_EVENT", buffer);
9584 EXPECT_SUBSTRING("arg0", buffer); 9600 EXPECT_SUBSTRING("arg0", buffer);
9585 EXPECT_SUBSTRING("value0", buffer); 9601 EXPECT_SUBSTRING("value0", buffer);
9602 EXPECT_SUBSTRING("METADATA_EVENT", buffer);
9603 EXPECT_SUBSTRING("COUNTER_EVENT", buffer);
9586 9604
9587 // Free buffer allocated by AppendStreamConsumer 9605 // Free buffer allocated by AppendStreamConsumer
9588 free(data.buffer); 9606 free(data.buffer);
9589 data.buffer = NULL; 9607 data.buffer = NULL;
9590 data.buffer_length = 0; 9608 data.buffer_length = 0;
9591 9609
9592 // Retrieving the global trace resulted in all open blocks being reclaimed. 9610 // Retrieving the global trace resulted in all open blocks being reclaimed.
9593 // Add some new events and verify that both sets of events are present 9611 // Add some new events and verify that both sets of events are present
9594 // in the resulting trace. 9612 // in the resulting trace.
9595 { 9613 {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
9823 EXPECT(!start_called); 9841 EXPECT(!start_called);
9824 EXPECT(!stop_called); 9842 EXPECT(!stop_called);
9825 Timeline::SetStreamEmbedderEnabled(false); 9843 Timeline::SetStreamEmbedderEnabled(false);
9826 EXPECT(!start_called); 9844 EXPECT(!start_called);
9827 EXPECT(stop_called); 9845 EXPECT(stop_called);
9828 } 9846 }
9829 9847
9830 #endif // !PRODUCT 9848 #endif // !PRODUCT
9831 9849
9832 } // namespace dart 9850 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/timeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698