Cleanup and format notebook
This commit is contained in:
parent
383b519cdc
commit
83925b389e
1 changed files with 48 additions and 20 deletions
|
@ -11,7 +11,7 @@
|
||||||
"# Get trace data using the provided launch file:\n",
|
"# Get trace data using the provided launch file:\n",
|
||||||
"# $ ros2 launch tracetools_analysis pingpong.launch.py\n",
|
"# $ ros2 launch tracetools_analysis pingpong.launch.py\n",
|
||||||
"# (wait a few seconds, then kill with Ctrl+C)\n",
|
"# (wait a few seconds, then kill with Ctrl+C)\n",
|
||||||
"#\n",
|
"# AND\n",
|
||||||
"# Convert trace data:\n",
|
"# Convert trace data:\n",
|
||||||
"# $ ros2 run tracetools_analysis convert ~/.ros/tracing/pingpong/ust\n",
|
"# $ ros2 run tracetools_analysis convert ~/.ros/tracing/pingpong/ust\n",
|
||||||
"#\n",
|
"#\n",
|
||||||
|
@ -104,27 +104,46 @@
|
||||||
" duration_df = data_util.get_callback_durations(obj)\n",
|
" duration_df = data_util.get_callback_durations(obj)\n",
|
||||||
" starttime = duration_df.loc[:, 'timestamp'].iloc[0].strftime('%Y-%m-%d %H:%M')\n",
|
" starttime = duration_df.loc[:, 'timestamp'].iloc[0].strftime('%Y-%m-%d %H:%M')\n",
|
||||||
" source = ColumnDataSource(duration_df)\n",
|
" source = ColumnDataSource(duration_df)\n",
|
||||||
" duration = figure(title=owner_info,\n",
|
" duration = figure(\n",
|
||||||
|
" title=owner_info,\n",
|
||||||
" x_axis_label=f'start ({starttime})',\n",
|
" x_axis_label=f'start ({starttime})',\n",
|
||||||
" y_axis_label='duration (ms)',\n",
|
" y_axis_label='duration (ms)',\n",
|
||||||
" plot_width=psize, plot_height=psize)\n",
|
" plot_width=psize, plot_height=psize,\n",
|
||||||
|
" )\n",
|
||||||
" duration.title.align = 'center'\n",
|
" duration.title.align = 'center'\n",
|
||||||
" duration.line(x='timestamp', y='duration', legend=str(symbol), line_width=2, source=source, line_color=colours[colour_i])\n",
|
" duration.line(\n",
|
||||||
|
" x='timestamp',\n",
|
||||||
|
" y='duration',\n",
|
||||||
|
" legend=str(symbol),\n",
|
||||||
|
" line_width=2,\n",
|
||||||
|
" source=source,\n",
|
||||||
|
" line_color=colours[colour_i],\n",
|
||||||
|
" )\n",
|
||||||
" duration.legend.label_text_font_size = '11px'\n",
|
" duration.legend.label_text_font_size = '11px'\n",
|
||||||
" duration.xaxis[0].formatter = DatetimeTickFormatter(seconds=['%Ss'])\n",
|
" duration.xaxis[0].formatter = DatetimeTickFormatter(seconds=['%Ss'])\n",
|
||||||
"\n",
|
"\n",
|
||||||
" # Histogram\n",
|
" # Histogram\n",
|
||||||
" dur_hist, edges = np.histogram(duration_df['duration'])\n",
|
" dur_hist, edges = np.histogram(duration_df['duration'])\n",
|
||||||
" duration_hist = pd.DataFrame({'duration': dur_hist, \n",
|
" duration_hist = pd.DataFrame({\n",
|
||||||
|
" 'duration': dur_hist, \n",
|
||||||
" 'left': edges[:-1], \n",
|
" 'left': edges[:-1], \n",
|
||||||
" 'right': edges[1:]})\n",
|
" 'right': edges[1:],\n",
|
||||||
" hist = figure(title='Duration histogram',\n",
|
" })\n",
|
||||||
|
" hist = figure(\n",
|
||||||
|
" title='Duration histogram',\n",
|
||||||
" x_axis_label='duration (ms)',\n",
|
" x_axis_label='duration (ms)',\n",
|
||||||
" y_axis_label='frequency',\n",
|
" y_axis_label='frequency',\n",
|
||||||
" plot_width=psize, plot_height=psize)\n",
|
" plot_width=psize, plot_height=psize,\n",
|
||||||
|
" )\n",
|
||||||
" hist.title.align = 'center'\n",
|
" hist.title.align = 'center'\n",
|
||||||
" hist.quad(bottom=0, top=duration_hist['duration'], \n",
|
" hist.quad(\n",
|
||||||
" left=duration_hist['left'], right=duration_hist['right'], fill_color=colours[colour_i], line_color=colours[colour_i])\n",
|
" bottom=0,\n",
|
||||||
|
" top=duration_hist['duration'], \n",
|
||||||
|
" left=duration_hist['left'],\n",
|
||||||
|
" right=duration_hist['right'],\n",
|
||||||
|
" fill_color=colours[colour_i],\n",
|
||||||
|
" line_color=colours[colour_i],\n",
|
||||||
|
" )\n",
|
||||||
"\n",
|
"\n",
|
||||||
" colour_i += 1\n",
|
" colour_i += 1\n",
|
||||||
" show(row(duration, hist))"
|
" show(row(duration, hist))"
|
||||||
|
@ -145,17 +164,26 @@
|
||||||
" earliest_date = thedate\n",
|
" earliest_date = thedate\n",
|
||||||
"\n",
|
"\n",
|
||||||
"starttime = earliest_date.strftime('%Y-%m-%d %H:%M')\n",
|
"starttime = earliest_date.strftime('%Y-%m-%d %H:%M')\n",
|
||||||
"duration = figure(title='Callback durations',\n",
|
"duration = figure(\n",
|
||||||
|
" title='Callback durations',\n",
|
||||||
" x_axis_label=f'start ({starttime})',\n",
|
" x_axis_label=f'start ({starttime})',\n",
|
||||||
" y_axis_label='duration (ms)',\n",
|
" y_axis_label='duration (ms)',\n",
|
||||||
" plot_width=psize, plot_height=psize)\n",
|
" plot_width=psize, plot_height=psize,\n",
|
||||||
|
")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"colour_i = 0\n",
|
"colour_i = 0\n",
|
||||||
"for obj, symbol in callback_symbols.items():\n",
|
"for obj, symbol in callback_symbols.items():\n",
|
||||||
" duration_df = data_util.get_callback_durations(obj)\n",
|
" duration_df = data_util.get_callback_durations(obj)\n",
|
||||||
" source = ColumnDataSource(duration_df)\n",
|
" source = ColumnDataSource(duration_df)\n",
|
||||||
" duration.title.align = 'center'\n",
|
" duration.title.align = 'center'\n",
|
||||||
" duration.line(x='timestamp', y='duration', legend=str(symbol), line_width=2, source=source, line_color=colours[colour_i])\n",
|
" duration.line(\n",
|
||||||
|
" x='timestamp',\n",
|
||||||
|
" y='duration',\n",
|
||||||
|
" legend=str(symbol),\n",
|
||||||
|
" line_width=2,\n",
|
||||||
|
" source=source,\n",
|
||||||
|
" line_color=colours[colour_i],\n",
|
||||||
|
" )\n",
|
||||||
" colour_i += 1\n",
|
" colour_i += 1\n",
|
||||||
" duration.legend.label_text_font_size = '11px'\n",
|
" duration.legend.label_text_font_size = '11px'\n",
|
||||||
" duration.xaxis[0].formatter = DatetimeTickFormatter(seconds=['%Ss'])\n",
|
" duration.xaxis[0].formatter = DatetimeTickFormatter(seconds=['%Ss'])\n",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue