summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-07-11 17:37:55 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-07-11 17:37:55 +0200
commit46d58adcd416a3d895187ee95918d06b4198faae (patch)
tree1cd77291bf7a148ff87e56fea86340e29bbfbfea
parent4c139be17d5d26a1bba81c0775ca5c8fb3a6b181 (diff)
ifpps: show kernel version and machine type
Lets make the headline output a bit more useful and show the current kernel version and well as the machine/hardware type. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r--ifpps.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ifpps.c b/ifpps.c
index 6743105..0852276 100644
--- a/ifpps.c
+++ b/ifpps.c
@@ -13,6 +13,7 @@
#include <sys/socket.h>
#include <sys/fsuid.h>
#include <sys/types.h>
+#include <sys/utsname.h>
#include <signal.h>
#include <stdint.h>
#include <stdlib.h>
@@ -71,6 +72,7 @@ static struct cpu_hit *cpu_hits;
static struct avg_stat stats_avg;
static int stats_loop = 0;
static WINDOW *stats_screen = NULL;
+static struct utsname uts;
static const char *short_options = "d:t:n:vhclp";
static const struct option long_options[] = {
@@ -687,8 +689,8 @@ static void screen_header(WINDOW *screen, const char *ifname, int *voff,
link == 0 ? "no" : "yes");
mvwprintw(screen, (*voff)++, 2,
- "Kernel net/sys statistics for %s (%s%s), t=%lums, cpus=%u%s/%u"
- " ",
+ "%s, %s, %s (%s%s), t=%lums, cpus=%u%s/%u"
+ " ", uts.release, uts.machine,
ifname, drvinf.driver, buff, ms_interval, top_cpus,
top_cpus > 0 && top_cpus < cpus ? "+1" : "", cpus);
}
@@ -1231,6 +1233,8 @@ int main(int argc, char **argv)
cpus = get_number_cpus();
top_cpus = min(top_cpus, cpus);
+ if (uname(&uts) < 0)
+ panic("Cannot execute uname!\n");
stats_alloc(&stats_old, cpus);
stats_alloc(&stats_new, cpus);