summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/loopback.c
diff options
context:
space:
mode:
authorBryan O'Donoghue2015-07-22 00:50:06 +0200
committerGreg Kroah-Hartman2015-07-22 19:46:53 +0200
commit3156be7deec47564853d13308090828c35f89cb9 (patch)
treeae0d83a08f30186a980c3761eec3422129a849b3 /drivers/staging/greybus/loopback.c
parentgreybus: manifest: convert pr_err to dev_err (diff)
downloadkernel-qcow2-linux-3156be7deec47564853d13308090828c35f89cb9.tar.gz
kernel-qcow2-linux-3156be7deec47564853d13308090828c35f89cb9.tar.xz
kernel-qcow2-linux-3156be7deec47564853d13308090828c35f89cb9.zip
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: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/loopback.c')
-rw-r--r--drivers/staging/greybus/loopback.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index fe3a57bff99c..2de939f298af 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -394,6 +394,8 @@ static int gb_loopback_fn(void *data)
msleep(1000);
continue;
}
+ if (gb->ts.tv_usec == 0 && gb->ts.tv_sec == 0)
+ do_gettimeofday(&gb->ts);
if (gb->type == GB_LOOPBACK_TYPE_PING)
error = gb_loopback_ping(gb, &tlat);
else if (gb->type == GB_LOOPBACK_TYPE_TRANSFER)
@@ -402,10 +404,6 @@ static int gb_loopback_fn(void *data)
error = gb_loopback_sink(gb, &tlat, gb->size);
if (error)
gb->error++;
- if (gb->ts.tv_usec == 0 && gb->ts.tv_sec == 0) {
- do_gettimeofday(&gb->ts);
- continue;
- }
do_gettimeofday(&gb->te);
gb->elapsed_nsecs = timeval_to_ns(&gb->te) -
timeval_to_ns(&gb->ts);