1
0
mirror of https://github.com/dennypage/dpinger.git synced 2024-05-19 06:50:01 +00:00

3 Commits
v1.7 ... v1.9

Author SHA1 Message Date
Denny Page
6796fa0752 Fix integer overflow on 32 bit 2016-02-27 19:34:47 -08:00
Denny Page
24022ac098 Fix race condition with ultra low latency links 2016-02-25 20:09:30 -08:00
Denny Page
42c84e965e Time duration doesn't work in older versions of rrdtool 2016-02-21 14:38:53 -08:00
2 changed files with 20 additions and 9 deletions

View File

@@ -354,12 +354,12 @@ send_thread(
sched_yield();
clock_gettime(CLOCK_MONOTONIC, &array[next_slot].time_sent);
array[next_slot].status = PACKET_STATUS_SENT;
len = sendto(send_sock, echo_request, echo_request_len, 0, (struct sockaddr *) &dest_addr, dest_addr_len);
if (len == -1)
{
logger("%s%s: sendto error: %d\n", identifier, dest_str, errno);
}
array[next_slot].status = PACKET_STATUS_SENT;
next_slot = (next_slot + 1) % array_size;
next_sequence = (next_sequence + 1) % sequence_limit;
@@ -471,7 +471,7 @@ report(
packets_received++;
latency_usec = array[slot].latency_usec;
total_latency_usec += latency_usec;
total_latency_usec2 += latency_usec * latency_usec;
total_latency_usec2 += (unsigned long long) latency_usec * latency_usec;
}
else if (array[slot].status == PACKET_STATUS_SENT &&
ts_elapsed_usec(&array[slot].time_sent, &now) > loss_interval_usec)

View File

@@ -10,10 +10,21 @@ name="$1"
rrdfile="${name}.rrd"
echo "Creating rrd file ${rrdfile}"
rrdtool create "${rrdfile}" --step 1m \
DS:latency:GAUGE:5m:0:U \
DS:stddev:GAUGE:5m:0:U \
DS:loss:GAUGE:5m:0:100 \
RRA:AVERAGE:0.5:1m:15d \
RRA:AVERAGE:0.5:5m:90d \
RRA:AVERAGE:0.5:1h:3y
# Time duration method doesn't work in all versions of rrdtool
#rrdtool create "${rrdfile}" --step 1m \
# DS:latency:GAUGE:5m:0:U \
# DS:stddev:GAUGE:5m:0:U \
# DS:loss:GAUGE:5m:0:100 \
# RRA:AVERAGE:0.5:1m:15d \
# RRA:AVERAGE:0.5:5m:90d \
# RRA:AVERAGE:0.5:1h:3y
# This method works in all versions
rrdtool create "${rrdfile}" --step 60 \
DS:latency:GAUGE:300:0:U \
DS:stddev:GAUGE:300:0:U \
DS:loss:GAUGE:300:0:100 \
RRA:AVERAGE:0.5:1:21600 \
RRA:AVERAGE:0.5:5:25920 \
RRA:AVERAGE:0.5:60:26352