Skip to contentSkip to conversation

master - libdm: add latency histogram support

PATCH Bryn Reeves 1 participant 1 message Sep 2, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a0cf3d47f1747d64a0d54027903ddea1c858793c
Commit:        a0cf3d47f1747d64a0d54027903ddea1c858793c
Parent:        c4f3732c918c9d26fdaca42acdc92a02898dbe35
Author:        Bryn M. Reeves <[email protected]>
AuthorDate:    Wed Aug 19 20:39:10 2015 +0100
Committer:     Bryn M. Reeves <[email protected]>
CommitterDate: Wed Sep 2 20:48:59 2015 +0100

libdm: add latency histogram support

Add support for creating, parsing, and reporting dm-stats latency histograms on kernels that support precise_timestamps.

Histograms are specified as a series of time values that give the boundaries of the bins into which I/O counts accumulate (with implicit lower and upper bounds on the first and last bins).

A new type, struct dm_histogram, is introduced to represent histogram values and bin boundaries.

The boundary values may be given as either a string of values (with optional unit suffixes) or as a zero terminated array of uint64_t values expressing boundary times in nanoseconds.

A new bounds argument is added to dm_stats_create_region() which accepts a pointer to a struct dm_histogram initialised with bounds values.

Histogram data associated with a region is parsed during a call to dm_stats_populate() and used to build a table of histogram values that are pointed to from the containing area's counter set. The histogram for a specified area may then be obtained and interogated for values and properties.

This relies on kernel support to provide the boundary values in a @stats_list response: this will be present in 4.3 and 4.2-stable. A check for a minimum driver version of 4.33.0 is implemented to ensure that this is present (4.32.0 has the necessary precise_timestamps and histogram features but is unable to report these via @stats_list).

Access methods are provided to retrieve histogram values and bounds as well as simple string representations of the counts and bin boundaries. Methods are also available to return the total count for a histogram and the relative value (as a dm_percent_t) of a specified bin.

---
 WHATS_NEW_DM                        |    2 +
 libdm/.exported_symbols.DM_1_02_107 |   15 +
 libdm/libdevmapper.h                |  225 +++++++++-
 libdm/libdm-stats.c                 |  877 +++++++++++++++++++++++++++++++++--
 tools/dmsetup.c                     |    2 +-
 5 files changed, 1064 insertions(+), 57 deletions(-)
WHATS_NEW_DM +2 -0
index ba89a9d..b361b3e 100644
@@ -4,6 +4,8 @@ Version 1.02.107 -
 
 Version 1.02.106 - 26th August 2015
 ===================================
+  Add public methods to libdm-stats to access numerical histogram data.
+  Add the ability to parse histogram data into numeric form to libdm-stats.
   Add 'precise' column to statistics reports.
   Add --precise switch to 'dmstats create' to request nanosecond counters.
   Add precise argument to dm_stats_create_region().
libdm/.exported_symbols.DM_1_02_107 new file +15 -0
new file mode 100644
index 0000000..89d3464
@@ -0,0 +1,15 @@
+dm_histogram_bounds_destroy
+dm_histogram_bounds_from_string
+dm_histogram_bounds_from_uint64
+dm_histogram_get_bin_count
+dm_histogram_get_bin_lower
+dm_histogram_get_bin_percent
+dm_histogram_get_bin_upper
+dm_histogram_get_bin_width
+dm_histogram_get_nr_bins
+dm_histogram_get_sum
+dm_histogram_to_string
+dm_stats_create_region
+dm_stats_driver_supports_histogram
+dm_stats_get_histogram
+dm_stats_get_region_nr_histogram_bins
libdm/libdevmapper.h +220 -5

264 lines not on this page · raw message

libdm/libdm-stats.c +826 -51

1,042 lines not on this page · raw message

tools/dmsetup.c +1 -1
index dcf44de..976d9e3 100644
@@ -4533,7 +4533,7 @@ static int _do_stats_create_regions(struct dm_stats *dms,
 			this_len = (segments) ? segment_len : this_len;
 			if (!dm_stats_create_region(dms, &region_id,
 						    this_start, this_len, step,
-						    precise,
+						    precise, NULL,
 						    program_id, aux_data)) {
 				log_error("%s: Could not create statistics region.",
 					  devname);