1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: add dm_message_supports_precise_timestamps()

Add a function to test whether the kernel precise_timestamps
feature is available in the current device-mapper driver version.

Presence of precise_timestamps also implies the availability of
latency histograms.
This commit is contained in:
Bryn M. Reeves 2015-08-18 16:37:03 +01:00
parent 62a87c84ed
commit 386e91addb
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1 @@
dm_message_supports_precise_timestamps

View File

@ -604,6 +604,20 @@ static int dm_inactive_supported(void)
return inactive_supported;
}
int dm_message_supports_precise_timestamps(void)
{
/*
* 4.32.0 supports "precise_timestamps" and "histogram:" options
* to @stats_create messages but lacks the ability to report
* these properties via a subsequent @stats_list: require at
* least 4.33.0 in order to use these features.
*/
if (dm_check_version() && _dm_version >= 4)
if (_dm_version_minor >= 33)
return 1;
return 0;
}
void *dm_get_next_target(struct dm_task *dmt, void *next,
uint64_t *start, uint64_t *length,
char **target_type, char **params)

View File

@ -464,6 +464,15 @@ int dm_stats_bind_name(struct dm_stats *dms, const char *name);
*/
int dm_stats_bind_uuid(struct dm_stats *dms, const char *uuid);
/*
* Test whether the running kernel supports the precise_timestamps
* feature. Presence of this feature also implies histogram support.
* The library will check this call internally and fails any attempt
* to use nanosecond counters or histograms on kernels that fail to
* meet this check.
*/
int dm_message_supports_precise_timestamps(void);
#define DM_STATS_ALL_PROGRAMS ""
/*
* Parse the response from a @stats_list message. dm_stats_list will