1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00
Commit Graph

295 Commits

Author SHA1 Message Date
Bryn M. Reeves
837e7e513b dmstats: allow --statstype to override report defults 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
a2bf3c6ee8 dmstats: report a list of members as a group's region_id
Instead of '-' print the member list in range notation (as stored
in aux_data).
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
ca0a4cecec dmstats: report groups and region summaries
Walk avaiable groups and regions (in addition to areas) and report
aggregate statistics and properties.

A new switch is added to filter the type of obects inclued in the
report:

  --statstype={all,area,region,group}

The type of the current row is also available in a new
DR_STATS_META field 'type'.
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
8b179e09a4 dmstats: do not walk regions if deleting a single id 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
402d840aa7 dmstats: add stats_name field
To allow the names used to describe statistics report objects to
change (for e.g to support groups and region and group aliases)
introduce a new "stats_name" field that evaluates to the correct
name for the object being reported.
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
b55daa28e8 dmstats: add group alias support 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
0761863e28 dmstats: add 'group' and 'ungroup' commands
Add a pair of commands to create and delete stats groups:

  dmstats group --regions REGIONS

  dmstats ungroup --groupid ID

REGIONS specifies a list of regions to be included in the group.
Regions are specified as a comma separated list in order of
increasing region ID. Ranges may be specified as a hypen separated
pair of values giving the first and last member of the range.
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
b4cbc8f283 dmstats: add group_id report field type 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
52be93c54b dmsetup: fix timestamp leak
With a single report (--count=1) no timerfd is set up and the cycle
and current timestamps should be freed during the single call to
_update_interval_times().
2016-07-04 12:16:51 +01:00
Bryn M. Reeves
62dce13c7a dmstats: fix RgStart and RgSize field widths 2016-07-04 12:16:51 +01:00
Zdenek Kabelac
a9634e993a coverity: check cmd pointer exists
Since in _report_init() we check few times for cmd != NULL
keep it consistent and Coverity happier.
2016-02-23 21:40:16 +01:00
Zdenek Kabelac
fcbef05aae doc: change fsf address
Hmm rpmlint suggest fsf is using a different address these days,
so lets keep it up-to-date
2016-01-21 12:11:37 +01:00
Zdenek Kabelac
6c331f3061 dmsetup: one missed dms 2015-11-09 17:04:10 +01:00
Zdenek Kabelac
84a9546869 dmsetup: cleanup warn for older compilers
Older gcc somehow thinks there is a path of using
subcommand uninitilized.

So make it more obvious there is no such one.
2015-11-09 12:21:17 +01:00
Zdenek Kabelac
c542c18d2a cleanup: drop unneded assign
Coverity doesn't really like to see subcommand being assigned NULL,
so drop it.
2015-11-09 10:22:51 +01:00
Zdenek Kabelac
297d6773af dmsetup: add missing checks for dm_stats_create() ret value
Coverity likes to see a check for dms not being NULL, so
add those missing ones...
2015-11-09 10:19:19 +01:00
Zdenek Kabelac
e90c5d2060 dmsetup: check for NULL from dm_task_get_ioctl_timestamp
Coverity: ensure NULL is not passed to dm_timestamp_delta().
2015-11-09 10:19:19 +01:00
Zdenek Kabelac
f9c8cefd06 dmsetup: improve help text
Document more options.
2015-09-18 17:45:45 +02:00
Zdenek Kabelac
791e76ff70 dmsetup: use noflush with force removal
When user specifies '--force' with remove/remove_all/wipe_table
use '--noflush --nolockfs' resume flags, so the operation
will not block when device underneath is blocked.
2015-09-18 17:45:45 +02:00
Bryn M. Reeves
a26523330e dmsetup: fix bounds leak in _do_stats_create_regions()
If we fail to create the DM_DEVICE_TABLE dm_task destroy the bounds
object before returning.
2015-09-07 11:14:28 +01:00
Alasdair G Kergon
fb12308416 style: Standardise some error paths. 2015-09-05 23:56:30 +01:00
Bryn M. Reeves
cebbb0feaf dmstats: replace histogram command with switch
Replace the histogram stats subcommand with a --histogram switch
to enable histogram related fields for both list and report output.

