equal
deleted
inserted
replaced
21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
|
26 #include "classfile/javaClasses.hpp" |
26 #include "jfr/recorder/checkpoint/types/jfrThreadState.hpp" |
27 #include "jfr/recorder/checkpoint/types/jfrThreadState.hpp" |
27 #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" |
28 #include "jfr/recorder/checkpoint/jfrCheckpointWriter.hpp" |
|
29 #include "jfr/support/jfrThreadLocal.hpp" |
28 #include "jvmtifiles/jvmti.h" |
30 #include "jvmtifiles/jvmti.h" |
|
31 #include "runtime/osThread.hpp" |
|
32 #include "runtime/thread.hpp" |
29 |
33 |
30 struct jvmti_thread_state { |
34 struct jvmti_thread_state { |
31 u8 id; |
35 u8 id; |
32 const char* description; |
36 const char* description; |
33 }; |
37 }; |
78 writer.write_key(states[i].id); |
82 writer.write_key(states[i].id); |
79 writer.write(states[i].description); |
83 writer.write(states[i].description); |
80 } |
84 } |
81 } |
85 } |
82 |
86 |
|
87 const char* JfrThreadName::name(const Thread* t) { |
|
88 assert(t != NULL, "invariant"); |
|
89 if (!t->is_Java_thread()) { |
|
90 return t->name(); |
|
91 } |
|
92 assert(t->is_Java_thread(), "invariant"); |
|
93 const JavaThread* const jt = (JavaThread*)t; |
|
94 return jt->get_thread_name_string(); |
|
95 } |
|
96 |
|
97 traceid JfrThreadId::id(const Thread* t) { |
|
98 assert(t != NULL, "invariant"); |
|
99 if (!t->is_Java_thread()) { |
|
100 return os_id(t); |
|
101 } |
|
102 const JavaThread* const jt = (JavaThread*)t; |
|
103 const oop thread_obj = jt->threadObj(); |
|
104 return thread_obj != NULL ? java_lang_Thread::thread_id(thread_obj) : 0; |
|
105 } |
|
106 |
|
107 traceid JfrThreadId::os_id(const Thread* t) { |
|
108 assert(t != NULL, "invariant"); |
|
109 const OSThread* const os_thread = t->osthread(); |
|
110 return os_thread != NULL ? os_thread->thread_id() : 0; |
|
111 } |
|
112 |
|
113 traceid JfrThreadId::jfr_id(const Thread* t) { |
|
114 assert(t != NULL, "invariant"); |
|
115 return t->jfr_thread_local()->thread_id(); |
|
116 } |