summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-09-04 16:36:12 +0200
committerTobias Klauser <tklauser@distanz.ch>2013-09-04 16:36:12 +0200
commite4e41ae1cad3fadf384564c860b4c93e8fb895da (patch)
tree71ee3a976f5ad3208f032ab8786bf023a625f459
parent34b8b715fa98a78b00d06c1eafab56984025ed2e (diff)
ifpps: Reuse device bitrate for screen_header()
Instead of issuing another call to device_bitrate(), reuse the the value acquired in screen_update() and pass it to screen_header(). Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--ifpps.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ifpps.c b/ifpps.c
index b45b05f..60cd3b3 100644
--- a/ifpps.c
+++ b/ifpps.c
@@ -692,12 +692,11 @@ static void stats_top(const struct ifstat *rel, const struct ifstat *abs,
}
static void screen_header(WINDOW *screen, const char *ifname, int *voff,
- uint64_t ms_interval, unsigned int top_cpus)
+ u32 rate, uint64_t ms_interval, unsigned int top_cpus)
{
size_t len = 0;
char buff[64], machine[64];
struct ethtool_drvinfo drvinf;
- u32 rate = device_bitrate(ifname);
int link = ethtool_link(ifname);
unsigned int cpus = get_number_cpus();
@@ -1051,7 +1050,7 @@ static void screen_update(WINDOW *screen, const char *ifname, const struct ifsta
qsort(cpu_hits, cpus, sizeof(*cpu_hits), cmp_hits);
- screen_header(screen, ifname, &voff, ms_interval, top_cpus);
+ screen_header(screen, ifname, &voff, rate, ms_interval, top_cpus);
voff++;
screen_net_dev_rel(screen, rel, &voff);