32#include <system_error>
59 vm_size_t
size){
nullptr};
66 mach_msg_type_number_t thread_count,
73 [[nodiscard]] std::error_code
release();
88 int64_t
seconds, int64_t microseconds,
97 std::vector<macOS_thread_sample> samples,
103 std::error_code collection_error,
Own native thread ports and the Mach allocated thread array.
Definition: system_info_macos.h:63
mach_msg_type_number_t m_thread_count
Definition: system_info_macos.h:77
macOS_thread_resources & operator=(const macOS_thread_resources &)=delete
~macOS_thread_resources()
Release owned Mach resources if the collector has not released them.
Definition: system_info_macos.cc:171
thread_act_array_t m_threads
Definition: system_info_macos.h:76
bool m_released
Definition: system_info_macos.h:79
std::error_code release()
Release every owned right and the thread array exactly once.
Definition: system_info_macos.cc:183
macOS_thread_resources(thread_act_array_t threads, mach_msg_type_number_t thread_count, macOS_thread_deallocator deallocator)
Take ownership of the thread ports and array returned by task_threads().
Definition: system_info_macos.cc:163
macOS_thread_resources(const macOS_thread_resources &)=delete
macOS_thread_deallocator m_deallocator
Definition: system_info_macos.h:78
std::error_code m_release_error
Definition: system_info_macos.h:80
std::chrono::seconds seconds
Definition: authorize_manager.cc:71
std::chrono::milliseconds milliseconds
Definition: authorize_manager.cc:70
Definition: system_info_linux.cc:46
Thread_state macos_thread_state(int run_state)
Map a native Mach thread state to the portable thread state.
Definition: system_info_macos.cc:234
macOS_thread_sample_state
Result of collecting one native macOS thread.
Definition: system_info_macos.h:40
std::error_code map_macos_thread_samples(std::vector< macOS_thread_sample > samples, std::error_code disappearance_error, Thread_inventory &inventory, Thread_cpu_snapshot &cpu)
Build matching thread inventory and CPU snapshots from native samples.
Definition: system_info_macos.cc:306
bool macos_time_value_to_milliseconds(int64_t seconds, int64_t microseconds, std::chrono::milliseconds &milliseconds)
Convert a Mach time_value_t value to whole milliseconds.
Definition: system_info_macos.cc:260
void complete_macos_thread_collection(macOS_thread_resources &resources, std::error_code collection_error, Thread_inventory inventory, Thread_cpu_snapshot cpu, Process_threads_snapshot &result)
Release native thread resources before publishing the collected snapshots.
Definition: system_info_macos.cc:368
std::string copy_bounded_macos_thread_name(const char *name, size_t size)
Copy a thread name from a fixed size native buffer.
Definition: system_info_macos.cc:290
Thread_state
Portable execution state of a process thread.
Definition: system_info.h:370
size_t size(const char *const c)
Definition: base64.h:46
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
Process thread capabilities collected at one collection point.
Definition: system_info.h:450
Portable thread CPU times collected at one collection point.
Definition: system_info.h:407
Process threads visible at one collection point.
Definition: system_info.h:387
Callbacks used to release native macOS thread resources.
Definition: system_info_macos.h:55
kern_return_t(* deallocate_port)(void *context, mach_port_t port)
Definition: system_info_macos.h:57
kern_return_t(* deallocate_memory)(void *context, vm_address_t address, vm_size_t size)
Definition: system_info_macos.h:58
void * context
Definition: system_info_macos.h:56
Native macOS values collected for one thread.
Definition: system_info_macos.h:43
int run_state
Definition: system_info_macos.h:47
int64_t user_seconds
Definition: system_info_macos.h:48
std::string name
Definition: system_info_macos.h:46
macOS_thread_sample_state sample_state
Definition: system_info_macos.h:44
int64_t user_microseconds
Definition: system_info_macos.h:49
uint64_t tid
Definition: system_info_macos.h:45
int64_t system_microseconds
Definition: system_info_macos.h:51
int64_t system_seconds
Definition: system_info_macos.h:50