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

Side by Side Diff: runtime/vm/thread_interrupter.h

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.cc ('k') | runtime/vm/thread_interrupter.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 #ifndef VM_THREAD_INTERRUPTER_H_ 5 #ifndef VM_THREAD_INTERRUPTER_H_
6 #define VM_THREAD_INTERRUPTER_H_ 6 #define VM_THREAD_INTERRUPTER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/signal_handler.h" 9 #include "vm/signal_handler.h"
10 #include "vm/os_thread.h" 10 #include "vm/os_thread.h"
11 #include "vm/thread.h" 11 #include "vm/thread.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 class ThreadInterrupter : public AllStatic { 15 class ThreadInterrupter : public AllStatic {
16 public: 16 public:
17 static void InitOnce(); 17 static void InitOnce();
18 18
19 static void Startup(); 19 static void Startup();
20 static void Shutdown(); 20 static void Shutdown();
21 21
22 // Delay between interrupts. 22 // Delay between interrupts.
23 static void SetInterruptPeriod(intptr_t period); 23 static void SetInterruptPeriod(intptr_t period);
24 24
25 // Wake up the thread interrupter thread. 25 // Wake up the thread interrupter thread.
26 static void WakeUp(); 26 static void WakeUp();
27 27
28 // Register the currently running thread for interrupts. If the current thread
29 // is already registered, callback and data will be updated.
30 static void Register(ThreadInterruptCallback callback, void* data);
31
32 // Unregister the currently running thread for interrupts.
33 static void Unregister();
34
28 // Interrupt a thread. 35 // Interrupt a thread.
29 static void InterruptThread(Thread* thread); 36 static void InterruptThread(Thread* thread);
30 37
31 private: 38 private:
32 static const intptr_t kMaxThreads = 4096; 39 static const intptr_t kMaxThreads = 4096;
33 static bool initialized_; 40 static bool initialized_;
34 static bool shutdown_; 41 static bool shutdown_;
35 static bool thread_running_; 42 static bool thread_running_;
36 static bool woken_up_;
37 static ThreadJoinId interrupter_thread_id_; 43 static ThreadJoinId interrupter_thread_id_;
38 static Monitor* monitor_; 44 static Monitor* monitor_;
39 static intptr_t interrupt_period_; 45 static intptr_t interrupt_period_;
40 static intptr_t current_wait_time_; 46 static intptr_t current_wait_time_;
41 47
42 static bool InDeepSleep() { 48 static bool InDeepSleep() {
43 return current_wait_time_ == Monitor::kNoTimeout; 49 return current_wait_time_ == Monitor::kNoTimeout;
44 } 50 }
45 51
46 static void UpdateStateObject(ThreadInterruptCallback callback, void* data); 52 static void UpdateStateObject(ThreadInterruptCallback callback, void* data);
47 53
48 static void ThreadMain(uword parameters); 54 static void ThreadMain(uword parameters);
49 55
50 static void InstallSignalHandler(); 56 static void InstallSignalHandler();
51 57
52 static void RemoveSignalHandler(); 58 static void RemoveSignalHandler();
53 59
54 friend class ThreadInterrupterVisitIsolates; 60 friend class ThreadInterrupterVisitIsolates;
55 }; 61 };
56 62
63 void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data);
64
57 } // namespace dart 65 } // namespace dart
58 66
59 #endif // VM_THREAD_INTERRUPTER_H_ 67 #endif // VM_THREAD_INTERRUPTER_H_
OLDNEW
« no previous file with comments | « runtime/vm/thread.cc ('k') | runtime/vm/thread_interrupter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698