@@ -452,7 +452,8 @@ def process_frames(self, frames, thread_id, weight=1):
452452 next_lineno = extract_lineno (next_frame [1 ])
453453 self ._record_call_relationship (
454454 (filename , lineno , funcname ),
455- (next_frame [0 ], next_lineno , next_frame [2 ])
455+ (next_frame [0 ], next_lineno , next_frame [2 ]),
456+ weight = weight ,
456457 )
457458
458459 def _is_valid_frame (self , filename , lineno ):
@@ -561,7 +562,7 @@ def _get_bytecode_data_for_line(self, filename, lineno):
561562 result .sort (key = lambda x : (- x ['samples' ], x ['opcode' ]))
562563 return result
563564
564- def _record_call_relationship (self , callee_frame , caller_frame ):
565+ def _record_call_relationship (self , callee_frame , caller_frame , weight = 1 ):
565566 """Record caller/callee relationship between adjacent frames."""
566567 callee_filename , callee_lineno , callee_funcname = callee_frame
567568 caller_filename , caller_lineno , caller_funcname = caller_frame
@@ -587,7 +588,7 @@ def _record_call_relationship(self, callee_frame, caller_frame):
587588
588589 # Count this call edge for path analysis
589590 edge_key = (caller_key , callee_key )
590- self .edge_samples [edge_key ] += 1
591+ self .edge_samples [edge_key ] += weight
591592
592593 def export (self , output_path ):
593594 """Export heatmap data as HTML files in a directory.
0 commit comments