To avoid overloading the existing --histogram rename it to --bounds:
this is also a better description of the option.
2015-09-03 23:39:11 +01:00
Bryn M. Reeves
49b5022993 dmstats: support --noheadings for histogram fields 2015-09-03 22:04:11 +01:00
Bryn M. Reeves
84d88cb2cf dmstats: add --notimesuffix switch
Add a switch to disable the printing of time unit suffixes in
histogram bounds descriptions.
2015-09-03 22:04:10 +01:00
Bryn M. Reeves
031cd2bb0d dmstats: improve stats column names
Improve the names and labels of stats reports columns, ensure that
the minimum field widths allow unambiguos labels to be shown and
update the man page descriptions of these fields.
2015-09-02 21:03:03 +01:00
Bryn M. Reeves
3c0fc6f0da dmstats: add histogram support
Add support to dmstats to create and report histograms.

Add a --histogram switch to 'create' that accepts a string
description of bin boundaries and DR_STATS and DR_STATS_META fields
to report bin configuration and absolute and relative histogram
values:

  hist_bins
  hist_bounds
  hist_ranges
  hist_count
  hist_count_bounds
  hist_count_ranges
  hist_percent
  hist_percent_bounds
  hist_percent_ranges

A new 'histogram' subcommand displays a report that emphasizes
histogram data as either counters or percentage values.
2015-09-02 21:02:12 +01:00
Bryn M. Reeves
a0cf3d47f1 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.
2015-09-02 20:48:59 +01:00
Bryn M. Reeves
463f59eca4 dmstats: add 'precise' flag field to stats report
Add a flag indicating whether or not precise_timestamps are enabled for
a given region or area.
2015-08-24 20:03:21 +01:00
Bryn M. Reeves
e4145ebc47 dmstats: add --precise switch to enable nanosecond counters. 2015-08-24 20:03:21 +01:00
Bryn M. Reeves
f4262026b6 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.
2015-08-24 20:03:21 +01:00
Zdenek Kabelac
ef7264807f cleanup: log_debug format matches args 2015-08-18 16:05:04 +02:00
Zdenek Kabelac
58f8f29c41 cleanup: add FMTssize_t
Add define to print nicely ssize_t type.
2015-08-18 15:00:08 +02:00
Bryn M. Reeves
8e229cb7ea dmstats: reduce minimum field widths 2015-08-18 10:30:53 +01:00
Bryn M. Reeves
13d3eeb2ee dmstats: fix type formatting
Fix several instances of 'const char * const*' to be:

  'const char * const *'
2015-08-18 10:30:53 +01:00
Bryn M. Reeves
12acf852c5 dmsetup: check timerfd reads for valid byte count (Coverity)
The timerfd guarantees that it will return 8 bytes when a read(2)
is issued (a uint64_t giving the number of timer events during the
call). Check that it does so and log a non-fatal error if the byte
count is not 8.
2015-08-17 19:28:53 +01:00
Bryn M. Reeves
69fa16048a dmstats: check for zero in _nr_areas_from_step() (Coverity) 2015-08-17 18:37:16 +01:00
Bryn M. Reeves
b01e9651b0 dmsetup: make sure subcommand is initialised (Coverity) 2015-08-17 18:37:16 +01:00
Zdenek Kabelac
94c56559ca dmsetup: fix usage of ifdefs 2015-08-17 15:52:06 +02:00
Bryn M. Reeves
4a6d5e2012 dmstats: fix --length argument
Commit f10ad95 introduced a regression causing the size of regions
passed in on the command line to be truncated to zero. Initialise
the 'this_len' variable to the supplied length to correct this.
2015-08-15 18:35:10 +01:00
Bryn M. Reeves
9d5cd4ca14 dmstats: fix new area count for 'create --areasize'
Commit f10ad95 introduced a regression in the calculation of the
number of areas in a region created with the --areasize switch:

