2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef _SYSTEM_SYSTEM_PROFILER_DEFS_H
6 #define _SYSTEM_SYSTEM_PROFILER_DEFS_H
12 struct system_profiler_parameters
{
14 area_id buffer_area
; // area the events will be written to
15 uint32 flags
; // flags selecting the events to receive
18 size_t locking_lookup_size
; // size of the lookup table used for
19 // caching the locking primitive infos
22 bigtime_t interval
; // interval at which to take samples
23 uint32 stack_depth
; // maximum stack depth to sample
29 B_SYSTEM_PROFILER_TEAM_EVENTS
= 0x01,
30 B_SYSTEM_PROFILER_THREAD_EVENTS
= 0x02,
31 B_SYSTEM_PROFILER_IMAGE_EVENTS
= 0x04,
32 B_SYSTEM_PROFILER_SAMPLING_EVENTS
= 0x08,
33 B_SYSTEM_PROFILER_SCHEDULING_EVENTS
= 0x10,
34 B_SYSTEM_PROFILER_IO_SCHEDULING_EVENTS
= 0x20
40 // reserved for the user application
41 B_SYSTEM_PROFILER_USER_EVENT
= 0,
43 // ring buffer wrap-around marker
44 B_SYSTEM_PROFILER_BUFFER_END
,
47 B_SYSTEM_PROFILER_TEAM_ADDED
,
48 B_SYSTEM_PROFILER_TEAM_REMOVED
,
49 B_SYSTEM_PROFILER_TEAM_EXEC
,
52 B_SYSTEM_PROFILER_THREAD_ADDED
,
53 B_SYSTEM_PROFILER_THREAD_REMOVED
,
56 B_SYSTEM_PROFILER_IMAGE_ADDED
,
57 B_SYSTEM_PROFILER_IMAGE_REMOVED
,
60 B_SYSTEM_PROFILER_SAMPLES
,
63 B_SYSTEM_PROFILER_THREAD_SCHEDULED
,
64 B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE
,
65 B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE
,
66 B_SYSTEM_PROFILER_WAIT_OBJECT_INFO
,
69 B_SYSTEM_PROFILER_IO_SCHEDULER_ADDED
,
70 B_SYSTEM_PROFILER_IO_SCHEDULER_REMOVED
,
71 B_SYSTEM_PROFILER_IO_REQUEST_SCHEDULED
,
72 B_SYSTEM_PROFILER_IO_REQUEST_FINISHED
,
73 B_SYSTEM_PROFILER_IO_OPERATION_STARTED
,
74 B_SYSTEM_PROFILER_IO_OPERATION_FINISHED
78 struct system_profiler_buffer_header
{
84 struct system_profiler_event_header
{
86 uint8 cpu
; // only for B_SYSTEM_PROFILER_SAMPLES
87 uint16 size
; // size of the event structure excluding the header
91 // B_SYSTEM_PROFILER_TEAM_ADDED
92 struct system_profiler_team_added
{
98 // B_SYSTEM_PROFILER_TEAM_REMOVED
99 struct system_profiler_team_removed
{
103 // B_SYSTEM_PROFILER_TEAM_EXEC
104 struct system_profiler_team_exec
{
106 char thread_name
[B_OS_NAME_LENGTH
];
110 // B_SYSTEM_PROFILER_THREAD_ADDED
111 struct system_profiler_thread_added
{
114 char name
[B_OS_NAME_LENGTH
];
117 // B_SYSTEM_PROFILER_THREAD_REMOVED
118 struct system_profiler_thread_removed
{
123 // B_SYSTEM_PROFILER_IMAGE_ADDED
124 struct system_profiler_image_added
{
129 // B_SYSTEM_PROFILER_IMAGE_REMOVED
130 struct system_profiler_image_removed
{
135 // B_SYSTEM_PROFILER_SAMPLES
136 struct system_profiler_samples
{
141 // base structure for the following three
142 struct system_profiler_thread_scheduling_event
{
147 // B_SYSTEM_PROFILER_THREAD_SCHEDULED
148 struct system_profiler_thread_scheduled
{
151 thread_id previous_thread
;
152 uint16 previous_thread_state
;
153 uint16 previous_thread_wait_object_type
;
154 addr_t previous_thread_wait_object
;
157 // B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE
158 struct system_profiler_thread_enqueued_in_run_queue
{
164 // B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE
165 struct system_profiler_thread_removed_from_run_queue
{
170 // B_SYSTEM_PROFILER_WAIT_OBJECT_INFO
171 struct system_profiler_wait_object_info
{
174 addr_t referenced_object
;
178 // B_SYSTEM_PROFILER_IO_SCHEDULER_ADDED
179 struct system_profiler_io_scheduler_added
{
184 // B_SYSTEM_PROFILER_IO_SCHEDULER_REMOVED
185 struct system_profiler_io_scheduler_removed
{
189 // B_SYSTEM_PROFILER_IO_REQUEST_SCHEDULED
190 struct system_profiler_io_request_scheduled
{
202 // B_SYSTEM_PROFILER_IO_REQUEST_FINISHED
203 struct system_profiler_io_request_finished
{
211 // B_SYSTEM_PROFILER_IO_OPERATION_STARTED
212 struct system_profiler_io_operation_started
{
222 // B_SYSTEM_PROFILER_IO_OPERATION_FINISHED
223 struct system_profiler_io_operation_finished
{
233 #endif /* _SYSTEM_SYSTEM_PROFILER_DEFS_H */