diff options
-rw-r--r-- | .github/workflows/codeql.yml | 4 | ||||
-rw-r--r-- | .github/workflows/test.yml | 4 | ||||
-rw-r--r-- | CMakeLists.txt | 25 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | hardinfo2/udisks2_util.c | 6 | ||||
-rw-r--r-- | includes/benchmark.h | 2 | ||||
-rw-r--r-- | modules/benchmark/benches.c | 14 | ||||
-rw-r--r-- | modules/benchmark/iperf3.c | 122 | ||||
-rw-r--r-- | modules/devices.c | 2 | ||||
-rw-r--r-- | modules/devices/riscv/processor.c | 4 | ||||
-rw-r--r-- | po/NEW.po | 21 | ||||
-rw-r--r-- | po/README.md | 55 | ||||
-rw-r--r-- | shell/loadgraph-uber.c | 3 | ||||
-rw-r--r-- | shell/shell.c | 8 |
14 files changed, 249 insertions, 26 deletions
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2a34a9b3..dab6eec1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -51,7 +51,9 @@ jobs: uses: actions/checkout@v4 - name: Install system dependencies - run: sudo apt install libjson-glib-dev zlib1g-dev libsoup2.4-dev libgtk-3-dev libglib2.0-dev gettext + run: | + sudo apt update + sudo apt install -y libjson-glib-dev zlib1g-dev libsoup2.4-dev libgtk-3-dev libglib2.0-dev gettext # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a5232971..176bae37 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,9 @@ jobs: - uses: actions/checkout@v3 - name: Install system dependencies - run: sudo apt install libjson-glib-dev zlib1g-dev libsoup2.4-dev libgtk-3-dev libglib2.0-dev gettext + run: | + sudo apt update + sudo apt install -y libjson-glib-dev zlib1g-dev libsoup2.4-dev libgtk-3-dev libglib2.0-dev gettext - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ef1f78c..63613829 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0.0) cmake_policy(VERSION 3.0.0) project(hardinfo2) -set(HARDINFO2_VERSION "2.0.5") +set(HARDINFO2_VERSION "2.0.7") option(HARDINFO2_GTK3 "Build for GTK3 (0/off for GTK2)" 1) option(HARDINFO2_LIBSOUP3 "Build for libsoup-3.0(EXPERIMENTAL) (0/off for libsoup-2.4)" 0) @@ -84,9 +84,7 @@ add_definitions("-Wformat") add_definitions("-Wformat-security") set(PACKAGE_LIBSOUP2_MINVERSION 2.42) -#Actually needed for save settings, steal_pointer - FIXME -set(PACKAGE_LIBGLIB2_MINVERSION 2.44) -#set(PACKAGE_LIBGLIB2_MINVERSION 2.28) +set(PACKAGE_LIBGLIB2_MINVERSION 2.24) ###################################DISTRO CHANGES############################### #Please add all distro relates stuff here @@ -148,17 +146,19 @@ if(${distro}${disversion} MATCHES "Oracle6*") set(HARDINFO2_GTK3 0) #old deprecated version - but ok set(PACKAGE_LIBSOUP2_MINVERSION 2.34.3) - #save settings disabled, steal_pointer disabled - set(PACKAGE_LIBGLIB2_MINVERSION 2.28.8) - message("-- Low GLIB2 version 2.28.0") +endif() + +#debian 7 +if(${distro}${disversion} MATCHES "DebianGNULinux7") + set(HARDINFO2_LIBSOUP3 0) + set(HARDINFO2_GTK3 0) + #old deprecated version - but ok + set(PACKAGE_LIBSOUP2_MINVERSION 2.34.3) endif() #debian 8 if(${distro}${disversion} MATCHES "DebianGNULinux8") set(HARDINFO2_LIBSOUP3 0) - #save settings disabled, steal_pointer disabled - set(PACKAGE_LIBGLIB2_MINVERSION 2.42.1) - message("-- Low GLIB2 version 2.42.1") endif() #ubuntu 20.04 @@ -304,6 +304,7 @@ set(MODULE_benchmark_SOURCES_GTKANY modules/benchmark/sha1.c modules/benchmark/zlib.c modules/benchmark/sysbench.c + modules/benchmark/iperf3.c ) set(MODULE_benchmark_SOURCES_GTK2 modules/benchmark/drawing.c @@ -520,7 +521,7 @@ endif() #RPM SET(CPACK_RPM_PACKAGE_MAINTAINER "hwspeedy <hardinfo2@bigbear.dk>") SET(CPACK_RPM_PACKAGE_DESCRIPTION "Hardinfo2 is a small application that displays information about your hardware and operating system. It has online benchmarking to check your machine performance against other machines.") -SET(CPACK_RPM_PACKAGE_RECOMMENDS "sysbench, udisks2, mesa-utils, lsscsi, lm-sensors, xdg-utils") +SET(CPACK_RPM_PACKAGE_RECOMMENDS "sysbench, udisks2, mesa-utils, lsscsi, lm-sensors, xdg-utils, iperf3") SET(CPACK_RPM_PACKAGE_LICENSE "GPL2+") SET(CPACK_RPM_PACKAGE_HOMEPAGE "https://github.com/hardinfo2/hardinfo2") if(HARDINFO2_LIBSOUP3) @@ -538,7 +539,7 @@ SET(CPACK_RPM_PACKAGE_DEPENDS "libjson-glib-1.0-0, zlib, ${PACKAGE_LS}, ${PACKAG #DEB SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "hwspeedy <hardinfo2@bigbear.dk>") SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Hardinfo2 is a small application that displays information about your hardware and operating system. It has online benchmarking to check your machine performance against other machines.") -SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "sysbench, udisks2, mesa-utils, lsscsi, lm-sensors, xdg-utils") +SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "sysbench, udisks2, mesa-utils, lsscsi, lm-sensors, xdg-utils, iperf3") SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/hardinfo2/hardinfo2") if(HARDINFO2_LIBSOUP3) SET(PACKAGE_LS "libsoup-3.0.0 (>=3.0)") @@ -43,7 +43,7 @@ Building and installing - cmake .. - make package -j (Creates package so you do not polute your distro and it can be updated by distro releases) - sudo apt install ./hardinfo_* (Use reinstall instead of install if already inst.) -- sudo apt install lm-sensors sysbench lsscsi mesa-utils dmidecode udisks2 xdg-utils +- sudo apt install lm-sensors sysbench lsscsi mesa-utils dmidecode udisks2 xdg-utils iperf3 - hardinfo2 **Fedore/Centos/RedHat/Rocky/Alma/Oracle** @@ -58,7 +58,7 @@ Building and installing - cmake .. - make package -j (Creates package so you do not polute your distro and it can be updated by distro releases) - sudo yum install ./hardinfo-* (Use reinstall instead of install if already inst.) -- sudo yum install lm_sensors sysbench lsscsi glx-utils dmidecode udisks2 xdg-utils +- sudo yum install lm_sensors sysbench lsscsi glx-utils dmidecode udisks2 xdg-utils iperf3 - hardinfo2 **openSUSE**: use zypper instead of yum, use libsoup2-devel instead of libsoup-devel @@ -88,6 +88,7 @@ in daemon mode, using the default port. - **eeprom module**: must be loaded to display info about your currently installed memory. Load with `modprobe eeprom` and refresh the module screen. - **xdg-utils**: xdg_open is used to open your browser for bugs, homepage & links. +- **iperf3**: iperf3 is used to benchmark internal network speed. - **apcaccess**: apcaccess is used for battery information. (optional) - **lspci/lsusb**: is used for bus information - installed by distro. (optional) diff --git a/hardinfo2/udisks2_util.c b/hardinfo2/udisks2_util.c index e1567d84..42ca0e91 100644 --- a/hardinfo2/udisks2_util.c +++ b/hardinfo2/udisks2_util.c @@ -133,7 +133,7 @@ GSList* udisks2_drives_func_caller(GDBusConnection* conn, g_variant_unref(v); g_object_unref(block_proxy); continue; - } + } // Skip loop devices v = get_dbus_property(block_proxy, UDISKS2_LOOP_INTERFACE, "BackingFile"); @@ -141,7 +141,7 @@ GSList* udisks2_drives_func_caller(GDBusConnection* conn, g_variant_unref(v); g_object_unref(block_proxy); continue; - } + } block_dev = block_path + strlen(UDISKS2_BLOCK_DEVICES_PATH) + 1; drive_path = NULL; @@ -629,7 +629,7 @@ GSList* get_udisks2_all_drives_info(void){ void udisks2_init(){ if (udisks2_conn == NULL){ - //FIXME udisks2_conn = get_udisks2_connection(); + udisks2_conn = get_udisks2_connection(); } } diff --git a/includes/benchmark.h b/includes/benchmark.h index 08392ad2..399c5e46 100644 --- a/includes/benchmark.h +++ b/includes/benchmark.h @@ -18,6 +18,7 @@ enum BenchmarkEntries { BENCHMARK_NQUEENS, BENCHMARK_FFT, BENCHMARK_RAYTRACE, + BENCHMARK_IPERF3_SINGLE, BENCHMARK_SBCPU_SINGLE, BENCHMARK_SBCPU_ALL, BENCHMARK_SBCPU_QUAD, @@ -47,6 +48,7 @@ void benchmark_gui(void); void benchmark_nqueens(void); void benchmark_raytrace(void); void benchmark_zlib(void); +void benchmark_iperf3_single(void); typedef struct { double result; 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); diff --git a/po/NEW.po b/po/NEW.po new file mode 100644 index 00000000..a1ab2a20 --- /dev/null +++ b/po/NEW.po @@ -0,0 +1,21 @@ +# FIX-LANGUAGE translations for PACKAGE package +# FIX-LANGUAGE translation for PACKAGE. +# Copyright (C) HardInfo Project +# This file is distributed under the same license as the PACKAGE package. +# FIX-YOUR-NAME +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-01-26 15:06+0100\n" +"PO-Revision-Date: FIX-DATE-2016-06-10 12:11+0200\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: FIX-LANGUAGE-2LETTER-SMALLCAPS\n" +"X-Poedit-Basepath: ../\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.8.7.1\n" diff --git a/po/README.md b/po/README.md new file mode 100644 index 00000000..ee1c513b --- /dev/null +++ b/po/README.md @@ -0,0 +1,55 @@ +Translators +=========== + +Before starting translation of the words/texts, that we have in the program, the po files +needs to be updated + - cd po (Always be in the po folder) + - ./updatepo.sh (Updates po from source code and shows status) + +When done the .po files are ready to be changed, thanx for helping with translation. + +Status +------ +This is an example of status of the different languages including your own after +editing - use the ./updatepo.sh + +hardinfo.pot now has 1228 strings (no change), with 69 c-format strings +- [ ] de.po : (705 / 1228 remain untranslated, needs work/fuzzy: 2) +- [ ] es.po : (293 / 1228 remain untranslated, needs work/fuzzy: 18) +- [ ] fr.po : (722 / 1228 remain untranslated, needs work/fuzzy: 0) +- [ ] ko.po : (62 / 1228 remain untranslated, needs work/fuzzy: 1) +- [ ] pt_BR.po : (197 / 1228 remain untranslated, needs work/fuzzy: 0) +- [ ] pt.po : (53 / 1228 remain untranslated, needs work/fuzzy: 0) +- [ ] ru.po : (323 / 1228 remain untranslated, needs work/fuzzy: 0) +- [ ] tr.po : (4 / 1228 remain untranslated, needs work/fuzzy: 0) +- [ ] zh_CN.po : (859 / 1228 remain untranslated, needs work/fuzzy: 0) + +Needs work/fuzzy typically has to do with spaces/periods at begin/end of translation. + +Editing +------- +Use the poedit program installed by: + - apt install poedit (Debian flavours) + - yum install poedit (Redhat flabours) + +Start the program: + - poedit ./xx.po (xx=LANGUAGE-2LETTER-SMALL-CAPS) + +NOTE: In poedit please only do translation and use find, validate and save. + + +New Language +------------ + - cp NEW.po xx.po (xx=LANGUAGE-2LETTER-SMALL-CAPS) + - emacs ./xx.po (edit the empty po and change all CHANGE-* accordingly) + - ./updatepo.sh (updates the po with all the words/text we have in the program and shows status) + - ready to edit - see above + + +Backup and Commit to GitHub +--------------------------- + - git add xx.po (If you have made a new language translation) + - git commit xx.po (Just commit your changed translation file to local repo) + - git push (Push it to github) + +It is better to make a git push too much than loose all your great work. diff --git a/shell/loadgraph-uber.c b/shell/loadgraph-uber.c index 08f1e2b5..eeee6051 100644 --- a/shell/loadgraph-uber.c +++ b/shell/loadgraph-uber.c @@ -81,11 +81,12 @@ void load_graph_set_title(LoadGraph * lg, const gchar *title) void load_graph_clear(LoadGraph * lg) { - int i; + int i; if (lg != NULL) { for (i = 0; i < LG_MAX_LINES; i++) { lg->cur_value[i] = UBER_LINE_GRAPH_NO_VALUE; } + uber_line_graph_clear(UBER_LINE_GRAPH(lg->uber_widget)); uber_graph_scale_changed(UBER_GRAPH(lg->uber_widget)); } } diff --git a/shell/shell.c b/shell/shell.c index a2773523..22b1003f 100644 --- a/shell/shell.c +++ b/shell/shell.c @@ -861,6 +861,7 @@ static gboolean update_field(gpointer data) /* if the entry is still selected, update it */ if (fu->entry->selected && fu->entry->fieldfunc) { gchar *value = fu->entry->fieldfunc(fu->field_name); + gdouble v; if (item->is_iter) { /* @@ -872,7 +873,12 @@ static gboolean update_field(gpointer data) item->iter)) { load_graph_set_title(shell->loadgraph, fu->field_name); - load_graph_update(shell->loadgraph, atof(value)); + v=atof(value); + //fix KiB->Bytes for UberGraph (GTK3) +#if GTK_CHECK_VERSION(3, 0, 0) + if(strstr(value,"KiB")) v*=1024; +#endif + load_graph_update(shell->loadgraph, v); } GtkTreeStore *store = GTK_TREE_STORE(shell->info_tree->model); |