History

checkasm: add csv/tsv bench output

When collecting performance information from checkasm it is common to parse the output for use in graphs to compare vs different architectures.

J. Dekker committed 2 years ago

Commit 42528ff1 parent d89930f1 file · +20 −2Browse files

Unified · Split

tests/checkasm/checkasm.c+20−2
@@ -366,6 +366,8 @@ static struct { · 365 unmodified lines
366 const char *cpu_flag_name;366 const char *cpu_flag_name;
367 const char *test_name;367 const char *test_name;
368 int verbose;368 int verbose;
369 int csv;
370 int tsv;
369 volatile sig_atomic_t catch_signals;371 volatile sig_atomic_t catch_signals;
370} state;372} state;
371 373
@@ -590,7 +592,14 @@ static void print_benchs(CheckasmFunc *f) · 218 unmodified lines
590 CheckasmPerf *p = &v->perf;592 CheckasmPerf *p = &v->perf;
591 if (p->iterations) {593 if (p->iterations) {
592 int decicycles = (10*p->cycles/p->iterations - state.nop_time) / 4;594 int decicycles = (10*p->cycles/p->iterations - state.nop_time) / 4;
593 printf("%s_%s: %d.%d\n", f->name, cpu_suffix(v->cpu), decicycles/10, decicycles%10);595 if (state.csv || state.tsv) {
596 const char sep = state.csv ? ',' : '\t';
597 printf("%s%c%s%c%d.%d\n", f->name, sep,
598 cpu_suffix(v->cpu), sep,
599 decicycles / 10, decicycles % 10);
600 } else {
601 printf("%s_%s: %d.%d\n", f->name, cpu_suffix(v->cpu), decicycles/10, decicycles%10);
602 }
594 }603 }
595 } while ((v = v->next));604 } while ((v = v->next));
596 }605 }
@@ -833,7 +842,12 @@ static void bench_uninit(void) · 236 unmodified lines
833static int usage(const char *path)842static int usage(const char *path)
834{843{
835 fprintf(stderr,844 fprintf(stderr,
836 "Usage: %s [--bench] [--runs=<ptwo>] [--test=<pattern>] [--verbose] [seed]\n",845 "Usage: %s [options...] [seed]\n"
846 " --test=<pattern> Run specific test.\n"
847 " --bench Run benchmark.\n"
848 " --csv, --tsv Output results in rows of comma or tab separated values.\n"
849 " --runs=<ptwo> Manual number of benchmark iterations to run 2**<ptwo>.\n"
850 " --verbose Increase verbosity.\n",
837 path);851 path);
838 return 1;852 return 1;
839}853}
@@ -881,6 +895,10 @@ int main(int argc, char *argv[]) · 41 unmodified lines
881 state.bench_pattern = "";895 state.bench_pattern = "";
882 } else if (!strncmp(arg, "--test=", 7)) {896 } else if (!strncmp(arg, "--test=", 7)) {
883 state.test_name = arg + 7;897 state.test_name = arg + 7;
898 } else if (!strcmp(arg, "--csv")) {
899 state.csv = 1; state.tsv = 0;
900 } else if (!strcmp(arg, "--tsv")) {
901 state.csv = 0; state.tsv = 1;
884 } else if (!strcmp(arg, "--verbose") || !strcmp(arg, "-v")) {902 } else if (!strcmp(arg, "--verbose") || !strcmp(arg, "-v")) {
885 state.verbose = 1;903 state.verbose = 1;
886 } else if (!strncmp(arg, "--runs=", 7)) {904 } else if (!strncmp(arg, "--runs=", 7)) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t