Module: Datadog::Profiling::Ext::NativePthread
- Extended by:
- FFI::Library
- Defined in:
- lib/ddtrace/profiling/ext/cthread.rb
Overview
Enables interfacing with pthread via FFI
Class Method Summary collapse
- .get_clock_id(thread, pthread_id) ⇒ Object
-
.get_pthread_thread_id(thread) ⇒ Object
NOTE: Only returns thread ID for thread that evaluates this call.
Class Method Details
.get_clock_id(thread, pthread_id) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/ddtrace/profiling/ext/cthread.rb', line 28 def self.get_clock_id(thread, pthread_id) return unless ::Thread.current == thread && pthread_id clock = CClockId.new clock[:value] = 0 pthread_getcpuclockid(pthread_id, clock).zero? ? clock[:value] : nil end |
.get_pthread_thread_id(thread) ⇒ Object
NOTE: Only returns thread ID for thread that evaluates this call.
a.k.a. evaluating `get_pthread_thread_id(thread_a)` from within
`thread_b` will return `thread_b`'s thread ID, not `thread_a`'s.
22 23 24 25 26 |
# File 'lib/ddtrace/profiling/ext/cthread.rb', line 22 def self.get_pthread_thread_id(thread) return unless ::Thread.current == thread pthread_self end |