This set of commits adds a new library for OVS that allows for measuring
the performance of operations in OVS and compiling statistics from these
For developers, this can provide a measurement of something that is
either finer or coarser-grained than what is easily measured with a
v4 -> v5:
* The library has changed from focusing on "performance" to being a
* Jakub Sitnicki wrote some tests, and these are included here.
* Based on tests, the 95th percentile is now calculated in the
traditional way for the first 50 measurements and then switches
* The sample structure has been removed since storing the end time
was not necessary.
* A new boolean indicating a sample is in progress has been added. This
corrects an issue that prevented a timestamp of 0 from being used as a
* A bug was fixed where the minimum time was always 0.
v3 -> v4:
* The samples vector has been removed in favor of using moving
calculations. The average is calculated using a common exponential
weighted moving average. The 95th percentile is calculated using the
P-square algorithm. This greatly reduces the memory overhead since
there is no longer a need to maintain any sort of history of samples.
* A performance/reset CLI command has been added.
* The wording of the commit in patch 2 has been altered to more
accurately describe what is being measured.
v2 -> v3:
* A background thread has been introduced that maintains the performance
* To reduce contention in the threads that are reporting performance
measurements, they no longer acquire a mutex. Instead, they pass
information over a pipe to the background thread.
* To reduce memory usage, the sample vectors have a maximum size they
can reach. In addition, the measured intervals are now smaller. Rather
than one minute, five minute, and ten minute measurements, we now do
ten second, thirty second, and one minute measurements.
v1 -> v2:
In version 1, there was a patch included that would save statistics to
the OVS database. Based on feedback from that, I decided to forgo
database support for the time being. If database support were to be
added, using a time series database rather than the OVS database would
be the way to go.
Removal of the database patch had a snowball effect that has reduced the
overall size of the patchset.
Jakub Sitnicki (3):
stopwatch: Add API for retrieving calculated statistics
stopwatch: Add API for waiting until samples have been processed
tests: Add tests for stopwatch module
Mark Michelson (2):
Add stopwatch timing API
Measure timing of ovn-controller loop.
lib/automake.mk | 2 +
lib/stopwatch.c | 549 ++++++++++++++++++++++++++++++++++++++++
lib/stopwatch.h | 57 +++++
ovn/controller/ovn-controller.c | 17 ++
tests/automake.mk | 3 +-
tests/library.at | 5 +
tests/test-stopwatch.c | 196 ++++++++++++++
7 files changed, 828 insertions(+), 1 deletion(-)
create mode 100644 lib/stopwatch.c
create mode 100644 lib/stopwatch.h
create mode 100644 tests/test-stopwatch.c
dev mailing list