Crashpad
Public Member Functions | List of all members
crashpad::ProcStatReader Class Reference

Reads the /proc/[pid]/stat file for a thread. More...

#include "util/linux/proc_stat_reader.h"

Public Member Functions

bool Initialize (PtraceConnection *connection, pid_t tid)
 Initializes the reader. More...
 
bool UserCPUTime (timeval *user_time) const
 Determines the time the thread has spent executing in user mode. More...
 
bool SystemCPUTime (timeval *system_time) const
 Determines the time the thread has spent executing in system mode. More...
 
bool StartTime (const timeval &boot_time, timeval *start_time) const
 Determines the target thread’s start time. More...
 

Detailed Description

Reads the /proc/[pid]/stat file for a thread.

Member Function Documentation

◆ Initialize()

bool crashpad::ProcStatReader::Initialize ( PtraceConnection connection,
pid_t  tid 
)

Initializes the reader.

This method must be successfully called before calling any other.

Parameters
[in]connectionA connection to the process to which the target thread belongs.
[in]tidThe thread ID to read the stat file for.

◆ StartTime()

bool crashpad::ProcStatReader::StartTime ( const timeval &  boot_time,
timeval *  start_time 
) const

Determines the target thread’s start time.

Parameters
[in]boot_timeThe kernel boot time.
[out]start_timeThe time that the thread started.
Returns
true on success, with start_time set. Otherwise, false with a message logged.

◆ SystemCPUTime()

bool crashpad::ProcStatReader::SystemCPUTime ( timeval *  system_time) const

Determines the time the thread has spent executing in system mode.

Parameters
[out]system_timeThe time spent executing in system mode.
Returns
true on success, with system_time set. Otherwise, false with a message logged.

◆ UserCPUTime()

bool crashpad::ProcStatReader::UserCPUTime ( timeval *  user_time) const

Determines the time the thread has spent executing in user mode.

Parameters
[out]user_timeThe time spent executing in user mode.
Returns
true on success, with user_time set. Otherwise, false with a message logged.

The documentation for this class was generated from the following files: