Skip to content

Commit

Permalink
samples/bpf: xdp_bench01 pretty printing with header
Browse files Browse the repository at this point in the history
  • Loading branch information
netoptimizer committed Feb 14, 2017
1 parent 5abd236 commit 309fa69
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kernel/samples/bpf/xdp_bench01_mem_access_cost_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ static void stats_poll(int interval)
/* Trick to pretty printf with thousands separators use %' */
setlocale(LC_NUMERIC, "en_US");

/* Header */
printf("%-12s %-10s %-18s %-9s\n",
"XDP_action", "pps ", "pps-human-readable", "mem");

while (1) {
sleep(interval);
prev_timestamp = timestamp;
Expand All @@ -255,7 +259,7 @@ static void stats_poll(int interval)
/* pps = (count - prev)/interval; */
pps_ = (count - prev) / ((double) period / NANOSEC_PER_SEC);

printf("XDP action: %s : %.0f pps (%'.0f pps) mem:%s\n",
printf("%-12s %-10.0f %'-18.0f %-9s\n",
action2str(record.action), pps_, pps_,
mem2str(record.touch_mem));

Expand Down

0 comments on commit 309fa69

Please sign in to comment.