Commit 3156be7d authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

greybus: loopback: timestamp seeding should not drop metrics

In the current code if the ts variable is not initialized then any data
already gathered in a previous loopback command is dropped instead of
logged. Also the timestamping of ts is done after the greybus operation.

This delayed time-stamping means that the delta between the before and
after timestamps is incorrect and if a delay in-between loopback operations
has been specified by the user, the ts timestamp will be very skewed
indeed.

- Move the ts initialization directly before the greybus operation.
- Remove the continue statement on first initialization of the ts variable.
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 09fb10fe
...@@ -394,6 +394,8 @@ static int gb_loopback_fn(void *data) ...@@ -394,6 +394,8 @@ static int gb_loopback_fn(void *data)
msleep(1000); msleep(1000);
continue; continue;
} }
if (gb->ts.tv_usec == 0 && gb->ts.tv_sec == 0)
do_gettimeofday(&gb->ts);
if (gb->type == GB_LOOPBACK_TYPE_PING) if (gb->type == GB_LOOPBACK_TYPE_PING)
error = gb_loopback_ping(gb, &tlat); error = gb_loopback_ping(gb, &tlat);
else if (gb->type == GB_LOOPBACK_TYPE_TRANSFER) else if (gb->type == GB_LOOPBACK_TYPE_TRANSFER)
...@@ -402,10 +404,6 @@ static int gb_loopback_fn(void *data) ...@@ -402,10 +404,6 @@ static int gb_loopback_fn(void *data)
error = gb_loopback_sink(gb, &tlat, gb->size); error = gb_loopback_sink(gb, &tlat, gb->size);
if (error) if (error)
gb->error++; gb->error++;
if (gb->ts.tv_usec == 0 && gb->ts.tv_sec == 0) {
do_gettimeofday(&gb->ts);
continue;
}
do_gettimeofday(&gb->te); do_gettimeofday(&gb->te);
gb->elapsed_nsecs = timeval_to_ns(&gb->te) - gb->elapsed_nsecs = timeval_to_ns(&gb->te) -
timeval_to_ns(&gb->ts); timeval_to_ns(&gb->ts);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment