aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2024-04-22 18:17:33 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2024-04-22 18:17:33 -0300
commit8e4d3a67a0f50a60cea7fe9e99946f313bce9633 (patch)
treef001a62c0de7f3f9c637f6d1312a6b08f38d8a53 /modules
parentb493b6e27a597cecf933327613670b2eec94dbcf (diff)
parent48726c0c219ffeddb45befe0fb8621e1b2648e78 (diff)
Update upstream source from tag 'upstream/2.0.7pre'
Update to upstream version '2.0.7pre' with Debian dir a2ec7db1aec5f19fb8cfbe1c84a27b4779b604d0
Diffstat (limited to 'modules')
-rw-r--r--modules/benchmark/benches.c14
-rw-r--r--modules/benchmark/iperf3.c122
-rw-r--r--modules/devices.c2
-rw-r--r--modules/devices/riscv/processor.c4
4 files changed, 137 insertions, 5 deletions
diff --git a/modules/benchmark/benches.c b/modules/benchmark/benches.c
index c621d695..64ec687a 100644
--- a/modules/benchmark/benches.c
+++ b/modules/benchmark/benches.c
@@ -47,6 +47,7 @@ BENCH_SIMPLE(BENCHMARK_BLOWFISH_THREADS, "CPU Blowfish (Multi-thread)", benchmar
BENCH_SIMPLE(BENCHMARK_BLOWFISH_CORES, "CPU Blowfish (Multi-core)", benchmark_bfish_cores, 1);
BENCH_SIMPLE(BENCHMARK_ZLIB, "CPU Zlib", benchmark_zlib, 1);
BENCH_SIMPLE(BENCHMARK_CRYPTOHASH, "CPU CryptoHash", benchmark_cryptohash, 1);
+BENCH_SIMPLE(BENCHMARK_IPERF3_SINGLE, "Internal Network Speed", benchmark_iperf3_single, 1);
BENCH_SIMPLE(BENCHMARK_SBCPU_SINGLE, "SysBench CPU (Single-thread)", benchmark_sbcpu_single, 1);
BENCH_SIMPLE(BENCHMARK_SBCPU_ALL, "SysBench CPU (Multi-thread)", benchmark_sbcpu_all, 1);
BENCH_SIMPLE(BENCHMARK_SBCPU_QUAD, "SysBench CPU (Four threads)", benchmark_sbcpu_quad, 1);
@@ -151,6 +152,14 @@ static ModuleEntry entries[] = {
scan_benchmark_raytrace,
MODULE_FLAG_NONE,
},
+ [BENCHMARK_IPERF3_SINGLE] =
+ {
+ N_("Internal Network Speed"),
+ "network.png",
+ callback_benchmark_iperf3_single,
+ scan_benchmark_iperf3_single,
+ MODULE_FLAG_NONE,
+ },
[BENCHMARK_SBCPU_SINGLE] =
{
N_("SysBench CPU (Single-thread)"),
@@ -229,14 +238,15 @@ const gchar *hi_note_func(gint entry)
case BENCHMARK_SBCPU_ALL:
return _("Alexey Kopytov's <i><b>sysbench</b></i> is required.\n"
"Results in events/second. Higher is better.");
-
case BENCHMARK_MEMORY_SINGLE:
case BENCHMARK_MEMORY_DUAL:
case BENCHMARK_MEMORY_QUAD:
case BENCHMARK_MEMORY_ALL:
return _("Alexey Kopytov's <i><b>sysbench</b></i> is required.\n"
"Results in MiB/second. Higher is better.");
-
+ case BENCHMARK_IPERF3_SINGLE:
+ return _("<i><b>iperf3</b></i> is required.\n"
+ "Results in Gbits/s. Higher is better.");
case BENCHMARK_CRYPTOHASH:
case BENCHMARK_BLOWFISH_SINGLE:
case BENCHMARK_BLOWFISH_THREADS:
diff --git a/modules/benchmark/iperf3.c b/modules/benchmark/iperf3.c
new file mode 100644
index 00000000..43e40627
--- /dev/null
+++ b/modules/benchmark/iperf3.c
@@ -0,0 +1,122 @@
+/*
+ * HardInfo - System Information and Benchmark
+ * Copyright (C) 2020 Burt P. <pburt0@gmail.com>
+ *
+ * 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 or later.
+ *
+ * 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 <json-glib/json-glib.h>
+#include <math.h>
+
+static int iperf3_version() {
+ int ret = -1.0;
+ int v1 = 0, v2 = 0, v3 = 0, mc = 0;
+ gboolean spawned;
+ gchar *out, *err, *p, *next_nl;
+
+ spawned = g_spawn_command_line_sync("iperf3 --version",
+ &out, &err, NULL, NULL);
+ if (spawned) {
+ ret = 0;
+ p = out;
+ while(next_nl = strchr(p, '\n')) {
+ *next_nl = 0;
+ /* version */
+ mc = sscanf(p, "iperf %d.%d", &v1, &v2);
+ if (mc >= 1) {
+ ret += v1 * 1000000;
+ ret += v2 * 1000;
+ ret += v3;
+ break;
+ }
+ p = next_nl + 1;
+ }
+ g_free(out);
+ g_free(err);
+ }
+ return ret;
+}
+
+static gboolean iperf3_server() {
+ const char* argv[] = {
+ "iperf3", "-s", "--port", "61981", "--one-off", NULL };
+ return g_spawn_async(NULL, (char**)argv, NULL,
+ G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, NULL);
+}
+
+static double _get_double(JsonParser *j, const char* path) {
+ double r = NAN;
+ GError *e = NULL;
+ JsonNode *root = json_parser_get_root(j);
+ JsonNode *ra = json_path_query(path, root, &e);
+ if (e) {
+ fprintf (stderr, "json_path_query(%s) error: %s\n", path, e->message);
+ } else {
+ JsonArray *arr = json_node_get_array(ra);
+ r = json_array_get_double_element(arr, 0);
+ }
+ json_node_free(ra);
+ return r;
+}
+
+static bench_value iperf3_client() {
+ bench_value ret = EMPTY_BENCH_VALUE;
+ int v1 = 0, v2 = 0, v3 = 0, mc = 0;
+ gboolean spawned;
+ gchar *out, *err;
+ GError *e = NULL;
+
+ const char cmd_line[] = "iperf3 -c localhost --port 61981 --json --omit 3 --time 5";
+
+ spawned = g_spawn_command_line_sync(cmd_line,
+ &out, &err, NULL, NULL);
+ if (spawned) {
+ JsonParser *j = json_parser_new();
+ if (json_parser_load_from_data(j, out, -1, &e)) {
+ if (e) {
+ fprintf (stderr, "json_parser_load_from_data error: %s\n", e->message);
+ exit(-1);
+ }
+ strncpy(ret.extra, cmd_line, sizeof(ret.extra)-1);
+ ret.threads_used = 1;
+ ret.elapsed_time = _get_double(j, "$.end.sum_received.seconds");
+ ret.result = _get_double(j, "$.end.sum_received.bits_per_second");
+ ret.result /= 1000000.0; // now mega
+ ret.result /= 1000.0; // now giga
+ g_object_unref(j);
+ }
+ g_free(out);
+ g_free(err);
+ }
+ return ret;
+}
+
+void benchmark_iperf3_single(void) {
+ bench_value r = EMPTY_BENCH_VALUE;
+
+ shell_view_set_enabled(FALSE);
+ shell_status_update("Performing iperf3 localhost benchmark (single thread)...");
+
+ int v = iperf3_version();
+ if (v > 0) {
+ iperf3_server();
+ sleep(1);
+ r = iperf3_client();
+ r.revision = v;
+ }
+ bench_results[BENCHMARK_IPERF3_SINGLE] = r;
+}
diff --git a/modules/devices.c b/modules/devices.c
index 614c43f5..dd51b482 100644
--- a/modules/devices.c
+++ b/modules/devices.c
@@ -930,7 +930,7 @@ const gchar *hi_note_func(gint entry)
if (storage_no_nvme) {
return g_strdup(
_("Any NVMe storage devices present are not listed.\n"
- "<b><i>udisksd</i></b> is required for NVMe devices."));
+ "<b><i>udisks2</i></b> is required for NVMe devices."));
}
}
else if (entry == ENTRY_DMI_MEM){
diff --git a/modules/devices/riscv/processor.c b/modules/devices/riscv/processor.c
index f2e51c91..d44ca542 100644
--- a/modules/devices/riscv/processor.c
+++ b/modules/devices/riscv/processor.c
@@ -43,7 +43,7 @@ processor_scan(void)
#define CHECK_FOR(k) (g_str_has_prefix(tmp[0], k))
while (fgets(buffer, 128, cpuinfo)) {
gchar **tmp = g_strsplit(buffer, ":", 2);
- if (tmp[0] && tmp[1]) {
+ if (tmp[0] && tmp[1] && !strstr(tmp[0],"isa-") ) {//just drop empty isa-ext
tmp[0] = g_strstrip(tmp[0]);
tmp[1] = g_strstrip(tmp[1]);
} else {
@@ -53,7 +53,7 @@ processor_scan(void)
//get_str("Processor", rep_pname);
- if ( CHECK_FOR("hart") ) {
+ if ( CHECK_FOR("processor") ) {
/* finish previous */
if (processor) {
procs = g_slist_append(procs, processor);