2009-04-12 02:20:51 +04:00
|
|
|
/*
|
|
|
|
* 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>
|
|
|
|
|
|
|
|
|
2009-04-18 21:35:28 +04:00
|
|
|
struct system_profiler_parameters {
|
|
|
|
// general
|
|
|
|
area_id buffer_area; // area the events will be written to
|
|
|
|
uint32 flags; // flags selecting the events to receive
|
|
|
|
|
|
|
|
// scheduling
|
|
|
|
size_t locking_lookup_size; // size of the lookup table used for
|
|
|
|
// caching the locking primitive infos
|
|
|
|
|
|
|
|
// sampling
|
|
|
|
bigtime_t interval; // interval at which to take samples
|
|
|
|
uint32 stack_depth; // maximum stack depth to sample
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// event flags
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-04-12 02:20:51 +04:00
|
|
|
// events
|
|
|
|
enum {
|
2009-04-18 21:35:28 +04:00
|
|
|
// reserved for the user application
|
|
|
|
B_SYSTEM_PROFILER_USER_EVENT = 0,
|
|
|
|
|
|
|
|
// ring buffer wrap-around marker
|
|
|
|
B_SYSTEM_PROFILER_BUFFER_END,
|
|
|
|
|
|
|
|
// team
|
|
|
|
B_SYSTEM_PROFILER_TEAM_ADDED,
|
2009-04-12 02:20:51 +04:00
|
|
|
B_SYSTEM_PROFILER_TEAM_REMOVED,
|
|
|
|
B_SYSTEM_PROFILER_TEAM_EXEC,
|
2009-04-18 21:35:28 +04:00
|
|
|
|
|
|
|
// thread
|
2009-04-12 02:20:51 +04:00
|
|
|
B_SYSTEM_PROFILER_THREAD_ADDED,
|
|
|
|
B_SYSTEM_PROFILER_THREAD_REMOVED,
|
2009-04-18 21:35:28 +04:00
|
|
|
|
|
|
|
// image
|
2009-04-12 02:20:51 +04:00
|
|
|
B_SYSTEM_PROFILER_IMAGE_ADDED,
|
|
|
|
B_SYSTEM_PROFILER_IMAGE_REMOVED,
|
2009-04-18 21:35:28 +04:00
|
|
|
|
|
|
|
// profiling samples
|
2009-04-12 02:20:51 +04:00
|
|
|
B_SYSTEM_PROFILER_SAMPLES,
|
2009-04-18 21:35:28 +04:00
|
|
|
|
|
|
|
// scheduling
|
|
|
|
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
|
2009-04-12 02:20:51 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct system_profiler_buffer_header {
|
|
|
|
size_t start;
|
|
|
|
size_t size;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct system_profiler_event_header {
|
|
|
|
uint8 event;
|
|
|
|
uint8 cpu; // only for B_SYSTEM_PROFILER_SAMPLES
|
|
|
|
uint16 size; // size of the event structure excluding the header
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_TEAM_ADDED
|
|
|
|
struct system_profiler_team_added {
|
|
|
|
team_id team;
|
2009-04-16 14:02:33 +04:00
|
|
|
char args[1];
|
2009-04-12 02:20:51 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_TEAM_REMOVED
|
|
|
|
struct system_profiler_team_removed {
|
|
|
|
team_id team;
|
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_TEAM_EXEC
|
|
|
|
struct system_profiler_team_exec {
|
|
|
|
team_id team;
|
2009-04-16 14:02:33 +04:00
|
|
|
char thread_name[B_OS_NAME_LENGTH];
|
|
|
|
char args[1];
|
2009-04-12 02:20:51 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_THREAD_ADDED
|
|
|
|
struct system_profiler_thread_added {
|
|
|
|
team_id team;
|
|
|
|
thread_id thread;
|
2009-04-16 14:02:33 +04:00
|
|
|
char name[B_OS_NAME_LENGTH];
|
2009-04-12 02:20:51 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_THREAD_REMOVED
|
|
|
|
struct system_profiler_thread_removed {
|
|
|
|
team_id team;
|
|
|
|
thread_id thread;
|
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_IMAGE_ADDED
|
|
|
|
struct system_profiler_image_added {
|
|
|
|
team_id team;
|
|
|
|
image_info info;
|
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_IMAGE_REMOVED
|
|
|
|
struct system_profiler_image_removed {
|
|
|
|
team_id team;
|
|
|
|
image_id image;
|
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_SAMPLES
|
|
|
|
struct system_profiler_samples {
|
|
|
|
thread_id thread;
|
|
|
|
addr_t samples[0];
|
|
|
|
};
|
|
|
|
|
2009-04-18 21:35:28 +04:00
|
|
|
// B_SYSTEM_PROFILER_THREAD_SCHEDULED,
|
|
|
|
struct system_profiler_thread_scheduled {
|
|
|
|
bigtime_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;
|
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_THREAD_ENQUEUED_IN_RUN_QUEUE,
|
|
|
|
struct system_profiler_thread_enqueued_in_run_queue {
|
|
|
|
bigtime_t time;
|
|
|
|
thread_id thread;
|
|
|
|
uint8 priority;
|
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_THREAD_REMOVED_FROM_RUN_QUEUE,
|
|
|
|
struct system_profiler_thread_removed_from_run_queue {
|
|
|
|
bigtime_t time;
|
|
|
|
thread_id thread;
|
|
|
|
};
|
|
|
|
|
|
|
|
// B_SYSTEM_PROFILER_WAIT_OBJECT_INFO
|
|
|
|
struct system_profiler_wait_object_info {
|
|
|
|
uint32 type;
|
|
|
|
addr_t object;
|
|
|
|
addr_t referenced_object;
|
|
|
|
char name[1];
|
|
|
|
};
|
|
|
|
|
2009-04-12 02:20:51 +04:00
|
|
|
|
|
|
|
#endif /* _SYSTEM_SYSTEM_PROFILER_DEFS_H */
|