|
5 | 5 | from pathlib import Path |
6 | 6 | import argparse # Add argparse for command line arguments |
7 | 7 | import cpuinfo |
| 8 | +import datetime # Add datetime for generation timestamp |
8 | 9 |
|
9 | 10 | def parse_benchmark_results(file_path): |
10 | 11 | """Parse benchmark results from file.""" |
@@ -165,6 +166,9 @@ def plot_comparisons(grouped_benchmarks, output_dir): |
165 | 166 | output_path = Path(output_dir) |
166 | 167 | output_path.mkdir(parents=True, exist_ok=True) |
167 | 168 |
|
| 169 | + # Get current timestamp for the generation time |
| 170 | + generation_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") |
| 171 | + |
168 | 172 | # Collect data for consolidated plot |
169 | 173 | categories = [] |
170 | 174 | simd_times = [] |
@@ -247,11 +251,16 @@ def format_speedup(value, pos): |
247 | 251 | ) |
248 | 252 |
|
249 | 253 | # Position the text box on the top right |
250 | | - # Adjust x and y coordinates as needed based on your plot's scale |
251 | | - # Using axes coordinates (0 to 1 for x and y) for positioning relative to the plot area |
252 | 254 | plt.text(0.80, 0.98, info_text, transform=plt.gca().transAxes, |
253 | 255 | fontsize=9, verticalalignment='top', horizontalalignment='left', |
254 | 256 | bbox=dict(boxstyle='round,pad=0.5', fc='wheat', alpha=0.5)) |
| 257 | + |
| 258 | + # Add generation time in a separate box below CPU info |
| 259 | + timestamp_text = f"Generated: {generation_time}" |
| 260 | + plt.text(0.65, 0.98, timestamp_text, transform=plt.gca().transAxes, |
| 261 | + fontsize=9, verticalalignment='top', horizontalalignment='left', |
| 262 | + bbox=dict(boxstyle='round,pad=0.5', fc='lightblue', alpha=0.5)) |
| 263 | + |
255 | 264 | plt.savefig(output_path / "consolidated_speedup.png", dpi=300) |
256 | 265 |
|
257 | 266 | # Create a table plot with the data |
@@ -294,6 +303,12 @@ def format_speedup(value, pos): |
294 | 303 | table[(i+1, 3)].set_facecolor('#f4d5d5') # Light red |
295 | 304 |
|
296 | 305 | plt.title('SIMD vs Plain Performance Comparison Table', fontsize=16, pad=20) |
| 306 | + |
| 307 | + # Add generation time in a box at the bottom of the table |
| 308 | + plt.figtext(0.5, 0.01, f"Generated: {generation_time}", |
| 309 | + ha='center', fontsize=10, |
| 310 | + bbox=dict(boxstyle='round,pad=0.5', fc='lightblue', alpha=0.5)) |
| 311 | + |
297 | 312 | plt.tight_layout() |
298 | 313 | plt.savefig(output_path / "comparison_table.png", dpi=300, bbox_inches='tight') |
299 | 314 |
|
|
0 commit comments