1313#include < echion/errors.h>
1414#include < echion/timing.h>
1515
16+ #include < Python.h>
17+
1618// Forward declaration
1719class Frame ;
1820
@@ -29,27 +31,52 @@ class RendererInterface
2931 virtual void close () = 0;
3032 virtual void header () = 0;
3133 virtual void metadata (const std::string& label, const std::string& value) = 0;
34+
3235 // If a renderer has its own caching mechanism for frames, this can be used
3336 // to store frame information.
3437 virtual void
3538 frame (uintptr_t key, uintptr_t filename, uintptr_t name, int line, int line_end, int column, int column_end) = 0 ;
36- // Refers to the frame stored using above function
39+
40+ // Refers to the frame stored using the renderer's frame function
3741 virtual void frame_ref (uintptr_t key) = 0;
3842 virtual void frame_kernel (const std::string& scope) = 0;
39- // Simlar to frame/frame_ref functions, helpers for string tables
43+
44+ // If a renderer has its own caching mechanism for strings, this can be used
45+ // to store string information.
4046 virtual void string (uintptr_t key, const std::string& value) = 0;
47+
48+ // Refers to the string stored using the renderer's string function
4149 virtual void string_ref (uintptr_t key) = 0;
4250
51+ // Called to render a message from the profiler.
4352 virtual void render_message (std::string_view msg) = 0;
53+
54+ // Called once for each Thread being sampled.
55+ // Pushes the Thread state but not its current Stack(s).
4456 virtual void render_thread_begin (PyThreadState* tstate,
4557 std::string_view name,
4658 microsecond_t cpu_time,
4759 uintptr_t thread_id,
4860 unsigned long native_id) = 0;
61+
62+ // Called once for each Task being sampled on the Thread.
63+ // Called after render_thread_begin and before render_stack_begin.
4964 virtual void render_task_begin (std::string task_name, bool on_cpu) = 0;
65+
66+ // Called once for each Stack being sampled on the Task.
67+ // Called after render_task_begin and before render_frame.
5068 virtual void render_stack_begin (long long pid, long long iid, const std::string& thread_name) = 0;
69+
70+ // Called once for each Frame being sampled on the Stack.
71+ // Called after render_stack_begin and before render_stack_end.
5172 virtual void render_frame (Frame& frame) = 0;
73+
74+ // Called once for each CPU time being sampled on the Thread.
75+ // Called after render_frame and before render_stack_end.
5276 virtual void render_cpu_time (uint64_t cpu_time) = 0;
77+
78+ // Called once for each Stack being sampled on the Thread.
79+ // Called after render_stack_begin, all render_frame calls and all render_cpu_time calls.
5380 virtual void render_stack_end (MetricType metric_type, uint64_t delta) = 0;
5481
5582 // The validity of the interface is a two-step process
0 commit comments