* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _SYSTEM_SYSTEM_PROFILER_DEFS_H
#define _SYSTEM_SYSTEM_PROFILER_DEFS_H
#include <image.h>
struct system_profiler_parameters {
area_id buffer_area;
uint32 flags;
size_t locking_lookup_size;
bigtime_t interval;
uint32 stack_depth;
bool profile_kernel;
};
enum {
B_SYSTEM_PROFILER_TEAM_EVENTS = 0x01,
B_SYSTEM_PROFILER_THREAD_EVENTS = 0x02,
B_SYSTEM_PROFILER_IMAGE_EVENTS = 0x04,
B_SYSTEM_PROFILER_SAMPLING_EVENTS = 0x08,
B_SYSTEM_PROFILER_SCHEDULING_EVENTS = 0x10,
B_SYSTEM_PROFILER_IO_SCHEDULING_EVENTS = 0x20
};
enum {
B_SYSTEM_PROFILER_USER_EVENT = 0,
B_SYSTEM_PROFILER_BUFFER_END,
B_SYSTEM_PROFILER_TEAM_ADDED,
B_SYSTEM_PROFILER_TEAM_REMOVED,
B_SYSTEM_PROFILER_TEAM_EXEC,
B_SYSTEM_PROFILER_THREAD_ADDED,
B_SYSTEM_PROFILER_THREAD_REMOVED,
B_SYSTEM_PROFILER_IMAGE_ADDED,
B_SYSTEM_PROFILER_IMAGE_REMOVED,
B_SYSTEM_PROFILER_SAMPLES,
B_SYSTEM_PROFILER_THREAD_SCHEDULED,
B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE,
B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE,
B_SYSTEM_PROFILER_WAIT_OBJECT_INFO,
B_SYSTEM_PROFILER_IO_SCHEDULER_ADDED,
B_SYSTEM_PROFILER_IO_SCHEDULER_REMOVED,
B_SYSTEM_PROFILER_IO_REQUEST_SCHEDULED,
B_SYSTEM_PROFILER_IO_REQUEST_FINISHED,
B_SYSTEM_PROFILER_IO_OPERATION_STARTED,
B_SYSTEM_PROFILER_IO_OPERATION_FINISHED
};
struct system_profiler_buffer_header {
size_t start;
size_t size;
};
struct system_profiler_event_header {
uint8 event;
uint8 cpu;
uint16 size;
};
struct system_profiler_team_added {
team_id team;
uint16 args_offset;
char name[1];
};
struct system_profiler_team_removed {
team_id team;
};
struct system_profiler_team_exec {
team_id team;
char thread_name[B_OS_NAME_LENGTH];
char args[1];
};
struct system_profiler_thread_added {
team_id team;
thread_id thread;
char name[B_OS_NAME_LENGTH];
bigtime_t cpu_time;
};
struct system_profiler_thread_removed {
team_id team;
thread_id thread;
bigtime_t cpu_time;
};
struct system_profiler_image_added {
team_id team;
image_info info;
};
struct system_profiler_image_removed {
team_id team;
image_id image;
};
struct system_profiler_samples {
thread_id thread;
addr_t samples[0];
};
struct system_profiler_thread_scheduling_event {
nanotime_t time;
thread_id thread;
};
struct system_profiler_thread_scheduled {
nanotime_t time;
thread_id thread;
thread_id previous_thread;
uint16 previous_thread_state;
uint16 previous_thread_wait_object_type;
addr_t previous_thread_wait_object;
};
struct system_profiler_thread_enqueued_in_run_queue {
nanotime_t time;
thread_id thread;
uint8 priority;
};
struct system_profiler_thread_removed_from_run_queue {
nanotime_t time;
thread_id thread;
};
struct system_profiler_wait_object_info {
uint32 type;
addr_t object;
addr_t referenced_object;
char name[1];
};
struct system_profiler_io_scheduler_added {
int32 scheduler;
char name[1];
};
struct system_profiler_io_scheduler_removed {
int32 scheduler;
};
struct system_profiler_io_request_scheduled {
nanotime_t time;
int32 scheduler;
team_id team;
thread_id thread;
void* request;
off_t offset;
size_t length;
bool write;
uint8 priority;
};
struct system_profiler_io_request_finished {
nanotime_t time;
int32 scheduler;
void* request;
status_t status;
size_t transferred;
};
struct system_profiler_io_operation_started {
nanotime_t time;
int32 scheduler;
void* request;
void* operation;
off_t offset;
size_t length;
bool write;
};
struct system_profiler_io_operation_finished {
nanotime_t time;
int32 scheduler;
void* request;
void* operation;
status_t status;
size_t transferred;
};
#endif