diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-07-11 17:51:31 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-07-11 17:51:31 +0200 |
commit | 083d99b28fa93c18d1baf355f7135d21fba624d2 (patch) | |
tree | 916fa3e18b37373a9eaa5af36cc766a3d07651a9 /ifpps.c | |
parent | 46d58adcd416a3d895187ee95918d06b4198faae (diff) |
ifpps: show machine type only if not in already release name
In Fedora or RHEL/CentOS releases the machine type is already part
of the package name, so show it only, if it does not appear there.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'ifpps.c')
-rw-r--r-- | ifpps.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -23,6 +23,7 @@ #include "die.h" #include "dev.h" #include "sig.h" +#include "str.h" #include "link.h" #include "xmalloc.h" #include "ioops.h" @@ -672,7 +673,7 @@ static void screen_header(WINDOW *screen, const char *ifname, int *voff, uint64_t ms_interval, unsigned int top_cpus) { size_t len = 0; - char buff[64]; + char buff[64], machine[64]; struct ethtool_drvinfo drvinf; u32 rate = device_bitrate(ifname); int link = ethtool_link(ifname); @@ -682,15 +683,20 @@ static void screen_header(WINDOW *screen, const char *ifname, int *voff, ethtool_drvinf(ifname, &drvinf); memset(buff, 0, sizeof(buff)); + memset(machine, 0, sizeof(machine)); + if (rate) len += snprintf(buff + len, sizeof(buff) - len, " %uMbit/s", rate); if (link >= 0) len += snprintf(buff + len, sizeof(buff) - len, " link:%s", link == 0 ? "no" : "yes"); + if (!strstr(uts.release, uts.machine)) + slprintf(machine, sizeof(machine), " %s,", uts.machine); + mvwprintw(screen, (*voff)++, 2, - "%s, %s, %s (%s%s), t=%lums, cpus=%u%s/%u" - " ", uts.release, uts.machine, + "%s,%s %s (%s%s), t=%lums, cpus=%u%s/%u" + " ", uts.release, machine, ifname, drvinf.driver, buff, ms_interval, top_cpus, top_cpus > 0 && top_cpus < cpus ? "+1" : "", cpus); } |