diff options
Diffstat (limited to 'hardinfo2')
-rw-r--r-- | hardinfo2/arch/common/md5.h | 6 | ||||
-rw-r--r-- | hardinfo2/arch/common/sha1.h | 6 | ||||
-rw-r--r-- | hardinfo2/arch/common/zlib.h | 8 | ||||
-rw-r--r-- | hardinfo2/benchmark.c | 22 | ||||
-rw-r--r-- | hardinfo2/benchmark.conf | 40 | ||||
-rw-r--r-- | hardinfo2/menu.c | 4 | ||||
-rw-r--r-- | hardinfo2/shell.c | 37 | ||||
-rw-r--r-- | hardinfo2/shell.h | 6 |
8 files changed, 79 insertions, 50 deletions
diff --git a/hardinfo2/arch/common/md5.h b/hardinfo2/arch/common/md5.h index e14da71c..b1990b40 100644 --- a/hardinfo2/arch/common/md5.h +++ b/hardinfo2/arch/common/md5.h @@ -59,8 +59,8 @@ benchmark_md5(void) g_timer_destroy(timer); g_free(bdata_path); - gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n" - "<i>This Machine</i>=%.2f\n", elapsed); - return benchmark_include_results(retval, "MD5"); + gchar *retval = g_strdup_printf("[Results]\n" + "<i>This Machine</i>=%.2f MiB/s\n", 312.0 / elapsed); + return benchmark_include_results_reverse(retval, "MD5"); } diff --git a/hardinfo2/arch/common/sha1.h b/hardinfo2/arch/common/sha1.h index 8164e885..8e4c2111 100644 --- a/hardinfo2/arch/common/sha1.h +++ b/hardinfo2/arch/common/sha1.h @@ -58,8 +58,8 @@ benchmark_sha1(void) g_timer_destroy(timer); g_free(bdata_path); - gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n" - "<i>This Machine</i>=%.2f\n", elapsed); - return benchmark_include_results(retval, "SHA1"); + gchar *retval = g_strdup_printf("[Results]\n" + "<i>This Machine</i>=%.2f MiB/s\n", elapsed); + return benchmark_include_results_reverse(retval, "SHA1"); } diff --git a/hardinfo2/arch/common/zlib.h b/hardinfo2/arch/common/zlib.h index b3acd472..b051f036 100644 --- a/hardinfo2/arch/common/zlib.h +++ b/hardinfo2/arch/common/zlib.h @@ -81,8 +81,8 @@ benchmark_zlib(void) g_timer_destroy(timer); g_free(bdata_path); - gchar *retval = g_strdup_printf("[Results <i>(in seconds; lower is better)</i>]\n" - "<i>This Machine</i>=%.2f\n", elapsed); - return benchmark_include_results(retval, "ZLib"); + gchar *retval = g_strdup_printf("[Results]\n" + "<i>This Machine</i>=%.3f KiB/s\n", + 65536.0 / elapsed); + return benchmark_include_results_reverse(retval, "ZLib"); } - diff --git a/hardinfo2/benchmark.c b/hardinfo2/benchmark.c index 5cc23cdd..ed62ba19 100644 --- a/hardinfo2/benchmark.c +++ b/hardinfo2/benchmark.c @@ -40,7 +40,8 @@ static ModuleEntry hi_entries[] = { }; static gchar * -benchmark_include_results(gchar *results, const gchar *benchmark) +__benchmark_include_results(gchar *results, const gchar *benchmark, + ShellOrderType order_type) { GKeyFile *conf; gchar **machines, *bconf_path; @@ -61,9 +62,22 @@ benchmark_include_results(gchar *results, const gchar *benchmark) g_key_file_free(conf); g_free(bconf_path); - return g_strconcat("[$ShellParam$]\n" - "Zebra=1\n" - "ViewType=3\n", results, NULL); + return g_strdup_printf("[$ShellParam$]\n" + "Zebra=1\n" + "OrderType=%d\n" + "ViewType=3\n%s", order_type, results); +} + +static gchar * +benchmark_include_results_reverse(gchar *results, const gchar *benchmark) +{ + return __benchmark_include_results(results, benchmark, SHELL_ORDER_DESCENDING); +} + +static gchar * +benchmark_include_results(gchar *results, const gchar *benchmark) +{ + return __benchmark_include_results(results, benchmark, SHELL_ORDER_ASCENDING); } #include <arch/common/fib.h> diff --git a/hardinfo2/benchmark.conf b/hardinfo2/benchmark.conf index 1ceb5289..501a7a89 100644 --- a/hardinfo2/benchmark.conf +++ b/hardinfo2/benchmark.conf @@ -1,49 +1,47 @@ [ZLib] # RAM:1024,Board:GA-7NNXP,OS:Linux 2.6.15 -AMD Athlon XP 3200+=4.33 +AMD Athlon XP 3200+=15135.3348 KiB/s # RAM:512,Board:Toshiba M45-S165,OS:Linux 2.6.15,Compiler:GCC 3.3.5 -Intel Celeron M 1.5GHz=5.63 -AMD Athlon XP 2200+=7.38 -PowerMac G3 280MHz=26.97 +Intel Celeron M 1.5GHz=11640.4973 KiB/s +AMD Athlon XP 2200+=8880.2168 KiB/s +PowerMac G3 280MHz=2429.9592 KiB/s # RAM:128,Board:XingLing,OS:Linux 2.4.20 -Intel Pentium 200MHz=117.79 -# RAM:1024,Board:GA-7NNXP,OS:Linux 2.6.15 -Valgrind/AMD Athlon XP 3200+=155.91 +Intel Pentium 200MHz=556.3799 KiB/s # RAM:32,Board:Toshiba Libretto 50CT,OS:Linux 2.4.20 -Intel Pentium 75MHz=197.50 +Intel Pentium 75MHz=331.8278 KiB/s [Fibonacci] # RAM:1024,Board:GA-7NNXP,OS:Linux 2.6.15 -AMD Athlon XP 3200+=7.34 -#AMD Athlon XP 2200+=3.54 +AMD Athlon XP 3200+=7.34 s +#AMD Athlon XP 2200+=3.54 s # RAM:768,Board:Toshiba M45-S165,OS:Linux 2.6.17,Compiler:GCC 4.1.2 -Intel Celeron M 1.5GHz=9.621 +Intel Celeron M 1.5GHz=9.621 s # RAM:128,Board:XingLing,OS:Linux 2.4.20 #Intel Pentium 200MHz=35.02 -PowerMac G3 280MHz=58.085 +PowerMac G3 280MHz=58.085 s # RAM:32,Board:Toshiba Libretto 50CT,OS:Linux 2.4.20 #Intel Pentium 75MHz=110.20 # RAM:1024,Board:GA-7NNXP,OS:Linux 2.6.15 #Valgrind/AMD Athlon XP 3200+=164.92 -Intel Pentium 75MHz=169.961 +Intel Pentium 75MHz=169.961 s [MD5] # RAM:512,Board:Toshiba M45-S165,OS:Linux 2.6.15,Compiler:GCC 3.3.5 -Intel Celeron M 1.5GHz=8.54 +Intel Celeron M 1.5GHz=36.533 MiB/s # RAM:1024,Board:GA-7NNXP,OS:Linux 2.6.15 -AMD Athlon XP 3200+=5.04 -PowerMac G3 280MHz=43.86 -Intel Pentium 75MHz=104.78 +AMD Athlon XP 3200+=61.9047 MiB/s +PowerMac G3 280MHz=7.1135 MiB/s +Intel Pentium 75MHz=2.977 MiB/s [SHA1] # RAM:1024,Board:GA-7NNXP,OS:Linux 2.6.15 -AMD Athlon XP 3200+=4.88 +AMD Athlon XP 3200+=63.93 MiB/s # RAM:512,Board:Toshiba M45-S165,OS:Linux 2.6.15,Compiler:GCC 3.3.5 -Intel Celeron M 1.5GHz=6.93 -PowerMac G3 280MHz=46.28 -Intel Pentium 75MHz=202.04 +Intel Celeron M 1.5GHz=45.02 MiB/s +PowerMac G3 280MHz=6.74 MiB/s +Intel Pentium 75MHz=1.54 MiB/s [Blowfish] PowerMac G3 280MHz=172.76 diff --git a/hardinfo2/menu.c b/hardinfo2/menu.c index 344c1386..250cfa10 100644 --- a/hardinfo2/menu.c +++ b/hardinfo2/menu.c @@ -45,8 +45,8 @@ static GtkActionEntry entries[] = NULL, G_CALLBACK(cb_copy_to_clipboard) }, - { "SaveGraphAction", GTK_STOCK_SAVE, - "_Save Graphic", "<control>S", + { "SaveGraphAction", GTK_STOCK_SAVE_AS, + "_Save image as...", "<control>S", NULL, G_CALLBACK(cb_save_graphic) }, diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index b776cbfb..f9c12a5e 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -611,7 +611,8 @@ info_tree_compare_val_func(GtkTreeModel * model, ret = (col1 == NULL) ? -1 : 1; } else { - ret = atof(col1) < atof(col2); + ret = shell->_order_type ? (atof(col1) < atof(col2)) : + (atof(col1) > atof(col2)); } g_free(col1); @@ -715,6 +716,10 @@ group_handle_special(GKeyFile * key_file, ShellModuleEntry * entry, ms = g_key_file_get_integer(key_file, group, key, NULL); g_timeout_add(ms, reload_section, entry); + } else if (g_str_equal(key, "OrderType")) { + shell->_order_type = g_key_file_get_integer(key_file, + group, + key, NULL); } else if (g_str_equal(key, "ViewType")) { set_view_type(g_key_file_get_integer(key_file, group, key, NULL)); @@ -852,7 +857,7 @@ static void update_progress() gdouble maxv = 0, maxp = 0, cur; gtk_tree_model_get_iter_first(model, &fiter); - + /* finds the maximum value */ iter = fiter; do { @@ -865,22 +870,28 @@ static void update_progress() } while (gtk_tree_model_iter_next(model, &iter)); /* calculates the relative percentage and finds the maximum percentage */ - iter = fiter; - do { - gtk_tree_model_get(model, &iter, INFO_TREE_COL_VALUE, &tmp, -1); + if (shell->_order_type == SHELL_ORDER_ASCENDING) { + iter = fiter; + do { + gtk_tree_model_get(model, &iter, INFO_TREE_COL_VALUE, &tmp, -1); - cur = 100 - 100 * atof(tmp) / maxv; - maxp = MAX(cur, maxp); + cur = 100 - 100 * atof(tmp) / maxv; + maxp = MAX(cur, maxp); - g_free(tmp); - } while (gtk_tree_model_iter_next(model, &iter)); + g_free(tmp); + } while (gtk_tree_model_iter_next(model, &iter)); + maxp = 100 - maxp; + } + /* fix the maximum relative percentage */ iter = fiter; do { gtk_tree_model_get(model, &iter, INFO_TREE_COL_VALUE, &tmp, -1); - cur = 100 - 100 * atof(tmp) / maxv + 100 - maxp; + cur = 100 * atof(tmp) / maxv; + if (shell->_order_type == SHELL_ORDER_ASCENDING) + cur = 100 - cur + maxp; gtk_tree_store_set(store, &iter, INFO_TREE_COL_PROGRESS, cur, -1); g_free(tmp); @@ -908,15 +919,15 @@ module_selected_show_info(ShellModuleEntry * entry, gboolean reload) gint i; gsize ngroups; - /* reset the view type to normal */ - set_view_type(SHELL_VIEW_NORMAL); - if (entry->func) { key_data = entry->func(entry->number); } else { key_data = g_strdup("[Error]\n" "Invalid module="); } + /* reset the view type to normal */ + set_view_type(SHELL_VIEW_NORMAL); + /* recreate the iter hash table only if we're not reloading the module section */ if (!reload) { if (update_tbl != NULL) { diff --git a/hardinfo2/shell.h b/hardinfo2/shell.h index c5508422..c343f557 100644 --- a/hardinfo2/shell.h +++ b/hardinfo2/shell.h @@ -31,6 +31,11 @@ typedef struct _ShellModuleEntry ShellModuleEntry; typedef struct _ShellFieldUpdate ShellFieldUpdate; typedef enum { + SHELL_ORDER_DESCENDING, + SHELL_ORDER_ASCENDING, +} ShellOrderType; + +typedef enum { SHELL_PACK_RESIZE = 1 << 0, SHELL_PACK_SHRINK = 1 << 1 } ShellPackOptions; @@ -77,6 +82,7 @@ struct _Shell { ShellViewType view_type; gint _pulses; + ShellOrderType _order_type; }; struct _ShellTree { |