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

Side by Side Diff: runtime/lib/timeline.cc

Issue 1439483003: - Add an OSThread structure which is the generic TLS structure for all C++ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review Created 5 years, 1 month 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 | « no previous file | runtime/vm/dart.cc » ('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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/native_entry.h" 9 #include "vm/native_entry.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if (recorder == NULL) { 48 if (recorder == NULL) {
49 return Object::null(); 49 return Object::null();
50 } 50 }
51 51
52 if (!isolate->GetDartStream()->Enabled()) { 52 if (!isolate->GetDartStream()->Enabled()) {
53 // Dart stream is not enabled for this isolate, do nothing. 53 // Dart stream is not enabled for this isolate, do nothing.
54 return Object::null(); 54 return Object::null();
55 } 55 }
56 56
57 int64_t pid = OS::ProcessId(); 57 int64_t pid = OS::ProcessId();
58 int64_t tid = OSThread::ThreadIdToIntPtr(OSThread::GetCurrentThreadTraceId()); 58 OSThread* os_thread = thread->os_thread();
59 ASSERT(os_thread != NULL);
60 int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id());
59 61
60 char* json = OS::SCreate(zone, 62 char* json = OS::SCreate(zone,
61 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 "," 63 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
62 "\"ts\":%" Pd64 ",\"ph\":\"%s\",\"id\":%" Pd64 ", \"args\":%s}", 64 "\"ts\":%" Pd64 ",\"ph\":\"%s\",\"id\":%" Pd64 ", \"args\":%s}",
63 name.ToCString(), 65 name.ToCString(),
64 category.ToCString(), 66 category.ToCString(),
65 tid, 67 tid,
66 pid, 68 pid,
67 start.AsInt64Value(), 69 start.AsInt64Value(),
68 phase.ToCString(), 70 phase.ToCString(),
(...skipping 25 matching lines...) Expand all
94 return Object::null(); 96 return Object::null();
95 } 97 }
96 98
97 if (!isolate->GetDartStream()->Enabled()) { 99 if (!isolate->GetDartStream()->Enabled()) {
98 // Dart stream is not enabled for this isolate, do nothing. 100 // Dart stream is not enabled for this isolate, do nothing.
99 return Object::null(); 101 return Object::null();
100 } 102 }
101 103
102 int64_t duration = end.AsInt64Value() - start.AsInt64Value(); 104 int64_t duration = end.AsInt64Value() - start.AsInt64Value();
103 int64_t pid = OS::ProcessId(); 105 int64_t pid = OS::ProcessId();
104 int64_t tid = OSThread::ThreadIdToIntPtr(OSThread::GetCurrentThreadTraceId()); 106 OSThread* os_thread = thread->os_thread();
107 ASSERT(os_thread != NULL);
108 int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id());
105 109
106 char* json = OS::SCreate(zone, 110 char* json = OS::SCreate(zone,
107 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 "," 111 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
108 "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ",\"args\":%s}", 112 "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ",\"args\":%s}",
109 name.ToCString(), 113 name.ToCString(),
110 category.ToCString(), 114 category.ToCString(),
111 tid, 115 tid,
112 pid, 116 pid,
113 start.AsInt64Value(), 117 start.AsInt64Value(),
114 duration, 118 duration,
(...skipping 22 matching lines...) Expand all
137 if (recorder == NULL) { 141 if (recorder == NULL) {
138 return Object::null(); 142 return Object::null();
139 } 143 }
140 144
141 if (!isolate->GetDartStream()->Enabled()) { 145 if (!isolate->GetDartStream()->Enabled()) {
142 // Dart stream is not enabled for this isolate, do nothing. 146 // Dart stream is not enabled for this isolate, do nothing.
143 return Object::null(); 147 return Object::null();
144 } 148 }
145 149
146 int64_t pid = OS::ProcessId(); 150 int64_t pid = OS::ProcessId();
147 int64_t tid = OSThread::ThreadIdToIntPtr(OSThread::GetCurrentThreadTraceId()); 151 OSThread* os_thread = thread->os_thread();
152 ASSERT(os_thread != NULL);
153 int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id());
148 154
149 char* json = OS::SCreate(zone, 155 char* json = OS::SCreate(zone,
150 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 "," 156 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
151 "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}", 157 "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}",
152 name.ToCString(), 158 name.ToCString(),
153 category.ToCString(), 159 category.ToCString(),
154 tid, 160 tid,
155 pid, 161 pid,
156 start.AsInt64Value(), 162 start.AsInt64Value(),
157 args.ToCString()); 163 args.ToCString());
158 164
159 TimelineEvent* event = isolate->GetDartStream()->StartEvent(); 165 TimelineEvent* event = isolate->GetDartStream()->StartEvent();
160 if (event == NULL) { 166 if (event == NULL) {
161 // Stream was turned off. 167 // Stream was turned off.
162 return Object::null(); 168 return Object::null();
163 } 169 }
164 // json was allocated in the zone and a copy will be stored in event. 170 // json was allocated in the zone and a copy will be stored in event.
165 event->SerializedJSON(json); 171 event->SerializedJSON(json);
166 event->Complete(); 172 event->Complete();
167 173
168 return Object::null(); 174 return Object::null();
169 } 175 }
170 176
171 } // namespace dart 177 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698