mbox series

[ovs-dev,v7,0/5] Stopwatch Library

Message ID 20180328213510.16037-1-mmichels@redhat.com
Headers show
Series Stopwatch Library | expand

Message

Mark Michelson March 28, 2018, 9:35 p.m. UTC
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
measurements.

For developers, this can provide a measurement of something that is
either finer or coarser-grained than what is easily measured with a
profiler.

v6 -> v7:
* Changed the measurement in ovn-controller to be more narrow, and
  changed the name of the measurement as well.
* Changed return type of some internal stopwatch functions to 'void'
  since return type was irrelevant.

v5 -> v6:
* Fixed mixed-case constant name in ovn-controller.c
* Removed FIXME comments in test-stopwatch.c
* Fixed clang warning about uninitialized fields in initializer.

v4 -> v5:
* The library has changed from focusing on "performance" to being a
  stopwatch.
* 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
  to P-square.
* 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
  start time.
* 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
  structures.
* 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 flow creation.

 lib/automake.mk                 |   2 +
 lib/stopwatch.c                 | 535 ++++++++++++++++++++++++++++++++++++++++
 lib/stopwatch.h                 |  57 +++++
 ovn/controller/ovn-controller.c |  13 +
 tests/automake.mk               |   3 +-
 tests/library.at                |   5 +
 tests/test-stopwatch.c          | 195 +++++++++++++++
 7 files changed, 809 insertions(+), 1 deletion(-)
 create mode 100644 lib/stopwatch.c
 create mode 100644 lib/stopwatch.h
 create mode 100644 tests/test-stopwatch.c

Comments

Ben Pfaff April 3, 2018, 6:25 p.m. UTC | #1
On Wed, Mar 28, 2018 at 04:35:04PM -0500, Mark Michelson wrote:
> 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
> measurements.
> 
> For developers, this can provide a measurement of something that is
> either finer or coarser-grained than what is easily measured with a
> profiler.
> 
> v6 -> v7:
> * Changed the measurement in ovn-controller to be more narrow, and
>   changed the name of the measurement as well.
> * Changed return type of some internal stopwatch functions to 'void'
>   since return type was irrelevant.

There's something funny in this series because this email had six
replies.  Five of them are labeled v7, parts 1 through 5.  The extra one
is labeled v6, part 2.  Can you help me understand?
Mark Michelson April 3, 2018, 6:30 p.m. UTC | #2
On 04/03/2018 01:25 PM, Ben Pfaff wrote:
> On Wed, Mar 28, 2018 at 04:35:04PM -0500, Mark Michelson wrote:
>> 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
>> measurements.
>>
>> For developers, this can provide a measurement of something that is
>> either finer or coarser-grained than what is easily measured with a
>> profiler.
>>
>> v6 -> v7:
>> * Changed the measurement in ovn-controller to be more narrow, and
>>    changed the name of the measurement as well.
>> * Changed return type of some internal stopwatch functions to 'void'
>>    since return type was irrelevant.
> 
> There's something funny in this series because this email had six
> replies.  Five of them are labeled v7, parts 1 through 5.  The extra one
> is labeled v6, part 2.  Can you help me understand?
> 

Ah, I see what happened. I didn't clear out my patch directory prior to 
creating v7. In v7, I changed the commit message for patch 2. When I 
regenerated the patch set, all patches in my directory were overwritten 
except patch 2, so v6 of patch 2 was still present in the directory. 
When I sent an e-mail with everything from the directory, it sent v7 
patch 2 and v6 patch2. You can ignore the v6 patch 2 in the set.

Sorry for the confusion,
Mark!
Ben Pfaff April 3, 2018, 9:13 p.m. UTC | #3
On Tue, Apr 03, 2018 at 01:30:09PM -0500, Mark Michelson wrote:
> On 04/03/2018 01:25 PM, Ben Pfaff wrote:
> >On Wed, Mar 28, 2018 at 04:35:04PM -0500, Mark Michelson wrote:
> >>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
> >>measurements.
> >>
> >>For developers, this can provide a measurement of something that is
> >>either finer or coarser-grained than what is easily measured with a
> >>profiler.
> >>
> >>v6 -> v7:
> >>* Changed the measurement in ovn-controller to be more narrow, and
> >>   changed the name of the measurement as well.
> >>* Changed return type of some internal stopwatch functions to 'void'
> >>   since return type was irrelevant.
> >
> >There's something funny in this series because this email had six
> >replies.  Five of them are labeled v7, parts 1 through 5.  The extra one
> >is labeled v6, part 2.  Can you help me understand?
> >
> 
> Ah, I see what happened. I didn't clear out my patch directory prior to
> creating v7. In v7, I changed the commit message for patch 2. When I
> regenerated the patch set, all patches in my directory were overwritten
> except patch 2, so v6 of patch 2 was still present in the directory. When I
> sent an e-mail with everything from the directory, it sent v7 patch 2 and v6
> patch2. You can ignore the v6 patch 2 in the set.

Thanks, I ignored v6 patch 2 and applied the rest of the series.x