diff options
author | Burt P <pburt0@gmail.com> | 2018-10-21 00:42:31 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2018-11-04 15:02:46 -0800 |
commit | d5d0607e4da1bde37fc0072c65689d2ed0775ed1 (patch) | |
tree | e0dfccc2a6e965870c9409e77e7bdfe4a8c5668a | |
parent | f6299d9fad21c065d1e4c0f1093770835fb73adf (diff) |
benchmark/blowfish: new version of blowfish benchmark
The new version uses a fixed time and provides variants for
single-thread, multi-thread, and multi-core.
A few results are included.
Signed-off-by: Burt P <pburt0@gmail.com>
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | data/benchmark.conf | 27 | ||||
-rw-r--r-- | includes/benchmark.h | 8 | ||||
-rw-r--r-- | modules/benchmark/bench_results.c | 6 | ||||
-rw-r--r-- | modules/benchmark/benches.c | 16 | ||||
-rw-r--r-- | modules/benchmark/blowfish.c | 45 | ||||
-rw-r--r-- | modules/benchmark/blowfish2.c | 86 |
7 files changed, 136 insertions, 53 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 697bdac4..73e82e7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,6 +167,7 @@ set(MODULE_network_SOURCES set(MODULE_benchmark_SOURCES_GTKANY modules/benchmark.c modules/benchmark/blowfish.c + modules/benchmark/blowfish2.c modules/benchmark/cryptohash.c modules/benchmark/drawing.c modules/benchmark/fbench.c diff --git a/data/benchmark.conf b/data/benchmark.conf index dc1f64f0..27eeea49 100644 --- a/data/benchmark.conf +++ b/data/benchmark.conf @@ -321,3 +321,30 @@ PowerPC 740/750=58.07682|280.00 MHz|Unknown PowerPC 740/750=2150.597408|280.00 MHz|Unknown 2_0___X370_SLI_PLUS_(MS_7A33)_(Micro_Star_International_Co___Ltd_);AMD_Ryzen_5_1600_Six_Core_Processor;38400_00 = 1.904608; 2.047665; 12|12|2.0 / X370 SLI PLUS (MS-7A33) (Micro-Star International Co., Ltd.)|AMD Ryzen 5 1600 Six-Core Processor|1 physical processor; 6 cores; 12 threads|12x 3200.00 MHz|16377260|1|6|12|AMD Radeon (TM) R9 390 Series (HAWAII, DRM 3.26.0, 4.18.0, LLVM 6.0.1)|AMD/ATI Hawaii PRO + NVIDIA GeForce GTX 750 [GPU Drawing] + +[CPU Blowfish (Single-thread)] +ASUS_PRIME_B350_PLUS;AMD_Ryzen_5_1600_Six_Core_Processor;38400_00 = 9.200000; 7.000093; 1|1|ASUS PRIME B350-PLUS|AMD Ryzen 5 1600 Six-Core Processor|1 physical processor; 6 cores; 12 threads|12x 3200.00 MHz|16423384|1|6|12|Radeon RX 560 Series (POLARIS11, DRM 3.26.0, 4.18.0-10-generic, LLVM 7.0.0)|AMD/ATI Baffin +Gigabyte_GA_MA770T_UD3P;AMD_Phenom(tm)_II_X2_550_Processor;6200_00 = 9.130000; 7.000164; 1|1|Gigabyte GA-MA770T-UD3P|AMD Phenom(tm) II X2 550 Processor|1 physical processor; 2 cores; 2 threads|2x 3100.00 MHz|16425960|1|2|2|llvmpipe (LLVM 6.0, 128 bits)|AMD/ATI Caicos XT +ZOTAC_ZBOXNANO_AD12;AMD_E2_1800_APU_with_Radeon(tm)_HD_Graphics;3400_00 = 3.910000; 7.000503; 1|1|ZOTAC ZBOXNANO-AD12|AMD E2-1800 APU with Radeon(tm) HD Graphics|1 physical processor; 2 cores; 2 threads|2x 1700.00 MHz|1741052|1|2|2|llvmpipe (LLVM 6.0, 128 bits)|AMD/ATI Wrestler +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00 = 1.430000; 7.000866; 1|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233612|1|1|1||Broadcom VideoCore IV +Raspberry_Pi_2_Model_B_Rev_1_1;Broadcom_BCM2836;3600_00 = 1.770000; 7.000509; 1|1|Raspberry Pi 2 Model B Rev 1.1|Broadcom BCM2836|4x ARM Cortex-A7 MPCore r0p5 (AArch32)|4x 900.00 MHz|948952|1|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)|Broadcom VideoCore IV +Raspberry_Pi_3_Model_B_Plus_Rev_1_3;Broadcom_BCM2837;5600_00 = 3.130000; 7.000431; 1|1|Raspberry Pi 3 Model B Plus Rev 1.3|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1400.00 MHz|948952|1|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)|Broadcom VideoCore IV +Firefly_ROC_RK3328_CC;Rockchip_RK3328;5568_00 = 2.580000; 7.000278; 1|1|Firefly ROC-RK3328-CC|Rockchip RK3328|4x ARM Cortex-A53 r0p4 (AArch64)|4x 1392.00 MHz|946208|1|4|4||ARM Mali 450 + +[CPU Blowfish (Multi-thread)] +ASUS_PRIME_B350_PLUS;AMD_Ryzen_5_1600_Six_Core_Processor;38400_00 = 105.7600000 7.000394; 12|12|ASUS PRIME B350-PLUS|AMD Ryzen 5 1600 Six-Core Processor|1 physical processor; 6 cores; 12 threads|12x 3200.00 MHz|16423384|1|6|12|Radeon RX 560 Series (POLARIS11, DRM 3.26.0, 4.18.0-10-generic, LLVM 7.0.0)|AMD/ATI Baffin +Gigabyte_GA_MA770T_UD3P;AMD_Phenom(tm)_II_X2_550_Processor;6200_00 = 18.290000; 7.000137; 2|2|Gigabyte GA-MA770T-UD3P|AMD Phenom(tm) II X2 550 Processor|1 physical processor; 2 cores; 2 threads|2x 3100.00 MHz|16425960|1|2|2|llvmpipe (LLVM 6.0, 128 bits)|AMD/ATI Caicos XT +ZOTAC_ZBOXNANO_AD12;AMD_E2_1800_APU_with_Radeon(tm)_HD_Graphics;3400_00 = 7.800000; 7.000371; 2|2|ZOTAC ZBOXNANO-AD12|AMD E2-1800 APU with Radeon(tm) HD Graphics|1 physical processor; 2 cores; 2 threads|2x 1700.00 MHz|1741052|1|2|2|llvmpipe (LLVM 6.0, 128 bits)|AMD/ATI Wrestler +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00 = 1.430000; 7.000891; 1|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233612|1|1|1||Broadcom VideoCore IV +Raspberry_Pi_2_Model_B_Rev_1_1;Broadcom_BCM2836;3600_00 = 7.010000; 7.001122; 4|4|Raspberry Pi 2 Model B Rev 1.1|Broadcom BCM2836|4x ARM Cortex-A7 MPCore r0p5 (AArch32)|4x 900.00 MHz|948952|1|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)|Broadcom VideoCore IV +Raspberry_Pi_3_Model_B_Plus_Rev_1_3;Broadcom_BCM2837;5600_00 = 12.430000; 7.000546; 4|4|Raspberry Pi 3 Model B Plus Rev 1.3|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1400.00 MHz|948952|1|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)|Broadcom VideoCore IV +Firefly_ROC_RK3328_CC;Rockchip_RK3328;5568_00 = 11.820000; 7.000721; 4|4|Firefly ROC-RK3328-CC|Rockchip RK3328|4x ARM Cortex-A53 r0p4 (AArch64)|4x 1392.00 MHz|946208|1|4|4||ARM Mali 450 + +[CPU Blowfish (Multi-core)] +ASUS_PRIME_B350_PLUS;AMD_Ryzen_5_1600_Six_Core_Processor;38400_00 = 55.190000; 7.000318; 6|6|ASUS PRIME B350-PLUS|AMD Ryzen 5 1600 Six-Core Processor|1 physical processor; 6 cores; 12 threads|12x 3200.00 MHz|16423384|1|6|12|Radeon RX 560 Series (POLARIS11, DRM 3.26.0, 4.18.0-10-generic, LLVM 7.0.0)|AMD/ATI Baffin +Gigabyte_GA_MA770T_UD3P;AMD_Phenom(tm)_II_X2_550_Processor;6200_00 = 18.310000; 7.000139; 2|2|Gigabyte GA-MA770T-UD3P|AMD Phenom(tm) II X2 550 Processor|1 physical processor; 2 cores; 2 threads|2x 3100.00 MHz|16425960|1|2|2|llvmpipe (LLVM 6.0, 128 bits)|AMD/ATI Caicos XT +ZOTAC_ZBOXNANO_AD12;AMD_E2_1800_APU_with_Radeon(tm)_HD_Graphics;3400_00 = 7.830000; 7.000439; 2|2|ZOTAC ZBOXNANO-AD12|AMD E2-1800 APU with Radeon(tm) HD Graphics|1 physical processor; 2 cores; 2 threads|2x 1700.00 MHz|1741052|1|2|2|llvmpipe (LLVM 6.0, 128 bits)|AMD/ATI Wrestler +Raspberry_Pi_Model_B_Rev_1;Broadcom_BCM2835;900_00 = 1.430000; 7.000889; 1|1|Raspberry Pi Model B Rev 1|Broadcom BCM2835|1x ARM ARM1176 r0p7 (AArch32)|1x 900.00 MHz|233612|1|1|1||Broadcom VideoCore IV +Raspberry_Pi_2_Model_B_Rev_1_1;Broadcom_BCM2836;3600_00 = 6.940000; 7.001310; 4|4|Raspberry Pi 2 Model B Rev 1.1|Broadcom BCM2836|4x ARM Cortex-A7 MPCore r0p5 (AArch32)|4x 900.00 MHz|948952|1|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)|Broadcom VideoCore IV +Raspberry_Pi_3_Model_B_Plus_Rev_1_3;Broadcom_BCM2837;5600_00 = 12.440000; 7.000483; 4|4|Raspberry Pi 3 Model B Plus Rev 1.3|Broadcom BCM2837|4x ARM Cortex-A53 r0p4 (AArch32)|4x 1400.00 MHz|948952|1|4|4|Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)|Broadcom VideoCore IV +Firefly_ROC_RK3328_CC;Rockchip_RK3328;5568_00 = 11.720000; 7.000391; 4|4|Firefly ROC-RK3328-CC|Rockchip RK3328|4x ARM Cortex-A53 r0p4 (AArch64)|4x 1392.00 MHz|946208|1|4|4||ARM Mali 450 diff --git a/includes/benchmark.h b/includes/benchmark.h index 277f0c07..50f8da4b 100644 --- a/includes/benchmark.h +++ b/includes/benchmark.h @@ -6,7 +6,9 @@ extern ProgramParameters params; enum { - BENCHMARK_BLOWFISH, + BENCHMARK_BLOWFISH_SINGLE, + BENCHMARK_BLOWFISH_THREADS, + BENCHMARK_BLOWFISH_CORES, BENCHMARK_CRYPTOHASH, BENCHMARK_FIB, BENCHMARK_NQUEENS, @@ -17,7 +19,9 @@ enum { BENCHMARK_N_ENTRIES } BenchmarkEntries; -void benchmark_bfish(void); +void benchmark_bfish_single(void); +void benchmark_bfish_threads(void); +void benchmark_bfish_cores(void); void benchmark_cryptohash(void); void benchmark_fft(void); void benchmark_fib(void); diff --git a/modules/benchmark/bench_results.c b/modules/benchmark/bench_results.c index 92790edb..4f7b35db 100644 --- a/modules/benchmark/bench_results.c +++ b/modules/benchmark/bench_results.c @@ -377,6 +377,7 @@ static char *bench_result_more_info_less(bench_result *b) { char *ret = g_strdup_printf("[%s]\n" /* threads */ "%s=%d\n" + /* elapsed */ "%s=%0.4f %s\n" /* legacy */ "%s=%s\n" "[%s]\n" /* board */ "%s=%s\n" @@ -389,6 +390,7 @@ static char *bench_result_more_info_less(bench_result *b) { /* mem */ "%s=%s\n", _("Benchmark Result"), _("Threads"), b->bvalue.threads_used, + _("Elapsed Time"), b->bvalue.elapsed_time, _("seconds"), b->legacy ? _("Note") : "#Note", b->legacy ? _("This result is from an old version of HardInfo. Results might not be comparable to current version. Some details are missing.") : "", _("Machine"), @@ -410,7 +412,7 @@ static char *bench_result_more_info_complete(bench_result *b) { /* bench name */"%s=%s\n" /* threads */ "%s=%d\n" /* result */ "%s=%0.2f\n" - /* elapsed */ "%s=%0.2f\n" + /* elapsed */ "%s=%0.4f %s\n" /* legacy */ "%s=%s\n" "[%s]\n" /* board */ "%s=%s\n" @@ -428,7 +430,7 @@ static char *bench_result_more_info_complete(bench_result *b) { _("Benchmark"), b->name, _("Threads"), b->bvalue.threads_used, _("Result"), b->bvalue.result, - _("Elapsed Time"), b->bvalue.elapsed_time, + _("Elapsed Time"), b->bvalue.elapsed_time, _("seconds"), b->legacy ? _("Note") : "#Note", b->legacy ? _("This result is from an old version of HardInfo. Results might not be comparable to current version. Some details are missing.") : "", _("Machine"), diff --git a/modules/benchmark/benches.c b/modules/benchmark/benches.c index e09dedcc..94571bc7 100644 --- a/modules/benchmark/benches.c +++ b/modules/benchmark/benches.c @@ -30,7 +30,9 @@ BENCH_CALLBACK(callback_gui, "GPU Drawing", BENCHMARK_GUI, 1); BENCH_CALLBACK(callback_fft, "FPU FFT", BENCHMARK_FFT, 0); BENCH_CALLBACK(callback_nqueens, "CPU N-Queens", BENCHMARK_NQUEENS, 0); BENCH_CALLBACK(callback_raytr, "FPU Raytracing", BENCHMARK_RAYTRACE, 0); -BENCH_CALLBACK(callback_bfsh, "CPU Blowfish", BENCHMARK_BLOWFISH, 0); +BENCH_CALLBACK(callback_bfsh_single, "CPU Blowfish (Single-thread)", BENCHMARK_BLOWFISH_SINGLE, 0); +BENCH_CALLBACK(callback_bfsh_threads, "CPU Blowfish (Multi-thread)", BENCHMARK_BLOWFISH_THREADS, 0); +BENCH_CALLBACK(callback_bfsh_cores, "CPU Blowfish (Multi-core)", BENCHMARK_BLOWFISH_CORES, 0); BENCH_CALLBACK(callback_cryptohash, "CPU CryptoHash", BENCHMARK_CRYPTOHASH, 1); BENCH_CALLBACK(callback_fib, "CPU Fibonacci", BENCHMARK_FIB, 0); BENCH_CALLBACK(callback_zlib, "CPU Zlib", BENCHMARK_ZLIB, 0); @@ -45,7 +47,9 @@ void SN(gboolean reload) { \ BENCH_SCAN_SIMPLE(scan_fft, benchmark_fft, BENCHMARK_FFT); BENCH_SCAN_SIMPLE(scan_nqueens, benchmark_nqueens, BENCHMARK_NQUEENS); BENCH_SCAN_SIMPLE(scan_raytr, benchmark_raytrace, BENCHMARK_RAYTRACE); -BENCH_SCAN_SIMPLE(scan_bfsh, benchmark_fish, BENCHMARK_BLOWFISH); +BENCH_SCAN_SIMPLE(scan_bfsh_single, benchmark_bfish_single, BENCHMARK_BLOWFISH_SINGLE); +BENCH_SCAN_SIMPLE(scan_bfsh_threads, benchmark_bfish_threads, BENCHMARK_BLOWFISH_THREADS); +BENCH_SCAN_SIMPLE(scan_bfsh_cores, benchmark_bfish_cores, BENCHMARK_BLOWFISH_CORES); BENCH_SCAN_SIMPLE(scan_cryptohash, benchmark_cryptohash, BENCHMARK_CRYPTOHASH); BENCH_SCAN_SIMPLE(scan_fib, benchmark_fib, BENCHMARK_FIB); BENCH_SCAN_SIMPLE(scan_zlib, benchmark_zlib, BENCHMARK_ZLIB); @@ -71,7 +75,9 @@ void scan_gui(gboolean reload) } static ModuleEntry entries[] = { - {N_("CPU Blowfish"), "blowfish.png", callback_bfsh, scan_bfsh, MODULE_FLAG_NONE}, + {N_("CPU Blowfish (Single-thread)"), "blowfish.png", callback_bfsh_single, scan_bfsh_single, MODULE_FLAG_NONE}, + {N_("CPU Blowfish (Multi-thread)"), "blowfish.png", callback_bfsh_threads, scan_bfsh_threads, MODULE_FLAG_NONE}, + {N_("CPU Blowfish (Multi-core)"), "blowfish.png", callback_bfsh_cores, scan_bfsh_cores, MODULE_FLAG_NONE}, {N_("CPU CryptoHash"), "cryptohash.png", callback_cryptohash, scan_cryptohash, MODULE_FLAG_NONE}, {N_("CPU Fibonacci"), "nautilus.png", callback_fib, scan_fib, MODULE_FLAG_NONE}, {N_("CPU N-Queens"), "nqueens.png", callback_nqueens, scan_nqueens, MODULE_FLAG_NONE}, @@ -90,13 +96,15 @@ const gchar *hi_note_func(gint entry) case BENCHMARK_CRYPTOHASH: return _("Results in MiB/second. Higher is better."); + case BENCHMARK_BLOWFISH_SINGLE: + case BENCHMARK_BLOWFISH_THREADS: + case BENCHMARK_BLOWFISH_CORES: case BENCHMARK_ZLIB: case BENCHMARK_GUI: return _("Results in HIMarks. Higher is better."); case BENCHMARK_FFT: case BENCHMARK_RAYTRACE: - case BENCHMARK_BLOWFISH: case BENCHMARK_FIB: case BENCHMARK_NQUEENS: return _("Results in seconds. Lower is better."); diff --git a/modules/benchmark/blowfish.c b/modules/benchmark/blowfish.c index 2aa11a2a..f8d2e14a 100644 --- a/modules/benchmark/blowfish.c +++ b/modules/benchmark/blowfish.c @@ -491,48 +491,3 @@ void Blowfish_Init(BLOWFISH_CTX * ctx, unsigned char *key, int keyLen) } } } - -static gpointer -parallel_blowfish(unsigned int start, unsigned int end, void *data, gint thread_number) -{ - BLOWFISH_CTX ctx; - unsigned int i; - unsigned long L, R; - - L = 0xBEBACAFE; - R = 0xDEADBEEF; - - for (i = start; i <= end; i++) { - Blowfish_Init(&ctx, (unsigned char*)data, 65536); - Blowfish_Encrypt(&ctx, &L, &R); - Blowfish_Decrypt(&ctx, &L, &R); - } - - return NULL; -} - -void -benchmark_fish(void) -{ - bench_value r = EMPTY_BENCH_VALUE; - - gchar *tmpsrc; - gchar *bdata_path; - - bdata_path = g_build_filename(params.path_data, "benchmark.data", NULL); - if (!g_file_get_contents(bdata_path, &tmpsrc, NULL, NULL)) { - bench_results[BENCHMARK_BLOWFISH] = r; - g_free(bdata_path); - return; - } - - shell_view_set_enabled(FALSE); - shell_status_update("Performing Blowfish benchmark..."); - - r = benchmark_parallel_for(0, 0, 50000, parallel_blowfish, tmpsrc); - r.result = r.elapsed_time; - - bench_results[BENCHMARK_BLOWFISH] = r; - g_free(bdata_path); - g_free(tmpsrc); -} diff --git a/modules/benchmark/blowfish2.c b/modules/benchmark/blowfish2.c new file mode 100644 index 00000000..c6ad78a8 --- /dev/null +++ b/modules/benchmark/blowfish2.c @@ -0,0 +1,86 @@ +/* + * HardInfo - Displays System Information + * Copyright (C) 2003-2017 Leandro A. F. Pereira <leandro@hardinfo.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "hardinfo.h" +#include "benchmark.h" +#include "blowfish.h" + +#define CRUNCH_TIME 7 + +/* must be less than or equal to + * file size of ( params.path_data + "benchmark.data" ) */ +#define BENCH_DATA_SIZE 65536 + +static gpointer bfish_exec(void *in_data, gint thread_number) +{ + unsigned char key[] = "Has my shampoo arrived?"; + unsigned char *data = NULL; + unsigned long data_len = BENCH_DATA_SIZE, i = 0; + BLOWFISH_CTX ctx; + + data = malloc(BENCH_DATA_SIZE); + memcpy(data, in_data, BENCH_DATA_SIZE); + + Blowfish_Init(&ctx, key, strlen(key)); + for(i = 0; i < data_len; i += 8) { + Blowfish_Encrypt(&ctx, (unsigned long*)&data[i], (unsigned long*)&data[i+4]); + } + for(i = 0; i < data_len; i += 8) { + Blowfish_Decrypt(&ctx, (unsigned long*)&data[i], (unsigned long*)&data[i+4]); + } + + free(data); + return NULL; +} + +static gchar *get_data() +{ + gchar *tmpsrc, *bdata_path; + gsize length; + + bdata_path = g_build_filename(params.path_data, "benchmark.data", NULL); + if (!g_file_get_contents(bdata_path, &tmpsrc, &length, NULL)) { + g_free(bdata_path); + return NULL; + } + if (length < BENCH_DATA_SIZE) { + g_free(tmpsrc); + return NULL; + } + + return tmpsrc; +} + +void benchmark_bfish_do(int threads, int entry, const char *status) +{ + bench_value r = EMPTY_BENCH_VALUE; + gchar *test_data = get_data(); + + shell_view_set_enabled(FALSE); + shell_status_update(status); + + r = benchmark_crunch_for(CRUNCH_TIME, threads, bfish_exec, test_data); + r.result /= 100; + bench_results[entry] = r; + + g_free(test_data); +} + +void benchmark_bfish_threads(void) { benchmark_bfish_do(0, BENCHMARK_BLOWFISH_THREADS, "Performing Blowfish benchmark (multi-thread)..."); } +void benchmark_bfish_single(void) { benchmark_bfish_do(1, BENCHMARK_BLOWFISH_SINGLE, "Performing Blowfish benchmark (single-thread)..."); } +void benchmark_bfish_cores(void) { benchmark_bfish_do(-1, BENCHMARK_BLOWFISH_CORES, "Performing Blowfish benchmark (multi-core)..."); } |