aboutsummaryrefslogtreecommitdiffstats
path: root/build/4coder_byp/custom/4coder_profile_inspect.h
blob: 14b72fa6e795fc662b06fec6584cf2754635a0b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * 4coder_profile_inspect.h - Built in self profiling UI.
 */

// TOP

#if !defined(FCODER_PROFILE_INSPECT_H)
#define FCODER_PROFILE_INSPECT_H

struct Profile_Node_Ptr{
  Profile_Node_Ptr *next;
  struct Profile_Node *ptr;
};

struct Profile_Slot{
  Profile_Slot *next;
  String_Const_u8 location;
  String_Const_u8 name;

  u64 total_time;
  b32 corrupted_time;

  i32 hit_count;
  Profile_Node_Ptr *first_hit;
  Profile_Node_Ptr *last_hit;
};

struct Profile_Node{
  Profile_Node *next;
  Profile_Node *parent;
  Profile_Slot *slot;
  struct Profile_Inspection_Thread *thread;
  Range_u64 time;
  Profile_ID id;
  u64 unique_counter;

  Profile_Node *first_child;
  Profile_Node *last_child;
  i32 child_count;

  b32 closed;
};

struct Profile_Inspection_Thread{
  i32 thread_id;
  String_Const_u8 name;
  Profile_Node root;
  u64 active_time;
};

struct Profile_Error{
  Profile_Error *next;
  String_Const_u8 message;
  String_Const_u8 location;
};

typedef i32 Profile_Inspection_Tab;
enum{
  ProfileInspectTab_None,
  ProfileInspectTab_Threads,
  ProfileInspectTab_Blocks,
  ProfileInspectTab_Errors,
  ProfileInspectTab_Memory,
  ProfileInspectTab_Selection,
};

struct Profile_Inspection{
  Profile_Slot *first_slot;
  Profile_Slot *last_slot;
  Profile_Error *first_error;
  Profile_Error *last_error;
  Profile_Inspection_Thread *threads;
  i32 slot_count;
  i32 thread_count;
  i32 error_count;

  Profile_Inspection_Tab tab_id;
  Profile_Inspection_Thread *selected_thread;
  Profile_Slot *selected_slot;
  Profile_Node *selected_node;

  Profile_Inspection_Tab tab_id_hovered;
  String_Const_u8 full_name_hovered;
  u64 unique_counter_hovered;
  String_Const_u8 location_jump_hovered;
  Profile_Inspection_Thread *hover_thread;
  Profile_Slot *hover_slot;
  Profile_Node *hover_node;
};

global Profile_Inspection global_profile_inspection = {};

struct Memory_Bucket{
  Memory_Bucket *next;
  Memory_Annotation annotation;
  String_Const_u8 location;
  u64 total_memory;
};

#endif

// TOP