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

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

Issue 1425093006: Revert "Switch profiler from isolates to threads" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 | « runtime/vm/thread_interrupter_test.cc ('k') | runtime/vm/thread_test.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/profiler.h"
11 #include "vm/thread_interrupter.h" 10 #include "vm/thread_interrupter.h"
12 11
13 namespace dart { 12 namespace dart {
14 13
15 DECLARE_FLAG(bool, thread_interrupter); 14 DECLARE_FLAG(bool, thread_interrupter);
16 DECLARE_FLAG(bool, trace_thread_interrupter); 15 DECLARE_FLAG(bool, trace_thread_interrupter);
17 16
18 #define kThreadError -1 17 #define kThreadError -1
19 18
20 class ThreadInterrupterWin : public AllStatic { 19 class ThreadInterrupterWin : public AllStatic {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DWORD result = SuspendThread(handle); 62 DWORD result = SuspendThread(handle);
64 if (result == kThreadError) { 63 if (result == kThreadError) {
65 if (FLAG_trace_thread_interrupter) { 64 if (FLAG_trace_thread_interrupter) {
66 OS::Print("ThreadInterrupter failed to suspend thread %p\n", 65 OS::Print("ThreadInterrupter failed to suspend thread %p\n",
67 reinterpret_cast<void*>(thread->id())); 66 reinterpret_cast<void*>(thread->id()));
68 } 67 }
69 CloseHandle(handle); 68 CloseHandle(handle);
70 return; 69 return;
71 } 70 }
72 InterruptedThreadState its; 71 InterruptedThreadState its;
72 its.tid = thread->id();
73 if (!GrabRegisters(handle, &its)) { 73 if (!GrabRegisters(handle, &its)) {
74 // Failed to get thread registers. 74 // Failed to get thread registers.
75 ResumeThread(handle); 75 ResumeThread(handle);
76 if (FLAG_trace_thread_interrupter) { 76 if (FLAG_trace_thread_interrupter) {
77 OS::Print("ThreadInterrupter failed to get registers for %p\n", 77 OS::Print("ThreadInterrupter failed to get registers for %p\n",
78 reinterpret_cast<void*>(thread->id())); 78 reinterpret_cast<void*>(thread->id()));
79 } 79 }
80 CloseHandle(handle); 80 CloseHandle(handle);
81 return; 81 return;
82 } 82 }
83 Profiler::SampleThread(thread, its); 83 ThreadInterruptCallback callback = NULL;
84 void* callback_data = NULL;
85 if (thread->IsThreadInterrupterEnabled(&callback, &callback_data)) {
86 callback(its, callback_data);
87 }
84 ResumeThread(handle); 88 ResumeThread(handle);
85 CloseHandle(handle); 89 CloseHandle(handle);
86 } 90 }
87 }; 91 };
88 92
89 93
90 void ThreadInterrupter::InterruptThread(Thread* thread) { 94 void ThreadInterrupter::InterruptThread(Thread* thread) {
91 if (FLAG_trace_thread_interrupter) { 95 if (FLAG_trace_thread_interrupter) {
92 OS::Print("ThreadInterrupter suspending %p\n", 96 OS::Print("ThreadInterrupter suspending %p\n",
93 reinterpret_cast<void*>(thread->id())); 97 reinterpret_cast<void*>(thread->id()));
(...skipping 13 matching lines...) Expand all
107 111
108 void ThreadInterrupter::RemoveSignalHandler() { 112 void ThreadInterrupter::RemoveSignalHandler() {
109 // Nothing to do on Windows. 113 // Nothing to do on Windows.
110 } 114 }
111 115
112 116
113 } // namespace dart 117 } // namespace dart
114 118
115 #endif // defined(TARGET_OS_WINDOWS) 119 #endif // defined(TARGET_OS_WINDOWS)
116 120
OLDNEW
« no previous file with comments | « runtime/vm/thread_interrupter_test.cc ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698