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

Unified Diff: runtime/lib/timeline.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/timeline.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/timeline.cc
diff --git a/runtime/lib/timeline.cc b/runtime/lib/timeline.cc
index 32f5896c0d30995e5b970fa4d539c6cc3562ac79..06c3ba7c0cc6ea9cc207ecc39b2ddf40b9308fbc 100644
--- a/runtime/lib/timeline.cc
+++ b/runtime/lib/timeline.cc
@@ -14,8 +14,11 @@
namespace dart {
// Native implementations for the dart:developer library.
-DEFINE_NATIVE_ENTRY(Timeline_getTraceClock, 0) {
- return Integer::New(OS::GetCurrentTraceMicros(), Heap::kNew, true);
+
+DEFINE_NATIVE_ENTRY(Timeline_getIsolateNum, 0) {
+ return Integer::New(static_cast<int64_t>(isolate->main_port()),
+ Heap::kOld,
+ true);
}
@@ -28,6 +31,11 @@ DEFINE_NATIVE_ENTRY(Timeline_getNextAsyncId, 0) {
}
+DEFINE_NATIVE_ENTRY(Timeline_getTraceClock, 0) {
+ return Integer::New(OS::GetCurrentTraceMicros(), Heap::kNew, true);
+}
+
+
DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) {
GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Integer, id, arguments->NativeArgAt(1));
@@ -46,11 +54,10 @@ DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) {
return Object::null();
}
-
int64_t pid = OS::ProcessId();
int64_t tid = OSThread::ThreadIdToIntPtr(OSThread::GetCurrentThreadTraceId());
- char* event = OS::SCreate(zone,
+ char* json = OS::SCreate(zone,
"{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
"\"ts\":%" Pd64 ",\"ph\":\"%s\",\"id\":%" Pd64 ", \"args\":%s}",
name.ToCString(),
@@ -62,8 +69,14 @@ DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) {
id.AsInt64Value(),
args.ToCString());
- // event was allocated in the zone and will be copied by AppendDartEvent.
- recorder->AppendDartEvent(isolate, event);
+ TimelineEvent* event = isolate->GetDartStream()->StartEvent();
+ if (event == NULL) {
+ // Stream was turned off.
+ return Object::null();
+ }
+ // json was allocated in the zone and a copy will be stored in event.
+ event->SerializedJSON(json);
+ event->Complete();
return Object::null();
}
@@ -90,7 +103,7 @@ DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) {
int64_t pid = OS::ProcessId();
int64_t tid = OSThread::ThreadIdToIntPtr(OSThread::GetCurrentThreadTraceId());
- char* event = OS::SCreate(zone,
+ char* json = OS::SCreate(zone,
"{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
"\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ",\"args\":%s}",
name.ToCString(),
@@ -101,8 +114,14 @@ DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) {
duration,
args.ToCString());
- // event was allocated in the zone and will be copied by AppendDartEvent.
- recorder->AppendDartEvent(isolate, event);
+ TimelineEvent* event = isolate->GetDartStream()->StartEvent();
+ if (event == NULL) {
+ // Stream was turned off.
+ return Object::null();
+ }
+ // json was allocated in the zone and a copy will be stored in event.
+ event->SerializedJSON(json);
+ event->Complete();
return Object::null();
}
« no previous file with comments | « no previous file | runtime/lib/timeline.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698