vg_hex-lv_home: Created new region with 0 area(s) as region ID 1
vg_hex-lv_swap: Created new region with 0 area(s) as region ID 1

Fis this by using the correct region size when calculating the
value.
2015-08-15 00:42:51 +01:00
Bryn M. Reeves
0b487802a0 dmstats: change region fields prefix to 'region_' 2015-08-14 23:53:42 +01:00
Bryn M. Reeves
f3891e90e3 dmstats: make -v enable per area reports for 'stats list'
When dmstats is run with -v or higher enable a per-area reporting
mode for statistics regions. This will output one row per area
(rather than one row per region) and adds additional fields of use
when viewing areas:

 area_id    - index within the region assigned by libdm-stats
 area_start - the start location of the area in the containing
              device.
2015-08-14 22:03:37 +01:00
Bryn M. Reeves
0f3b81bb2e dmstats: add 'area_offset' field to stats reports 2015-08-14 22:03:37 +01:00
Bryn M. Reeves
16ff2d927f dmsetup: add support for 'stats report --raw'
Add a '--raw' switch to stats reports that causes us to report the
basic counter values rather than derived metrics for each visible
statistics region.
2015-08-14 22:03:37 +01:00
Bryn M. Reeves
fc7a27bc3d dmsetup: add prefixes for all report types
Add prefixes to all dmsetup report types to allow the 'group_all'
option to be effective:

  DR_NAME       name_
  DR_INFO       info_
  DR_DEPS       deps_
  DR_TREE       tree_
  DR_NAME       splitname_
2015-08-14 22:03:37 +01:00
Bryn M. Reeves
666722324f dmstats: add 'stat_' prefix to stats report columns 2015-08-14 22:03:37 +01:00
Bryn M. Reeves
8852b25fc7 dmsetup: do not track moving average for interval estimate
When run with full verbosity dmsetup or dmstats reports will
output a figure that tracks a moving average over a window of the
last two intervals:

Interval     #3        time delta:    999991087ns
Interval     #3     mean duration:    999907064ns, current err: -8913ns
End interval #3          duration:    999991087ns
Adjusted sample interval duration:    999991087ns

Due to the narrow window this is a very crude estimate and is only
of use to someone debugging or modifying the stats clock: remove
the value and the global variables used to track it.

Anyone with a particular use for this information can construct a
better mean by calculating the value of a greater number of
intervals.
2015-08-14 13:55:26 +01:00
Bryn M. Reeves
e6724f0303 dmstats: make 'dmstats list' use common report infrastructure
Unlike 'info -c' and 'stats report' the 'dmstats list' subcommand
does its own report processing. This complicates the handling of
the DR_STATS and DR_STATS_META fields and leads to inconsistent
behaviour between the different commands. In particular it causes
'stats list' to segfault when using 'all' field options:

Segmentation fault (core dumped)

Delete _stats_list() entirely and adapt _stats_report so that it
can correctly format a DR_STATS_META-only report request.

This requires passing the subcommand into _report_init() where it
is used in addition to the command name to select the default set
of report fields for the 'list' and 'report' stats subcommands.

With this change both 'list' and 'report' dmstats report will use
the correct report object type and ensure that it is initialised
appropriately for the field selection in use.
2015-08-14 13:43:12 +01:00
Bryn M. Reeves
37dd26e322 dmstats: separate stats meta fields into their own report type
Although statistics and meta fields (region and area properties) share
the same object type the state of the handle they expect differs: meta
only expects a dm_stats_list() operation to have been performed whereas
statistics require a fully populated handle.

Distinguish between these requirements by separating the fields into
two distinct report types:

  DR_STATS = 32,
  DR_STATS_META = 64

The new category is described as "Mapped Device Statistics Region
Information" in the help text.
2015-08-14 13:43:03 +01:00
Bryn M. Reeves
f10ad95c36 dmstats: cleanup _do_stats_create_regions()
Make the use of the this_start and this_len variables easier to
follow and clarify the use of zero start and len arguments to
request a whole-device region.
2015-08-14 13:36:52 +01:00