forked from windelbouwman/lognplot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallstackbar.py
More file actions
34 lines (25 loc) · 742 Bytes
/
Copy pathcallstackbar.py
File metadata and controls
34 lines (25 loc) · 742 Bytes
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
""" Example call stack plot like a flame graph.
Idea from: https://www.speedscope.app/
"""
from .tsdb.btree import Btree
class CallStackBar:
def __init__(self):
self._tree = BTree()
self._levels = []
def enter_function(self, t, func):
self._levels.append(func)
event = (t, "O", func)
self.append_event(event)
def leave_function(self, t, func):
top = self._levels.pop()
assert top == func
event = (t, "C", func)
self.append_event(event)
def append_event(self, event):
# self._tree.append(event)
pass
class FunctionCall:
def __init__(self):
self.t_enter = None
self.t_leave = None
self.child_calls = []