You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/per_frame_plotter.ipynb
+61-9Lines changed: 61 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,10 @@
6
6
"id": "1d9d9451-25fe-40d7-a67e-2fcaf6a9f54a",
7
7
"metadata": {},
8
8
"outputs": [],
9
-
"source": "# Install dependencies into the active kernel\n%pip install pandas matplotlib"
9
+
"source": [
10
+
"# Install dependencies into the active kernel\n",
11
+
"%pip install pandas matplotlib"
12
+
]
10
13
},
11
14
{
12
15
"cell_type": "code",
@@ -29,10 +32,8 @@
29
32
"outputs": [],
30
33
"source": [
31
34
"files = [\n",
32
-
" 'a_inline_perframe.csv',\n",
33
-
" 'a_pipeline_perframe.csv',\n",
34
-
" 'b_inline_perframe.csv',\n",
35
-
" 'b_pipeline_perframe.csv',\n",
35
+
" 'a_deep_analysis.json',\n",
36
+
" 'b_deep_analysis.json',\n",
36
37
"]"
37
38
]
38
39
},
@@ -42,23 +43,74 @@
42
43
"id": "a5f9ea81-7bd2-4f70-a0b8-45164afe8f76",
43
44
"metadata": {},
44
45
"outputs": [],
45
-
"source": "scores = {}\nfor file in files:\n file_scores = pd.read_csv(file)\n # Drop all-zero (empty) columns\n file_scores = file_scores.loc[:, (file_scores != 0).any(axis=0)]\n scores[file] = file_scores\nscores = pd.concat(scores)\n\n# Frame time = delta between consecutive sequence timestamps\nscores['Frame time (ms)'] = (scores['Sequence Time (ns)'].shift(-1) - scores['Sequence Time (ns)']) / 1_000_000\n# The final frame's delta is negative (the benchmark loops) and the first 3 frames\n# are huge outliers, so drop both.\nscores['Frame time (ms)'] = scores['Frame time (ms)'].mask(\n (scores['Frame time (ms)'] < 0) | (scores['Frame'] < 3)\n)\n\n# Reshape into row per input file + sequence time, column per metric\nscores = scores.reset_index().set_index(['level_0', 'Sequence Time (ns)']).drop(['level_1', 'Loop Index', 'Frame'], axis=1)\n\n# Convert the nanosecond timing columns to milliseconds\nfor col in ['Ray Tracing', 'Acceleration Structure Build', 'Rasterization', 'Compute', 'Driver']:\n scores[f'{col} (ms)'] = scores.pop(f'{col} (ns)') / 1_000_000\nscores"
"source": "# Reshape into row per sequence time + metric, column per input file\nnew_scores = scores.stack().unstack(0).reset_index()\nnew_scores.columns.name = None # drop the leftover index name so it isn't a \"level_0\" legend title\n\n# ns to s for the sequence time\nnew_scores['Sequence Time (s)'] = new_scores['Sequence Time (ns)'] / 1_000_000_000\nnew_scores = new_scores.drop('Sequence Time (ns)', axis=1)\nnew_scores"
78
+
"source": [
79
+
"# Reshape into row per sequence time + metric, column per input file\n",
0 commit comments