Skip to content

Commit

Permalink
fix: update flat profile (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityaranjan authored Nov 14, 2023
1 parent 4c6ceec commit cacbe86
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pipit/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,9 @@ def message_histogram(self, bins=20, **kwargs):

return np.histogram(sizes, bins=bins, **kwargs)

def flat_profile(self, metrics=None, groupby_column="Name", per_process=False):
def flat_profile(
self, metrics="time.exc", groupby_column="Name", per_process=False
):
"""
Arguments:
metrics - a string or list of strings containing the metrics to be aggregated
Expand All @@ -451,7 +453,15 @@ def flat_profile(self, metrics=None, groupby_column="Name", per_process=False):
for the grouped by columns.
"""

metrics = self.inc_metrics + self.exc_metrics if metrics is None else metrics
metrics = [metrics] if not isinstance(metrics, list) else metrics

# calculate inclusive time if needed
if "time.inc" in metrics:
self.calc_inc_metrics(["Timestamp (ns)"])

# calculate exclusive time if needed
if "time.exc" in metrics:
self.calc_exc_metrics(["Timestamp (ns)"])

# This first groups by both the process and the specified groupby
# column (like name). It then sums up the metrics for each combination
Expand Down

0 comments on commit cacbe86

Please sign in to comment.