dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [PATCH] dm-statistics: report precise timestamps and histogram
@ 2015-08-18 20:26 Mikulas Patocka
  2015-08-18 21:07 ` Mike Snitzer
  2015-08-19  8:43 ` [PATCH] " Bryn M. Reeves
  0 siblings, 2 replies; 12+ messages in thread
From: Mikulas Patocka @ 2015-08-18 20:26 UTC (permalink / raw)
  To: Alasdair G. Kergon, Bryn Reeves, Mike Snitzer; +Cc: dm-devel

Mike, please submit this patch to the upstream kernel before 4.2 is 
released, so that the all the kernels that support the options 
"precise_timestamps" and "histogram" also report these values back.


From: Mikulas Patocka <mpatocka@redhat.com>

If the user selected precise timestamps or histogram, report it in the
output of the @stats_list message.

If the user didn't select these options, no extra tokens are reported,
thus it is backward compatible with old software that doesn't know about
precise timestamps and histogram.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

Index: linux-4.1.5/Documentation/device-mapper/statistics.txt
===================================================================
--- linux-4.1.5.orig/Documentation/device-mapper/statistics.txt
+++ linux-4.1.5/Documentation/device-mapper/statistics.txt
@@ -118,6 +118,10 @@ Messages
 
 	Output format:
 	  <region_id>: <start_sector>+<length> <step> <program_id> <aux_data>
+	  	precise_timestamps histogram:n1,n2,n3,...
+
+	The strings "precise_timestamps" and "histogram" are printed only
+	if they were specified when creating the region.
 
     @stats_print <region_id> [<starting_line> <number_of_lines>]
 
Index: linux-4.1.5/drivers/md/dm-stats.c
===================================================================
--- linux-4.1.5.orig/drivers/md/dm-stats.c
+++ linux-4.1.5/drivers/md/dm-stats.c
@@ -453,12 +453,24 @@ static int dm_stats_list(struct dm_stats
 	list_for_each_entry(s, &stats->list, list_entry) {
 		if (!program || !strcmp(program, s->program_id)) {
 			len = s->end - s->start;
-			DMEMIT("%d: %llu+%llu %llu %s %s\n", s->id,
+			DMEMIT("%d: %llu+%llu %llu %s %s", s->id,
 				(unsigned long long)s->start,
 				(unsigned long long)len,
 				(unsigned long long)s->step,
 				s->program_id,
 				s->aux_data);
+			if (s->stat_flags & STAT_PRECISE_TIMESTAMPS)
+				DMEMIT(" precise_timestamps");
+			if (s->n_histogram_entries) {
+				unsigned i;
+				DMEMIT(" histogram:");
+				for (i = 0; i < s->n_histogram_entries; i++) {
+					if (i)
+						DMEMIT(",");
+					DMEMIT("%llu", s->histogram_boundaries[i]);
+				}
+			}
+			DMEMIT("\n");
 		}
 	}
 	mutex_unlock(&stats->mutex);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-08-21  7:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-18 20:26 [PATCH] dm-statistics: report precise timestamps and histogram Mikulas Patocka
2015-08-18 21:07 ` Mike Snitzer
2015-08-18 21:41   ` Mike Snitzer
2015-08-19  8:48     ` Bryn M. Reeves
2015-08-19 10:50       ` Mikulas Patocka
2015-08-19 10:52         ` Bryn M. Reeves
2015-08-19 10:53   ` Mikulas Patocka
2015-08-19 11:11     ` Bryn M. Reeves
2015-08-19 13:03       ` Mike Snitzer
2015-08-20 19:40       ` Mikulas Patocka
2015-08-21  7:58         ` Bryn M. Reeves
2015-08-19  8:43 ` [PATCH] " Bryn M. Reeves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).