From 27991e7f661abfb26ffa6e663f0f645e1efe2cd2 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Tue, 20 Oct 2015 14:10:12 +0100 Subject: [PATCH] Exported API for output registration --- include/criterion/output.h | 36 ++++++++++++++++++++++++++++++++++++ src/log/output.c | 4 +--- 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 include/criterion/output.h diff --git a/include/criterion/output.h b/include/criterion/output.h new file mode 100644 index 0000000..baeeaba --- /dev/null +++ b/include/criterion/output.h @@ -0,0 +1,36 @@ +/* + * The MIT License (MIT) + * + * Copyright © 2015 Franklin "Snaipe" Mathieu + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#ifndef CRITERION_OUTPUT_H_ +# define CRITERION_OUTPUT_H_ + +# include "stats.h" + +typedef void criterion_reporter(FILE *stream, struct criterion_global_stats *); + +void criterion_init_output(void); +int criterion_register_output_provider(const char *name, criterion_reporter *reporter); +int criterion_add_output(const char *provider, const char *path); +void criterion_free_output(void); + +#endif /* !CRITERION_OUTPUT_H_ */ diff --git a/src/log/output.c b/src/log/output.c index 3b9918d..f23aa1d 100644 --- a/src/log/output.c +++ b/src/log/output.c @@ -1,9 +1,7 @@ #include #include #include -#include "criterion/stats.h" - -typedef void criterion_reporter(FILE *stream, struct criterion_global_stats *); +#include "criterion/output.h" KHASH_MAP_INIT_STR(ht_str, criterion_reporter*) KHASH_MAP_INIT_STR(ht_path, const char *)