X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fkernel-ctl%2Fkernel-ctl.c;h=d153a1cff7dafbbc3460f7aac1baae55042263fd;hp=b45efd0efa1dc7e6b5e8520419d9f7f6dff99ebd;hb=aa3514e96f12c13f681a81ea275dc51dd63473c8;hpb=f853c53a00da0640403f536fc5bfc9146baf200c diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c index b45efd0ef..d153a1cff 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.c @@ -99,7 +99,7 @@ int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops) channel.switch_timer_interval = chops->switch_timer_interval; channel.read_timer_interval = chops->read_timer_interval; channel.output = chops->output; - memcpy(channel.padding, chops->padding, sizeof(channel.padding)); + memcpy(channel.padding, chops->padding, sizeof(chops->padding)); return ioctl(fd, LTTNG_KERNEL_METADATA, &channel); } @@ -134,7 +134,7 @@ int kernctl_create_channel(int fd, struct lttng_channel_attr *chops) channel.switch_timer_interval = chops->switch_timer_interval; channel.read_timer_interval = chops->read_timer_interval; channel.output = chops->output; - memcpy(channel.padding, chops->padding, sizeof(channel.padding)); + memcpy(channel.padding, chops->padding, sizeof(chops->padding)); return ioctl(fd, LTTNG_KERNEL_CHANNEL, &channel); } @@ -188,7 +188,7 @@ int kernctl_add_context(int fd, struct lttng_kernel_context *ctx) old_ctx.ctx = ctx->ctx; /* only type that uses the union */ - if (ctx->ctx == LTTNG_KERNEL_CONTEXT_PERF_COUNTER) { + if (ctx->ctx == LTTNG_KERNEL_CONTEXT_PERF_CPU_COUNTER) { old_ctx.u.perf_counter.type = ctx->u.perf_counter.type; old_ctx.u.perf_counter.config = @@ -390,3 +390,45 @@ int kernctl_put_subbuf(int fd) { return ioctl(fd, RING_BUFFER_PUT_SUBBUF); } + +/* Returns the timestamp begin of the current sub-buffer. */ +int kernctl_get_timestamp_begin(int fd, uint64_t *timestamp_begin) +{ + return ioctl(fd, LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN, timestamp_begin); +} + +/* Returns the timestamp end of the current sub-buffer. */ +int kernctl_get_timestamp_end(int fd, uint64_t *timestamp_end) +{ + return ioctl(fd, LTTNG_RING_BUFFER_GET_TIMESTAMP_END, timestamp_end); +} + +/* Returns the number of discarded events in the current sub-buffer. */ +int kernctl_get_events_discarded(int fd, uint64_t *events_discarded) +{ + return ioctl(fd, LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED, events_discarded); +} + +/* Returns the content size in the current sub-buffer. */ +int kernctl_get_content_size(int fd, uint64_t *content_size) +{ + return ioctl(fd, LTTNG_RING_BUFFER_GET_CONTENT_SIZE, content_size); +} + +/* Returns the packet size in the current sub-buffer. */ +int kernctl_get_packet_size(int fd, uint64_t *packet_size) +{ + return ioctl(fd, LTTNG_RING_BUFFER_GET_PACKET_SIZE, packet_size); +} + +/* Returns the stream id of the current sub-buffer. */ +int kernctl_get_stream_id(int fd, uint64_t *stream_id) +{ + return ioctl(fd, LTTNG_RING_BUFFER_GET_STREAM_ID, stream_id); +} + +/* Returns the current timestamp. */ +int kernctl_get_current_timestamp(int fd, uint64_t *ts) +{ + return ioctl(fd, LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP, ts); +}