pub struct StackTrace {
pub pid: Pid,
pub thread_id: u64,
pub thread_name: Option<String>,
pub os_thread_id: Option<u64>,
pub active: bool,
pub owns_gil: bool,
pub frames: Vec<Frame>,
pub process_info: Option<Arc<ProcessInfo>>,
}Expand description
Call stack for a single python thread
Fields§
§pid: PidThe process id than generated this stack trace
thread_id: u64The python thread id for this stack trace
thread_name: Option<String>§os_thread_id: Option<u64>The OS thread id for this stack tracee
active: boolWhether or not the thread was active
owns_gil: boolWhether or not the thread held the GIL
frames: Vec<Frame>The frames
process_info: Option<Arc<ProcessInfo>>process commandline / parent process info
Implementations§
Source§impl StackTrace
impl StackTrace
Sourcepub fn status_str(&self) -> &str
pub fn status_str(&self) -> &str
Examples found in repository?
examples/dump_traces.rs (line 16)
6fn print_python_stacks(pid: remoteprocess::Pid) -> Result<(), anyhow::Error> {
7 // Create a new PythonSpy object with the default config options
8 let config = py_spy_for_datakit::Config::default();
9 let mut process = py_spy_for_datakit::PythonSpy::new(pid, &config)?;
10
11 // get stack traces for each thread in the process
12 let traces = process.get_stack_traces()?;
13
14 // Print out the python stack for each thread
15 for trace in traces {
16 println!("Thread {:#X} ({})", trace.thread_id, trace.status_str());
17 for frame in &trace.frames {
18 println!("\t {} ({}:{})", frame.name, frame.filename, frame.line);
19 }
20 }
21 Ok(())
22}pub fn format_threadid(&self) -> String
Trait Implementations§
Source§impl Clone for StackTrace
impl Clone for StackTrace
Source§fn clone(&self) -> StackTrace
fn clone(&self) -> StackTrace
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StackTrace
impl Debug for StackTrace
Auto Trait Implementations§
impl Freeze for StackTrace
impl RefUnwindSafe for StackTrace
impl Send for StackTrace
impl Sync for StackTrace
impl Unpin for StackTrace
impl UnwindSafe for StackTrace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more