aboutsummaryrefslogtreecommitdiff
path: root/modules/benchmark.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2020-01-06 00:56:00 -0600
committerLeandro A. F. Pereira <leandro@hardinfo.org>2020-01-17 16:15:54 -0800
commit59cb7cf510dbea8742e8f38fd49282471f541819 (patch)
tree343f2d4e38c5d6bd21ee998ebebf67ce5b6272c9 /modules/benchmark.c
parent73142b793562158babf717422262bd1011ef17e4 (diff)
benchmark: "This Machine" in results
To test the new label escape stuff, and for https://github.com/lpereira/hardinfo/issues/516 Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/benchmark.c')
-rw-r--r--modules/benchmark.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/modules/benchmark.c b/modules/benchmark.c
index 303fbd01..e00e5977 100644
--- a/modules/benchmark.c
+++ b/modules/benchmark.c
@@ -314,20 +314,28 @@ gchar *hi_get_field(gchar * field)
static void br_mi_add(char **results_list, bench_result *b, gboolean select) {
static unsigned int ri = 0; /* to ensure key is unique */
- gchar *ckey, *rkey;
+ gchar *rkey, *lbl, *elbl, *this_marker;
+
+ this_marker = format_with_ansi_color(_("This Machine"), "0;30;43", params.fmt_opts);
- ckey = hardinfo_clean_label(b->machine->cpu_name, 0);
rkey = g_strdup_printf("%s__%d", b->machine->mid, ri++);
- *results_list = h_strdup_cprintf("$%s%s$%s%s=%.2f|%s\n", *results_list,
- select ? "*" : "", rkey, ckey,
- b->legacy ? problem_marker() : "",
+ lbl = g_strdup_printf("%s%s%s%s",
+ select ? this_marker : "", select ? " " : "",
+ b->machine->cpu_name,
+ b->legacy ? problem_marker() : "");
+ elbl = key_label_escape(lbl);
+
+ *results_list = h_strdup_cprintf("$@%s%s$%s=%.2f|%s\n", *results_list,
+ select ? "*" : "", rkey, elbl,
b->bvalue.result, b->machine->cpu_config);
moreinfo_add_with_prefix("BENCH", rkey, bench_result_more_info(b) );
- g_free(ckey);
+ g_free(lbl);
+ g_free(elbl);
g_free(rkey);
+ g_free(this_marker);
}
gint bench_result_sort (gconstpointer a, gconstpointer b) {