From bdb296ab179063d111b3c85ccd56ff650fb0c33e Mon Sep 17 00:00:00 2001 From: coleramos425 Date: Mon, 8 May 2023 11:25:05 -0500 Subject: [PATCH] Update mean timestamp calculation Signed-off-by: coleramos425 [ROCm/rocprofiler-compute commit: 298271e1d083c75c0da11dea120a0f31fac553eb] --- .../rocprofiler-compute/src/utils/perfagg.py | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/projects/rocprofiler-compute/src/utils/perfagg.py b/projects/rocprofiler-compute/src/utils/perfagg.py index 6dd5eb4f47..3c09a648ba 100755 --- a/projects/rocprofiler-compute/src/utils/perfagg.py +++ b/projects/rocprofiler-compute/src/utils/perfagg.py @@ -112,7 +112,7 @@ def join_prof(workload_dir, out): #   about df = df[[k for k in df.keys() if not any( check in k for check in [ - 'stop', 'start', 'DispatchNs', 'CompleteNs'])]] + 'DispatchNs', 'CompleteNs'])]] #   C) sanity check the name and key namekeys = [k for k in df.keys() if 'KernelName' in k] assert len(namekeys) @@ -120,20 +120,21 @@ def join_prof(workload_dir, out): assert (df[namekeys[0]] == df[k]).all() df = df.drop(columns=namekeys[1:]) # now take the median of the durations - dkeys = [k for k in df.keys() if 'duration' in k] - duration = df[dkeys].median(axis=1) - # compute min and max, just for sanity - min_duration = df[dkeys].min(axis=1) - max_duration = df[dkeys].max(axis=1) - std_duration = df[dkeys].std(axis=1) - mean_duration = df[dkeys].mean(axis=1) + bkeys = [] + ekeys = [] + for k in df.keys(): + if 'Begin' in k: + bkeys.append(k) + if 'End' in k: + ekeys.append(k) + # compute mean begin and end timestamps + endNs = df[ekeys].mean(axis=1) + beginNs = df[bkeys].mean(axis=1) # and replace - df = df.drop(columns=dkeys) - df['duration'] = duration - df['duration[max]'] = max_duration - df['duration[min]'] = min_duration - df['duration[std]'] = std_duration - df['duration[mean]'] = mean_duration + df= df.drop(columns=bkeys) + df= df.drop(columns=ekeys) + df['BeginNs'] = beginNs + df['EndNs'] = endNs # finally, join the drop key df = df.drop(columns=['key']) # and save to file