Make UEFI boot-platform build again
[haiku.git] / headers / private / system / system_profiler_defs.h
blob18218393e1d6aff050bbf51c693329f0b4449f05
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _SYSTEM_SYSTEM_PROFILER_DEFS_H
6 #define _SYSTEM_SYSTEM_PROFILER_DEFS_H
9 #include <image.h>
12 struct system_profiler_parameters {
13 // general
14 area_id buffer_area; // area the events will be written to
15 uint32 flags; // flags selecting the events to receive
17 // scheduling
18 size_t locking_lookup_size; // size of the lookup table used for
19 // caching the locking primitive infos
21 // sampling
22 bigtime_t interval; // interval at which to take samples
23 uint32 stack_depth; // maximum stack depth to sample
27 // event flags
28 enum {
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
38 // events
39 enum {
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,
46 // team
47 B_SYSTEM_PROFILER_TEAM_ADDED,
48 B_SYSTEM_PROFILER_TEAM_REMOVED,
49 B_SYSTEM_PROFILER_TEAM_EXEC,
51 // thread
52 B_SYSTEM_PROFILER_THREAD_ADDED,
53 B_SYSTEM_PROFILER_THREAD_REMOVED,
55 // image
56 B_SYSTEM_PROFILER_IMAGE_ADDED,
57 B_SYSTEM_PROFILER_IMAGE_REMOVED,
59 // profiling samples
60 B_SYSTEM_PROFILER_SAMPLES,
62 // scheduling
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,
68 // I/O scheduling
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 {
79 size_t start;
80 size_t size;
84 struct system_profiler_event_header {
85 uint8 event;
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 {
93 team_id team;
94 uint16 args_offset;
95 char name[1];
98 // B_SYSTEM_PROFILER_TEAM_REMOVED
99 struct system_profiler_team_removed {
100 team_id team;
103 // B_SYSTEM_PROFILER_TEAM_EXEC
104 struct system_profiler_team_exec {
105 team_id team;
106 char thread_name[B_OS_NAME_LENGTH];
107 char args[1];
110 // B_SYSTEM_PROFILER_THREAD_ADDED
111 struct system_profiler_thread_added {
112 team_id team;
113 thread_id thread;
114 char name[B_OS_NAME_LENGTH];
117 // B_SYSTEM_PROFILER_THREAD_REMOVED
118 struct system_profiler_thread_removed {
119 team_id team;
120 thread_id thread;
123 // B_SYSTEM_PROFILER_IMAGE_ADDED
124 struct system_profiler_image_added {
125 team_id team;
126 image_info info;
129 // B_SYSTEM_PROFILER_IMAGE_REMOVED
130 struct system_profiler_image_removed {
131 team_id team;
132 image_id image;
135 // B_SYSTEM_PROFILER_SAMPLES
136 struct system_profiler_samples {
137 thread_id thread;
138 addr_t samples[0];
141 // base structure for the following three
142 struct system_profiler_thread_scheduling_event {
143 nanotime_t time;
144 thread_id thread;
147 // B_SYSTEM_PROFILER_THREAD_SCHEDULED
148 struct system_profiler_thread_scheduled {
149 nanotime_t time;
150 thread_id thread;
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 {
159 nanotime_t time;
160 thread_id thread;
161 uint8 priority;
164 // B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE
165 struct system_profiler_thread_removed_from_run_queue {
166 nanotime_t time;
167 thread_id thread;
170 // B_SYSTEM_PROFILER_WAIT_OBJECT_INFO
171 struct system_profiler_wait_object_info {
172 uint32 type;
173 addr_t object;
174 addr_t referenced_object;
175 char name[1];
178 // B_SYSTEM_PROFILER_IO_SCHEDULER_ADDED
179 struct system_profiler_io_scheduler_added {
180 int32 scheduler;
181 char name[1];
184 // B_SYSTEM_PROFILER_IO_SCHEDULER_REMOVED
185 struct system_profiler_io_scheduler_removed {
186 int32 scheduler;
189 // B_SYSTEM_PROFILER_IO_REQUEST_SCHEDULED
190 struct system_profiler_io_request_scheduled {
191 nanotime_t time;
192 int32 scheduler;
193 team_id team;
194 thread_id thread;
195 void* request;
196 off_t offset;
197 size_t length;
198 bool write;
199 uint8 priority;
202 // B_SYSTEM_PROFILER_IO_REQUEST_FINISHED
203 struct system_profiler_io_request_finished {
204 nanotime_t time;
205 int32 scheduler;
206 void* request;
207 status_t status;
208 size_t transferred;
211 // B_SYSTEM_PROFILER_IO_OPERATION_STARTED
212 struct system_profiler_io_operation_started {
213 nanotime_t time;
214 int32 scheduler;
215 void* request;
216 void* operation;
217 off_t offset;
218 size_t length;
219 bool write;
222 // B_SYSTEM_PROFILER_IO_OPERATION_FINISHED
223 struct system_profiler_io_operation_finished {
224 nanotime_t time;
225 int32 scheduler;
226 void* request;
227 void* operation;
228 status_t status;
229 size_t transferred;
233 #endif /* _SYSTEM_SYSTEM_PROFILER_DEFS_H */