aboutsummaryrefslogtreecommitdiff
path: root/hardinfo/util.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2019-08-10 23:11:21 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2019-08-14 20:02:42 -0700
commitd17909c82b03ad0427a285c66766421751546c42 (patch)
tree485588a0822984d437fcd22ed9f23f441760ca72 /hardinfo/util.c
parent30508a10bf269e5ca06226fb50c86f5249cc746a (diff)
Benchmark: fixes, user_note, verifiable test data
* fix zlib display order * fix cryptohash MiB/s calculation * revision and params for other benchmarks * allow attaching user note to bench result with -u * don't inlcude the new result value bits if they are empty/invalid in bench_value_to_str(). bench_value_from_str() doesn't need to be modified. * bench_results: clean old result cpu name for x86 * use problem_marker() from dmi_memory to mark old version bench results * benchmark: verifiable test data size and content - The test data benchmark.data is stored in a file that could be edited to change the size or content. /* to guarantee size */ gchar *get_test_data(gsize min_size); /* to checksum content */ char *md5_digest_str(const char *data, unsigned int len); Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'hardinfo/util.c')
-rw-r--r--hardinfo/util.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/hardinfo/util.c b/hardinfo/util.c
index e690ff20..764415df 100644
--- a/hardinfo/util.c
+++ b/hardinfo/util.c
@@ -393,6 +393,7 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param)
static gchar *report_format = NULL;
static gchar *run_benchmark = NULL;
static gchar *result_format = NULL;
+ static gchar *bench_user_note = NULL;
static gchar **use_modules = NULL;
static gint max_bench_results = 10;
@@ -416,6 +417,12 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param)
.arg_data = &run_benchmark,
.description = N_("run benchmark; requires benchmark.so to be loaded")},
{
+ .long_name = "user-note",
+ .short_name = 'u',
+ .arg = G_OPTION_ARG_STRING,
+ .arg_data = &bench_user_note,
+ .description = N_("note attached to benchmark results")},
+ {
.long_name = "result-format",
.short_name = 'g',
.arg = G_OPTION_ARG_STRING,
@@ -511,6 +518,14 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param)
param->report_format = REPORT_FORMAT_SHELL;
}
+ /* clean user note */
+ if (bench_user_note) {
+ char *p = NULL;
+ while(p = strchr(bench_user_note, ';')) { *p = ','; }
+ param->bench_user_note =
+ gg_key_file_parse_string_as_value(bench_user_note, '|');
+ }
+
/* html ok?
* gui: yes
* report html: yes
@@ -522,7 +537,7 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param)
gchar *confdir = g_build_filename(g_get_user_config_dir(), "hardinfo", NULL);
if (!g_file_test(confdir, G_FILE_TEST_EXISTS)) {
- mkdir(confdir, 0744);
+ mkdir(confdir, 0744);
}
g_free(confdir);
}