2019-10-19 18:55:56 +00:00
|
|
|
/*
|
|
|
|
* 4coder_profile_inspect.h - Built in self profiling UI.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
|
|
|
#if !defined(FCODER_PROFILE_INSPECT_H)
|
|
|
|
#define FCODER_PROFILE_INSPECT_H
|
|
|
|
|
2019-10-22 22:07:05 +00:00
|
|
|
struct Profile_Node_Ptr{
|
|
|
|
Profile_Node_Ptr *next;
|
|
|
|
struct Profile_Node *ptr;
|
|
|
|
};
|
|
|
|
|
2019-10-20 01:17:44 +00:00
|
|
|
struct Profile_Slot{
|
|
|
|
Profile_Slot *next;
|
|
|
|
String_Const_u8 location;
|
2019-10-19 18:55:56 +00:00
|
|
|
String_Const_u8 name;
|
|
|
|
|
|
|
|
u64 total_time;
|
2019-10-22 22:07:05 +00:00
|
|
|
b32 corrupted_time;
|
|
|
|
|
2019-10-20 01:17:44 +00:00
|
|
|
i32 hit_count;
|
2019-10-22 22:07:05 +00:00
|
|
|
Profile_Node_Ptr *first_hit;
|
|
|
|
Profile_Node_Ptr *last_hit;
|
2019-10-19 18:55:56 +00:00
|
|
|
};
|
|
|
|
|
2019-10-20 01:17:44 +00:00
|
|
|
struct Profile_Node{
|
|
|
|
Profile_Node *next;
|
2019-10-22 22:07:05 +00:00
|
|
|
Profile_Node *parent;
|
2019-10-20 01:17:44 +00:00
|
|
|
Profile_Slot *slot;
|
2019-10-22 22:07:05 +00:00
|
|
|
struct Profile_Inspection_Thread *thread;
|
2019-10-20 01:17:44 +00:00
|
|
|
Range_u64 time;
|
|
|
|
Profile_ID id;
|
2019-10-23 05:04:58 +00:00
|
|
|
u64 unique_counter;
|
2019-10-19 18:55:56 +00:00
|
|
|
|
2019-10-20 01:17:44 +00:00
|
|
|
Profile_Node *first_child;
|
|
|
|
Profile_Node *last_child;
|
|
|
|
i32 child_count;
|
2019-10-19 18:55:56 +00:00
|
|
|
|
2019-10-20 01:17:44 +00:00
|
|
|
b32 closed;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Profile_Inspection_Thread{
|
|
|
|
i32 thread_id;
|
2019-10-22 22:07:05 +00:00
|
|
|
String_Const_u8 name;
|
2019-10-20 01:17:44 +00:00
|
|
|
Profile_Node root;
|
2019-10-22 22:07:05 +00:00
|
|
|
u64 active_time;
|
2019-10-20 01:17:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Profile_Error{
|
|
|
|
Profile_Error *next;
|
|
|
|
String_Const_u8 message;
|
|
|
|
String_Const_u8 location;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef i32 Profile_Inspection_Tab;
|
|
|
|
enum{
|
|
|
|
ProfileInspectTab_None,
|
|
|
|
ProfileInspectTab_Threads,
|
2019-10-22 22:07:05 +00:00
|
|
|
ProfileInspectTab_Blocks,
|
|
|
|
ProfileInspectTab_Errors,
|
2019-11-22 05:37:11 +00:00
|
|
|
ProfileInspectTab_Memory,
|
2019-10-22 22:07:05 +00:00
|
|
|
ProfileInspectTab_Selection,
|
2019-10-19 18:55:56 +00:00
|
|
|
};
|
|
|
|
|
2019-10-19 19:16:31 +00:00
|
|
|
struct Profile_Inspection{
|
2019-10-20 01:17:44 +00:00
|
|
|
Profile_Slot *first_slot;
|
|
|
|
Profile_Slot *last_slot;
|
|
|
|
Profile_Error *first_error;
|
|
|
|
Profile_Error *last_error;
|
|
|
|
Profile_Inspection_Thread *threads;
|
|
|
|
i32 slot_count;
|
2019-10-19 19:16:31 +00:00
|
|
|
i32 thread_count;
|
2019-10-20 01:17:44 +00:00
|
|
|
i32 error_count;
|
|
|
|
|
|
|
|
Profile_Inspection_Tab tab_id;
|
2019-10-22 22:07:05 +00:00
|
|
|
Profile_Inspection_Thread *selected_thread;
|
|
|
|
Profile_Slot *selected_slot;
|
|
|
|
Profile_Node *selected_node;
|
2019-10-20 01:17:44 +00:00
|
|
|
|
2019-10-22 22:07:05 +00:00
|
|
|
Profile_Inspection_Tab tab_id_hovered;
|
2019-10-22 07:15:49 +00:00
|
|
|
String_Const_u8 full_name_hovered;
|
2019-10-23 05:04:58 +00:00
|
|
|
u64 unique_counter_hovered;
|
2019-10-20 01:17:44 +00:00
|
|
|
String_Const_u8 location_jump_hovered;
|
2019-10-22 22:07:05 +00:00
|
|
|
Profile_Inspection_Thread *hover_thread;
|
|
|
|
Profile_Slot *hover_slot;
|
|
|
|
Profile_Node *hover_node;
|
2019-10-19 19:16:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
global Profile_Inspection global_profile_inspection = {};
|
|
|
|
|
2019-11-22 05:37:11 +00:00
|
|
|
struct Memory_Bucket{
|
|
|
|
Memory_Bucket *next;
|
|
|
|
Memory_Annotation annotation;
|
|
|
|
String_Const_u8 location;
|
2019-12-18 03:38:08 +00:00
|
|
|
u64 total_memory;
|
2019-11-22 05:37:11 +00:00
|
|
|
};
|
|
|
|
|
2019-10-19 18:55:56 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|