fr_load_stats_t stats; //!< sending statistics
fr_time_t step_start; //!< when the current step started
fr_time_t step_end; //!< when the current step will end
+ int step_received;
uint32_t pps;
fr_time_delta_t delta; //!< between packets
if (next >= l->step_end) {
l->step_start = next;
l->step_end = next + ((uint64_t) l->config->duration) * NSEC;
+ l->step_received = l->stats.received;
l->pps += l->config->step;
l->stats.pps = l->pps;
l->delta = (NSEC * l->config->parallel) / l->pps;
l->stats.rttvar = RTTVAR(l->stats.rtt, l->stats.rttvar, t);
l->stats.rtt = RTT(l->stats.rtt, t);
+ l->stats.received++;
+
+ /*
+ * Track packets/s. Since times are in nanoseconds, we
+ * have to scale the counters up by NSEC. And since NSEC
+ * is 1B, the calculations have to be done via 64-bit
+ * numbers, and then converted to a final 32-bit counter.
+ */
+ l->stats.pps_accepted = (((uint64_t) (l->stats.received - l->step_received)) * NSEC) / (now - l->step_start);
+
/*
* t is in nanoseconds.
*/
l->stats.times[7]++; /* tens of seconds */
}
- l->stats.received++;
-
/*
* Still sending packets. Rely on the timer to send more
* packets.
fr_time_delta_t rtt; //!< smoothed round trip time
fr_time_delta_t rttvar; //!< RTT variation
int pps; //!< current offered packets/s
- int pps_ema; //!< EMA of accepted PPS
+ int pps_accepted; //!< Accepted PPS for the last second
int sent; //!< total packets sent
int received; //!< total packets received (should be == sent)
int backlog_ema; //!< exponential moving average
len = snprintf(buffer, sizeof(buffer),
"%f,%f,"
- "%" PRIu64 ",%" PRIu64 ",%d,"
+ "%" PRIu64 ",%" PRIu64 ","
+ "%d,%d,"
"%d,%d,"
"%d,%d,"
"%d,%d,%d,%d,%d,%d,%d,%d\n",
now_f, last_send_f,
- stats->rtt, stats->rttvar, stats->pps,
+ stats->rtt, stats->rttvar,
+ stats->pps, stats->pps_accepted,
stats->sent, stats->received,
stats->backlog_ema, stats->max_backlog,
stats->times[0], stats->times[1], stats->times[2], stats->times[3],
(void) fr_event_timer_in(thread, thread->el, &thread->ev, NSEC, write_stats, thread);
- len = snprintf(buffer, sizeof(buffer), "\"time\",\"last_packet\",\"rtt\",\"rttvar\",\"pps\",\"sent\",\"received\",\"ema_backlog\",\"max_backlog\",\"usec\",\"10us\",\"100us\",\"ms\",\"10ms\",\"100ms\",\"s\",\"10s\"\n");
+ len = snprintf(buffer, sizeof(buffer), "\"time\",\"last_packet\",\"rtt\",\"rttvar\",\"pps\",\"pps_accepted\",\"sent\",\"received\",\"ema_backlog\",\"max_backlog\",\"usec\",\"10us\",\"100us\",\"ms\",\"10ms\",\"100ms\",\"s\",\"10s\"\n");
if (write(thread->fd, buffer, len) < 0) {
DEBUG("Failed writing to %s - %s", thread->inst->csv, fr_syserror(errno));
}