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

Unified Diff: runtime/vm/timeline.cc

Issue 1274953004: Use real process and thread ids when outputting trace-event (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « runtime/vm/timeline.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timeline.cc
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc
index 4008edbe212ee02a3ce469ebcc970643df1b6995..5f0448868fa1abf14c9a897418b672f2d47ec9d4 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -24,7 +24,7 @@ TimelineEvent::TimelineEvent()
state_(0),
label_(NULL),
stream_(NULL),
- thread_(NULL) {
+ thread_(OSThread::kInvalidThreadId) {
}
@@ -35,7 +35,7 @@ TimelineEvent::~TimelineEvent() {
void TimelineEvent::Reset() {
set_event_type(kNone);
- thread_ = NULL;
+ thread_ = OSThread::kInvalidThreadId;
stream_ = NULL;
label_ = NULL;
FreeArguments();
@@ -171,30 +171,16 @@ void TimelineEvent::Init(EventType event_type,
set_event_type(event_type);
timestamp0_ = 0;
timestamp1_ = 0;
- thread_ = Thread::Current();
+ thread_ = OSThread::GetCurrentThreadId();
label_ = label;
FreeArguments();
}
-static int64_t GetPid(Isolate* isolate) {
- // Some mapping from Isolate* to an integer process id.
- // TODO(Cutch): Investigate if process ids can be strings.
- return static_cast<int64_t>(reinterpret_cast<uintptr_t>(isolate));
-}
-
-
-static int64_t GetTid(Thread* thread) {
- // Some mapping from Thread* to an integer thread id.
- // TODO(Cutch): Investigate if process ids can be strings.
- return static_cast<int64_t>(reinterpret_cast<uintptr_t>(thread));
-}
-
-
void TimelineEvent::PrintJSON(JSONStream* stream) const {
JSONObject obj(stream);
- int64_t pid = GetPid(Isolate::Current());
- int64_t tid = GetTid(thread_);
+ int64_t pid = OS::ProcessId();
+ int64_t tid = OSThread::ThreadIdToIntPtr(thread_);
obj.AddProperty("name", label_);
obj.AddProperty("cat", stream_->name());
obj.AddProperty64("tid", tid);
@@ -343,16 +329,6 @@ TimelineEventRecorder::TimelineEventRecorder() {
void TimelineEventRecorder::PrintJSONMeta(JSONArray* events) const {
- Isolate* isolate = Isolate::Current();
- JSONObject obj(events);
- int64_t pid = GetPid(isolate);
- obj.AddProperty("ph", "M");
- obj.AddProperty64("pid", pid);
- obj.AddProperty("name", "process_name");
- {
- JSONObject args(&obj, "args");
- args.AddProperty("name", isolate->debugger_name());
- }
}
« no previous file with comments | « runtime/vm/timeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698