From 710e15b018ac5b837c299c0aed1ce683d6076cb1 Mon Sep 17 00:00:00 2001 From: yutent Date: Tue, 23 Aug 2022 11:03:59 +0800 Subject: [PATCH] update --- panel-plugin/commandline.c | 2 +- panel-plugin/net.c | 4 ++-- panel-plugin/net.h | 2 +- panel-plugin/netload.c | 2 +- panel-plugin/utils.c | 2 +- panel-plugin/wormulon/linux.h | 9 +-------- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/panel-plugin/commandline.c b/panel-plugin/commandline.c index 754d1e4..6016eff 100644 --- a/panel-plugin/commandline.c +++ b/panel-plugin/commandline.c @@ -72,7 +72,7 @@ int main(int argc, char* argv[]) for (;;) { - get_current_netload(&data, &in, &out, &tot); + get_current_speed(&data, &in, &out, &tot); format_byte_humanreadable(bufIn, 20, (double)in, 0, FALSE); format_byte_humanreadable(bufOut, 20, (double)out, 0, FALSE); format_byte_humanreadable(bufTot, 20, (double)tot, 2, TRUE); diff --git a/panel-plugin/net.c b/panel-plugin/net.c index c5b9ab3..c2cbf63 100644 --- a/panel-plugin/net.c +++ b/panel-plugin/net.c @@ -82,14 +82,14 @@ int init_netload(netdata* data, const char* device) data->correct_interface = TRUE; - DBG("The netload plugin was initialized for '%s'.", device); + DBG("The speed plugin was initialized for '%s'.", device); return TRUE; } /* ---------------------------------------------------------------------------------------------- */ -void get_current_netload(netdata* data, unsigned long *in, unsigned long *out, unsigned long *tot) +void get_current_speed(netdata* data, unsigned long *in, unsigned long *out, unsigned long *tot) { struct timeval curr_time; double delta_t; diff --git a/panel-plugin/net.h b/panel-plugin/net.h index f43e138..82778c8 100644 --- a/panel-plugin/net.h +++ b/panel-plugin/net.h @@ -85,7 +85,7 @@ int init_netload(netdata* data, const char* device); * @param out Output load in byte/s. * @param tot Total load in byte/s. */ -void get_current_netload(netdata* data, unsigned long *in, unsigned long *out, unsigned long *tot); +void get_current_speed(netdata* data, unsigned long *in, unsigned long *out, unsigned long *tot); /** * Returns the name of the network interface. diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index c056eb0..ab1f7df 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -173,7 +173,7 @@ static gboolean update_monitors(gpointer user_data) return TRUE; } - get_current_netload( &(global->monitor->data), &(net[IN]), &(net[OUT]), &(net[TOT]) ); + get_current_speed( &(global->monitor->data), &(net[IN]), &(net[OUT]), &(net[TOT]) ); for (i = 0; i < SUM; i++) diff --git a/panel-plugin/utils.c b/panel-plugin/utils.c index 12c5543..425ca13 100644 --- a/panel-plugin/utils.c +++ b/panel-plugin/utils.c @@ -78,7 +78,7 @@ char* format_byte_humanreadable(char* string, int stringsize, double number, int char* str = string; char buffer[BUFSIZ], formatstring[BUFSIZ]; char* bufptr = buffer; - char* unit_names[] = { N_("B"), N_("KiB"), N_("MiB"), N_("GiB") }; + char* unit_names[] = { N_("B/s"), N_("K/s"), N_("M/s"), N_("G/s") }; char* unit_names_bits[] = { N_("bps"), N_("Kbps"), N_("Mbps"), N_("Gbps") }; unsigned int uidx = 0; double number_displayed = 0; diff --git a/panel-plugin/wormulon/linux.h b/panel-plugin/wormulon/linux.h index 275c6b7..4b70481 100644 --- a/panel-plugin/wormulon/linux.h +++ b/panel-plugin/wormulon/linux.h @@ -1,14 +1,7 @@ -#ifndef LINUX_H -#define LINUX_H - #include "../net.h" void init_osspecific(netdata* data); int checkinterface(netdata* data); int get_stat(netdata* data); -#ifdef __linux__ -#define BUFSIZE 256 -#endif /* _linux_ */ - -#endif /* LINUX_H */ +#define BUFSIZE 256 \ No newline at end of file