-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy paththreadState.h
More file actions
48 lines (43 loc) · 1.22 KB
/
threadState.h
File metadata and controls
48 lines (43 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef JAVA_PROFILER_LIBRARY_THREAD_STATE_H
#define JAVA_PROFILER_LIBRARY_THREAD_STATE_H
#include "jvmti.h"
enum class OSThreadState : int {
UNKNOWN = 0,
NEW = 1, // The thread has been initialized but yet started
RUNNABLE = 2, // Has been started and is runnable, but not necessarily running
MONITOR_WAIT = 3, // Waiting on a contended monitor lock
CONDVAR_WAIT = 4, // Waiting on a condition variable
OBJECT_WAIT = 5, // Waiting on an Object.wait() call
BREAKPOINTED = 6, // Suspended at breakpoint
SLEEPING = 7, // Thread.sleep()
TERMINATED = 8, // All done, but not reclaimed yet
SYSCALL = 9 // does not originate in the JVM, used when the current frame is
// known to be a syscall
};
enum class ExecutionMode : int {
UNKNOWN = 0,
JAVA = 1,
JVM = 2,
NATIVE = 3,
SAFEPOINT = 4,
SYSCALL = 5
};
static ExecutionMode convertJvmExecutionState(int state) {
switch (state) {
case 4:
case 5:
return ExecutionMode::NATIVE;
case 6:
case 7:
return ExecutionMode::JVM;
case 8:
case 9:
return ExecutionMode::JAVA;
case 10:
case 11:
return ExecutionMode::SAFEPOINT;
default:
return ExecutionMode::UNKNOWN;
}
}
#endif // JAVA_PROFILER_LIBRARY_THREAD_STATE_H