OLD | NEW |
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 "vm/compiler.h" | 6 #include "vm/compiler.h" |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_mirrors_api.h" | 8 #include "include/dart_mirrors_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
(...skipping 9530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9541 | 9541 |
9542 { | 9542 { |
9543 // Add something to the embedder stream. | 9543 // Add something to the embedder stream. |
9544 Dart_TimelineEvent("TRACE_EVENT", | 9544 Dart_TimelineEvent("TRACE_EVENT", |
9545 Dart_TimelineGetMicros(), | 9545 Dart_TimelineGetMicros(), |
9546 0, | 9546 0, |
9547 Dart_Timeline_Event_Begin, | 9547 Dart_Timeline_Event_Begin, |
9548 1, | 9548 1, |
9549 &arg_names[0], | 9549 &arg_names[0], |
9550 &arg_values[0]); | 9550 &arg_values[0]); |
9551 // Add metadata to the embedder stream. | |
9552 Dart_TimelineEvent("METADATA_EVENT", | |
9553 Dart_TimelineGetMicros(), | |
9554 0, | |
9555 Dart_Timeline_Event_Metadata, | |
9556 0, | |
9557 NULL, | |
9558 NULL); | |
9559 // Add counter to the embedder stream. | 9551 // Add counter to the embedder stream. |
9560 Dart_TimelineEvent("COUNTER_EVENT", | 9552 Dart_TimelineEvent("COUNTER_EVENT", |
9561 Dart_TimelineGetMicros(), | 9553 Dart_TimelineGetMicros(), |
9562 0, | 9554 0, |
9563 Dart_Timeline_Event_Counter, | 9555 Dart_Timeline_Event_Counter, |
9564 0, | 9556 0, |
9565 NULL, | 9557 NULL, |
9566 NULL); | 9558 NULL); |
| 9559 Dart_SetThreadName("CUSTOM THREAD NAME"); |
9567 } | 9560 } |
9568 | 9561 |
9569 // Invoke main, which will be compiled resulting in a compiler event in | 9562 // Invoke main, which will be compiled resulting in a compiler event in |
9570 // the timeline. | 9563 // the timeline. |
9571 Dart_Handle result = Dart_Invoke(lib, | 9564 Dart_Handle result = Dart_Invoke(lib, |
9572 NewString("main"), | 9565 NewString("main"), |
9573 0, | 9566 0, |
9574 NULL); | 9567 NULL); |
9575 EXPECT_VALID(result); | 9568 EXPECT_VALID(result); |
9576 | 9569 |
(...skipping 24 matching lines...) Expand all Loading... |
9601 | 9594 |
9602 // Heartbeat test. | 9595 // Heartbeat test. |
9603 EXPECT_SUBSTRING("\"name\":\"TestVMDuration\"", buffer); | 9596 EXPECT_SUBSTRING("\"name\":\"TestVMDuration\"", buffer); |
9604 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer); | 9597 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer); |
9605 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer); | 9598 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer); |
9606 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer); | 9599 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer); |
9607 EXPECT_NOTSUBSTRING("\"function\":\"::_bar\"", buffer); | 9600 EXPECT_NOTSUBSTRING("\"function\":\"::_bar\"", buffer); |
9608 EXPECT_SUBSTRING("TRACE_EVENT", buffer); | 9601 EXPECT_SUBSTRING("TRACE_EVENT", buffer); |
9609 EXPECT_SUBSTRING("arg0", buffer); | 9602 EXPECT_SUBSTRING("arg0", buffer); |
9610 EXPECT_SUBSTRING("value0", buffer); | 9603 EXPECT_SUBSTRING("value0", buffer); |
9611 EXPECT_SUBSTRING("METADATA_EVENT", buffer); | |
9612 EXPECT_SUBSTRING("COUNTER_EVENT", buffer); | 9604 EXPECT_SUBSTRING("COUNTER_EVENT", buffer); |
| 9605 EXPECT_SUBSTRING("CUSTOM THREAD NAME", buffer); |
9613 | 9606 |
9614 // Free buffer allocated by AppendStreamConsumer | 9607 // Free buffer allocated by AppendStreamConsumer |
9615 free(data.buffer); | 9608 free(data.buffer); |
9616 data.buffer = NULL; | 9609 data.buffer = NULL; |
9617 data.buffer_length = 0; | 9610 data.buffer_length = 0; |
9618 | 9611 |
9619 // Retrieving the global trace resulted in all open blocks being reclaimed. | 9612 // Retrieving the global trace resulted in all open blocks being reclaimed. |
9620 // Add some new events and verify that both sets of events are present | 9613 // Add some new events and verify that both sets of events are present |
9621 // in the resulting trace. | 9614 // in the resulting trace. |
9622 { | 9615 { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10008 result = Dart_Invoke(lib, | 10001 result = Dart_Invoke(lib, |
10009 NewString("foozoo"), | 10002 NewString("foozoo"), |
10010 0, | 10003 0, |
10011 NULL); | 10004 NULL); |
10012 EXPECT(Dart_IsError(result)); | 10005 EXPECT(Dart_IsError(result)); |
10013 } | 10006 } |
10014 | 10007 |
10015 #endif // !PRODUCT | 10008 #endif // !PRODUCT |
10016 | 10009 |
10017 } // namespace dart | 10010 } // namespace dart |
OLD | NEW |