Skip to content

Commit 0c2ec8a

Browse files
committed
AF_XDP-interaction: Exclude first measurement min/max stats as no next_adj happened
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
1 parent 4ee53b1 commit 0c2ec8a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

AF_XDP-interaction/af_xdp_user.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,7 @@ static void tx_cyclic_and_rx_process(struct config *cfg,
12341234
struct xdp_desc tx_pkts[BATCH_PKTS_MAX];
12351235
int batch_nr = cfg->batch_pkts;
12361236
int tx_nr;
1237+
bool first = true;
12371238

12381239
int period = cfg->interval;
12391240
int timermode = TIMER_ABSTIME;
@@ -1283,10 +1284,14 @@ static void tx_cyclic_and_rx_process(struct config *cfg,
12831284

12841285
/* How close is wakeup time to our actual target */
12851286
diff = calcdiff_ns(now, next); /* Positive num = wokeup after */
1286-
if (diff < stat.min)
1287-
stat.min = diff;
1288-
if (diff > stat.max)
1289-
stat.max = diff;
1287+
/* Exclude first measurement as no next_adj happened */
1288+
if (!first) {
1289+
if (diff < stat.min)
1290+
stat.min = diff;
1291+
if (diff > stat.max)
1292+
stat.max = diff;
1293+
}
1294+
first = false;
12901295
stat.avg += (double) diff;
12911296
stat.prev = stat.curr;
12921297
stat.curr = diff;

0 commit comments

Comments
 (0)