From: "J. Dekker" <jdek@itanimul.li> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 3/7] checkasm: add wildcompares for test & functions Date: Tue, 13 Aug 2024 16:03:32 +0200 Message-ID: <20240813140338.143045-3-jdek@itanimul.li> (raw) In-Reply-To: <20240813140338.143045-1-jdek@itanimul.li> Added: --test=<pattern> Filter tests by glob style pattern. --bench[=<pattern>] Run benchmark and optionally filter functions by glob style pattern. Example: $ ./tests/checkasm/checkasm --bench=yuva* [...] yuva420p_bgr24_8_c: 34.5 ( 1.00x) yuva420p_bgr24_8_ssse3: 31.1 ( 1.11x) yuva420p_bgr24_128_c: 310.6 ( 1.00x) yuva420p_bgr24_128_ssse3: 178.1 ( 1.74x) yuva420p_bgr24_1080_c: 2509.6 ( 1.00x) yuva420p_bgr24_1080_ssse3: 1471.5 ( 1.71x) yuva420p_bgr24_1920_c: 4462.6 ( 1.00x) yuva420p_bgr24_1920_ssse3: 2331.1 ( 1.91x) [...] Ported from dav1d. Signed-off-by: J. Dekker <jdek@itanimul.li> --- tests/checkasm/checkasm.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 0095758268..79cf39c27f 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -385,7 +385,7 @@ static struct { int cpu_flag; const char *cpu_flag_name; - const char *test_name; + const char *test_pattern; int verbose; int csv; int tsv; @@ -771,6 +771,22 @@ static void signal_handler(int s) { } #endif +/* Compares a string with a wildcard pattern. */ +static int wildstrcmp(const char *str, const char *pattern) +{ + const char *wild = strchr(pattern, '*'); + if (wild) { + const size_t len = wild - pattern; + if (strncmp(str, pattern, len)) return 1; + while (*++wild == '*'); + if (!*wild) return 0; + str += len; + while (*str && wildstrcmp(str, wild)) str++; + return !*str; + } + return strcmp(str, pattern); +} + /* Perform tests and benchmarks for the specified cpu flag if supported by the host */ static void check_cpu_flag(const char *name, int flag) { @@ -786,7 +802,7 @@ static void check_cpu_flag(const char *name, int flag) state.cpu_flag_name = name; for (i = 0; tests[i].func; i++) { - if (state.test_name && strcmp(tests[i].name, state.test_name)) + if (state.test_pattern && wildstrcmp(tests[i].name, state.test_pattern)) continue; state.current_test_name = tests[i].name; tests[i].func(); @@ -882,11 +898,12 @@ static int usage(const char *path) { fprintf(stderr, "Usage: %s [options...] [seed]\n" - " --test=<pattern> Run specific test.\n" - " --bench Run benchmark.\n" - " --csv, --tsv Output benchmark results in CSV or TSV format.\n" - " --runs=<ptwo> Manual number of benchmark iterations to run 2**<ptwo>.\n" - " --verbose Increase verbosity.\n", + " --test=<pattern> Filter tests by glob style pattern.\n" + " --bench[=<pattern>] Run benchmark and optionally filter functions\n" + " by glob style pattern.\n" + " --csv, --tsv Print benchmark results in CSV or TSV format.\n" + " --runs=<ptwo> Manual number of benchmark iterations to run 2**<ptwo>.\n" + " --verbose Increase verbosity.\n", path); return 1; } @@ -931,9 +948,9 @@ int main(int argc, char *argv[]) state.bench_pattern = arg + 8; state.bench_pattern_len = strlen(state.bench_pattern); } else - state.bench_pattern = ""; + state.bench_pattern = "*"; } else if (!strncmp(arg, "--test=", 7)) { - state.test_name = arg + 7; + state.test_pattern = arg + 7; } else if (!strcmp(arg, "--csv")) { state.csv = 1; state.tsv = 0; } else if (!strcmp(arg, "--tsv")) { @@ -1037,7 +1054,7 @@ void *checkasm_check_func(void *func, const char *name, ...) int checkasm_bench_func(void) { return !state.num_failed && state.bench_pattern && - !strncmp(state.current_func->name, state.bench_pattern, state.bench_pattern_len); + !wildstrcmp(state.current_func->name, state.bench_pattern); } /* Indicate that the current test has failed */ -- 2.45.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-08-13 14:04 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-08-13 14:03 [FFmpeg-devel] [PATCH 1/7] checkasm: add csv/tsv bench output J. Dekker 2024-08-13 14:03 ` [FFmpeg-devel] [PATCH 2/7] checkasm: improve print format J. Dekker 2024-08-13 16:39 ` Lynne via ffmpeg-devel 2024-08-13 14:03 ` J. Dekker [this message] 2024-08-13 14:03 ` [FFmpeg-devel] [PATCH 4/7] avutil/riscv/asm: add stack pushing helpers J. Dekker 2024-08-13 15:51 ` Rémi Denis-Courmont 2024-08-13 16:10 ` epirat07 2024-08-13 16:13 ` Rémi Denis-Courmont 2024-08-13 14:03 ` [FFmpeg-devel] [PATCH 5/7] avutil/riscv/asm: add helper macro to count varargs J. Dekker 2024-08-13 14:03 ` [FFmpeg-devel] [PATCH 6/7] avutil/riscv/asm: add generic push/pop helpers J. Dekker 2024-08-13 15:55 ` Rémi Denis-Courmont 2024-08-15 12:13 ` Niklas Haas 2024-08-13 14:03 ` [FFmpeg-devel] [PATCH 7/7] avcodec/riscv: add h264 qpel J. Dekker
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240813140338.143045-3-jdek@itanimul.li \ --to=jdek@itanimul.li \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git