@@ -25,6 +25,7 @@ def __init__(
2525 self .id = id
2626 self .parent_ids = parent_ids or []
2727 self .hsv = hsv
28+ self .has_subfuncs = False
2829
2930 def parent_classes (self ):
3031 return self .parent_classes
@@ -128,6 +129,21 @@ def cumtime_per_call(self):
128129 def indent (self ):
129130 return 16 * self .depth
130131
132+ def serialize (self ):
133+ return {
134+ "has_subfuncs" : self .has_subfuncs ,
135+ "id" : self .id ,
136+ "parent_ids" : self .parent_ids ,
137+ "is_project_func" : self .is_project_func (),
138+ "indent" : self .indent (),
139+ "func_std_string" : self .func_std_string (),
140+ "cumtime" : self .cumtime (),
141+ "cumtime_per_call" : self .cumtime_per_call (),
142+ "tottime" : self .tottime (),
143+ "tottime_per_call" : self .tottime_per_call (),
144+ "count" : self .count (),
145+ }
146+
131147
132148class ProfilingPanel (Panel ):
133149 """
@@ -145,7 +161,6 @@ def process_request(self, request):
145161
146162 def add_node (self , func_list , func , max_depth , cum_time ):
147163 func_list .append (func )
148- func .has_subfuncs = False
149164 if func .depth < max_depth :
150165 for subfunc in func .subfuncs ():
151166 # Always include the user's code
@@ -179,4 +194,4 @@ def generate_stats(self, request, response):
179194 dt_settings .get_config ()["PROFILER_MAX_DEPTH" ],
180195 cum_time_threshold ,
181196 )
182- self .record_stats ({"func_list" : func_list })
197+ self .record_stats ({"func_list" : [ func . serialize () for func in func_list ] })
0 commit comments