greybus: loopback: run operations a set number of times
commit00af6583d15038cfaa81a99632122b67d49de403
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Tue, 21 Jul 2015 22:50:08 +0000 (21 23:50 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 22 Jul 2015 17:46:53 +0000 (22 10:46 -0700)
tree8d8bfaab84c88f75ca15a4696cfd5c4d146d709b
parent799a3f03572afa77913f2adc136c87a4b0c64850
greybus: loopback: run operations a set number of times

In order to extract a meaningful set of data out of loopback metrics it
makes sense to have the ability to specify how many times a loopback
operation should run and then to stop when the threshold is hit.

This will allow exactly the same loopback data pattern to be run again and
again, which is a fundamental prerequisite to instrumenting and
characterizing the loopback interface over time.

This patch introduces a simple sysfs controlled variable iteration_max.
iteration_max is the maximum number of iterations to run for a given set.
iteration_count is used internally to count from zero to iteration_max
if-and-only-if iteration_max is non zero. If iteration_max is zero then the
original behaviour of running the test command ad infinitum is maintained.
User-space should incrementally poll the iteration_count to determine when
the sequence is finished.

To accomplish this we move away from running as many commands as possible
in a one second window and instead run a fixed number of commands and log
the time it takes for those commands to complete in aggregate. Since we are
no longer resetting counters every one second, the tracker variables have
been moved from u32 to u64 to allow for reasonably long tests to gather
reasonably large amounts of data, without fear of over-flowing the
data-points.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/loopback.c