(ax, results, datatype)
| 210 | |
| 211 | |
| 212 | def plot_throughput_grid_subplot(ax, results, datatype): |
| 213 | if datatype not in results: |
| 214 | ax.set_title(f"{datatype_title(datatype)}\nNo Data") |
| 215 | ax.axis("off") |
| 216 | return |
| 217 | |
| 218 | available = [ |
| 219 | serializer |
| 220 | for serializer in SERIALIZER_ORDER |
| 221 | if any( |
| 222 | results[datatype][operation].get(serializer, 0) > 0 |
| 223 | for operation in OPERATIONS |
| 224 | ) |
| 225 | ] |
| 226 | if not available: |
| 227 | ax.set_title(f"{datatype_title(datatype)}\nNo Data") |
| 228 | ax.axis("off") |
| 229 | return |
| 230 | |
| 231 | x = GROUP_X |
| 232 | for index, serializer in enumerate(available): |
| 233 | throughput = [] |
| 234 | for operation in OPERATIONS: |
| 235 | time_ns = results[datatype][operation].get(serializer, 0) |
| 236 | throughput.append(1e9 / time_ns if time_ns > 0 else 0) |
| 237 | offset = serializer_offset(index, len(available)) |
| 238 | ax.bar( |
| 239 | x + offset, |
| 240 | throughput, |
| 241 | GROUP_BAR_WIDTH, |
| 242 | label=SERIALIZER_LABELS[serializer], |
| 243 | color=COLORS.get(serializer, "#888888"), |
| 244 | edgecolor=BAR_EDGE_COLOR, |
| 245 | linewidth=0.8, |
| 246 | ) |
| 247 | |
| 248 | max_tps = max( |
| 249 | 1e9 / results[datatype][operation][serializer] |
| 250 | for operation in OPERATIONS |
| 251 | for serializer in available |
| 252 | if results[datatype][operation].get(serializer, 0) > 0 |
| 253 | ) |
| 254 | ax.set_ylim(0, max_tps * 1.12) |
| 255 | ax.set_title(datatype_title(datatype), pad=8) |
| 256 | set_grouped_operation_axis(ax) |
| 257 | style_throughput_axis(ax) |
| 258 | ax.yaxis.set_major_formatter(FuncFormatter(format_tps_tick)) |
| 259 | add_compact_legend(ax) |
| 260 | |
| 261 | |
| 262 | def generate_plots(results, output_dir): |
no test coverage detected