From 8024cc8c4f2b6b0413b2e8d5b5bf01024a91a337 Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Mon, 11 Dec 2017 16:58:51 -0500 Subject: [PATCH] Support to dump the kernel metadata cache from the beginning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit On demand, the consumer can ask for the kernel tracer to dump the content of the metadata cache (depends on lttng-modules 2.11). This allows to extract the exact same metadata (compared to regenerating it which could change the epoch offset). Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- src/common/kernel-ctl/kernel-ctl.c | 4 ++++ src/common/kernel-ctl/kernel-ctl.h | 1 + src/common/kernel-ctl/kernel-ioctl.h | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c index 6a256fefd..a495ca9b7 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.c @@ -419,6 +419,10 @@ int kernctl_get_metadata_version(int fd, uint64_t *version) return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_GET_METADATA_VERSION, version); } +int kernctl_metadata_cache_dump(int fd) +{ + return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_METADATA_CACHE_DUMP); +} /* Buffer operations */ diff --git a/src/common/kernel-ctl/kernel-ctl.h b/src/common/kernel-ctl/kernel-ctl.h index d88f5e765..fbb273190 100644 --- a/src/common/kernel-ctl/kernel-ctl.h +++ b/src/common/kernel-ctl/kernel-ctl.h @@ -95,6 +95,7 @@ int kernctl_put_subbuf(int fd); int kernctl_buffer_flush(int fd); int kernctl_buffer_flush_empty(int fd); int kernctl_get_metadata_version(int fd, uint64_t *version); +int kernctl_metadata_cache_dump(int fd); /* index */ int kernctl_get_timestamp_begin(int fd, uint64_t *timestamp_begin); diff --git a/src/common/kernel-ctl/kernel-ioctl.h b/src/common/kernel-ctl/kernel-ioctl.h index 3c4f4129e..4ab0eabbc 100644 --- a/src/common/kernel-ctl/kernel-ioctl.h +++ b/src/common/kernel-ctl/kernel-ioctl.h @@ -59,6 +59,11 @@ #define RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS _IO(0xF6, 0x0E) /* Flush the current sub-buffer, even if empty. */ #define RING_BUFFER_FLUSH_EMPTY _IO(0xF6, 0x0F) +/* + * Reset the position of what has been consumed from the metadata cache to 0 + * so it can be read again. + */ +#define RING_BUFFER_METADATA_CACHE_DUMP _IO(0xF6, 0x10) /* returns the timestamp begin of the current sub-buffer */ #define LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t) -- 2.34.1