Skip to contentSkip to conversation

master - libdm: add precise timestamps support to libdm-stats

PATCH Bryn Reeves 1 participant 1 message Aug 24, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f4262026b671ac2604ec8143c6fe328e9ab159aa
Commit:        f4262026b671ac2604ec8143c6fe328e9ab159aa
Parent:        82a27a85b54b68277e79de2fa9b4fadb01330497
Author:        Bryn M. Reeves <[email protected]>
AuthorDate:    Thu Aug 20 11:55:06 2015 +0100
Committer:     Bryn M. Reeves <[email protected]>
CommitterDate: Mon Aug 24 20:03:21 2015 +0100

libdm: add precise timestamps support to libdm-stats

Add support for the kernel precise_timestamps feature. This allows regions to be created using counters with nanosecond precision.

A new dm_stats method, dm_stats_set_precise_timestamps() causes all future regions created with this handle to attempt to enable precise counters.

---
 WHATS_NEW_DM                        |    2 +
 libdm/.exported_symbols.DM_1_02_106 |    2 +
 libdm/libdevmapper.h                |   11 +++
 libdm/libdm-stats.c                 |  155 +++++++++++++++++++++++++++++------
 tools/dmsetup.c                     |    1 +
 5 files changed, 144 insertions(+), 27 deletions(-)
WHATS_NEW_DM +2 -0
index 363f7bf..e083231 100644
@@ -1,5 +1,7 @@
 Version 1.02.106 -
 ===================================
+  Add precise argument to dm_stats_create_region().
+  Add support to libdm-stats for precise_timestamps
 
 Version 1.02.105 - 17th August 2015
 ===================================
libdm/.exported_symbols.DM_1_02_106 +2 -0
index 0ce8924..b664cc6 100644
@@ -1 +1,3 @@
 dm_message_supports_precise_timestamps
+dm_stats_create_region
+dm_stats_driver_supports_precise
libdm/libdevmapper.h +11 -0
index 2be2ce3..71b8ce4 100644
@@ -473,6 +473,13 @@ int dm_stats_bind_uuid(struct dm_stats *dms, const char *uuid);
  */
 int dm_message_supports_precise_timestamps(void);
 
+/*
+ * Precise timetamps support.
+ * 
+ * Test for the presence of precise_timestamps support.
+ */
+int dm_stats_driver_supports_precise(void);
+
 #define DM_STATS_ALL_PROGRAMS ""
 /*
  * Parse the response from a @stats_list message. dm_stats_list will
@@ -535,6 +542,9 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
  *
  *   dm_stats_create_region(dms, 1024, 1 << 11, -2, p, a);
  *
+ * If precise is non-zero attempt to create a region with nanosecond
+ * precision counters using the kernel precise_timestamps feature.
+ *
  * program_id is an optional string argument that identifies the
  * program creating the region. If program_id is NULL or the empty
  * string the default program_id stored in the handle will be used.
@@ -548,6 +558,7 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
  */
 int dm_stats_create_region(struct dm_stats *dms, uint64_t *region_id,
 			   uint64_t start, uint64_t len, int64_t step,
+			   int precise,
 			   const char *program_id, const char *aux_data);
 
 /*
libdm/libdm-stats.c +128 -27

230 lines not on this page · raw message

tools/dmsetup.c +1 -0
index 45d4173..b8376dd 100644
@@ -4520,6 +4520,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,
+						    -1,
 						    program_id, aux_data)) {
 				log_error("%s: Could not create statistics region.",
 					  devname);