projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Export consumer ABI, implement ring buffer modifications for consumer
[lttng-ust.git]
/
libust
/
ltt-ring-buffer-metadata-client.h
diff --git
a/libust/ltt-ring-buffer-metadata-client.h
b/libust/ltt-ring-buffer-metadata-client.h
index 8b1079d98c7c930dced941601533b9a407a272d1..fa79485c98634d4892ef45c9199a0764add004f6 100644
(file)
--- a/
libust/ltt-ring-buffer-metadata-client.h
+++ b/
libust/ltt-ring-buffer-metadata-client.h
@@
-8,11
+8,11
@@
* Dual LGPL v2.1/GPL v2 license.
*/
* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/module.h>
-#include <linux/types.h>
-#include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
-#include "ltt-events.h"
+#include <stdint.h>
+#include <ust/lttng-events.h>
+#include "ust/bitfield.h"
#include "ltt-tracer.h"
#include "ltt-tracer.h"
+#include "../libringbuffer/frontend_types.h"
struct metadata_packet_header {
uint32_t magic; /* 0x75D11D57 */
struct metadata_packet_header {
uint32_t magic; /* 0x75D11D57 */
@@
-47,7
+47,7
@@
unsigned char record_header_size(const struct lib_ring_buffer_config *config,
return 0;
}
return 0;
}
-#include "
wrapper/
ringbuffer/api.h"
+#include "
../lib
ringbuffer/api.h"
static u64 client_ring_buffer_clock_read(struct channel *chan)
{
static u64 client_ring_buffer_clock_read(struct channel *chan)
{
@@
-76,18
+76,20
@@
static size_t client_packet_header_size(void)
}
static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc,
}
static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc,
- unsigned int subbuf_idx)
+ unsigned int subbuf_idx,
+ struct shm_handle *handle)
{
{
- struct channel *chan =
buf->backend.chan
;
+ struct channel *chan =
shmp(handle, buf->backend.chan)
;
struct metadata_packet_header *header =
(struct metadata_packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
struct metadata_packet_header *header =
(struct metadata_packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
- subbuf_idx * chan->backend.subbuf_size);
+ subbuf_idx * chan->backend.subbuf_size,
+ handle);
struct ltt_channel *ltt_chan = channel_get_private(chan);
struct ltt_session *session = ltt_chan->session;
header->magic = TSDL_MAGIC_NUMBER;
struct ltt_channel *ltt_chan = channel_get_private(chan);
struct ltt_session *session = ltt_chan->session;
header->magic = TSDL_MAGIC_NUMBER;
- memcpy(header->uuid, session->uuid
.b
, sizeof(session->uuid));
+ memcpy(header->uuid, session->uuid, sizeof(session->uuid));
header->checksum = 0; /* 0 if unused */
header->content_size = 0xFFFFFFFF; /* in bits, for debugging */
header->packet_size = 0xFFFFFFFF; /* in bits, for debugging */
header->checksum = 0; /* 0 if unused */
header->content_size = 0xFFFFFFFF; /* in bits, for debugging */
header->packet_size = 0xFFFFFFFF; /* in bits, for debugging */
@@
-101,13
+103,15
@@
static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc,
* subbuffer. data_size is between 1 and subbuf_size.
*/
static void client_buffer_end(struct lib_ring_buffer *buf, u64 tsc,
* subbuffer. data_size is between 1 and subbuf_size.
*/
static void client_buffer_end(struct lib_ring_buffer *buf, u64 tsc,
- unsigned int subbuf_idx, unsigned long data_size)
+ unsigned int subbuf_idx, unsigned long data_size,
+ struct shm_handle *handle)
{
{
- struct channel *chan =
buf->backend.chan
;
+ struct channel *chan =
shmp(handle, buf->backend.chan)
;
struct metadata_packet_header *header =
(struct metadata_packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
struct metadata_packet_header *header =
(struct metadata_packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
- subbuf_idx * chan->backend.subbuf_size);
+ subbuf_idx * chan->backend.subbuf_size,
+ handle);
unsigned long records_lost = 0;
header->content_size = data_size * CHAR_BIT; /* in bits */
unsigned long records_lost = 0;
header->content_size = data_size * CHAR_BIT; /* in bits */
@@
-119,12
+123,15
@@
static void client_buffer_end(struct lib_ring_buffer *buf, u64 tsc,
}
static int client_buffer_create(struct lib_ring_buffer *buf, void *priv,
}
static int client_buffer_create(struct lib_ring_buffer *buf, void *priv,
- int cpu, const char *name)
+ int cpu, const char *name,
+ struct shm_handle *handle)
{
return 0;
}
{
return 0;
}
-static void client_buffer_finalize(struct lib_ring_buffer *buf, void *priv, int cpu)
+static void client_buffer_finalize(struct lib_ring_buffer *buf,
+ void *priv, int cpu,
+ struct shm_handle *handle)
{
}
{
}
@@
-142,45
+149,57
@@
static const struct lib_ring_buffer_config client_config = {
.sync = RING_BUFFER_SYNC_GLOBAL,
.mode = RING_BUFFER_MODE_TEMPLATE,
.backend = RING_BUFFER_PAGE,
.sync = RING_BUFFER_SYNC_GLOBAL,
.mode = RING_BUFFER_MODE_TEMPLATE,
.backend = RING_BUFFER_PAGE,
- .output = RING_BUFFER_
SPLICE
,
+ .output = RING_BUFFER_
MMAP
,
.oops = RING_BUFFER_OOPS_CONSISTENCY,
.oops = RING_BUFFER_OOPS_CONSISTENCY,
- .ipi = RING_BUFFER_IPI_BARRIER,
- .wakeup = RING_BUFFER_WAKEUP_BY_
TIM
ER,
+ .ipi = RING_BUFFER_
NO_
IPI_BARRIER,
+ .wakeup = RING_BUFFER_WAKEUP_BY_
WRIT
ER,
};
static
};
static
-struct channel *_channel_create(const char *name,
+struct
ltt_
channel *_channel_create(const char *name,
struct ltt_channel *ltt_chan, void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
struct ltt_channel *ltt_chan, void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
- unsigned int read_timer_interval)
+ unsigned int read_timer_interval,
+ int *shm_fd, int *wait_fd,
+ uint64_t *memory_map_size)
{
{
-
return
channel_create(&client_config, name, ltt_chan, buf_addr,
+
ltt_chan->handle =
channel_create(&client_config, name, ltt_chan, buf_addr,
subbuf_size, num_subbuf, switch_timer_interval,
subbuf_size, num_subbuf, switch_timer_interval,
- read_timer_interval);
+ read_timer_interval, shm_fd, wait_fd,
+ memory_map_size);
+ if (!ltt_chan->handle)
+ return NULL;
+ ltt_chan->chan = shmp(ltt_chan->handle, ltt_chan->handle->chan);
+ return ltt_chan;
}
static
}
static
-void ltt_channel_destroy(struct
channel *
chan)
+void ltt_channel_destroy(struct
ltt_channel *ltt_
chan)
{
{
- channel_destroy(
chan
);
+ channel_destroy(
ltt_chan->chan, ltt_chan->handle
);
}
static
}
static
-struct lib_ring_buffer *ltt_buffer_read_open(struct channel *chan)
+struct lib_ring_buffer *ltt_buffer_read_open(struct channel *chan,
+ struct shm_handle *handle,
+ int *shm_fd, int *wait_fd,
+ uint64_t *memory_map_size)
{
struct lib_ring_buffer *buf;
{
struct lib_ring_buffer *buf;
- buf = channel_get_ring_buffer(&client_config, chan, 0);
- if (!lib_ring_buffer_open_read(buf))
+ buf = channel_get_ring_buffer(&client_config, chan,
+ 0, handle, shm_fd, wait_fd, memory_map_size);
+ if (!lib_ring_buffer_open_read(buf, handle))
return buf;
return NULL;
}
static
return buf;
return NULL;
}
static
-void ltt_buffer_read_close(struct lib_ring_buffer *buf)
+void ltt_buffer_read_close(struct lib_ring_buffer *buf,
+ struct shm_handle *handle)
{
{
- lib_ring_buffer_release_read(buf);
+ lib_ring_buffer_release_read(buf
, handle
);
}
static
}
static
@@
-203,13
+222,13
@@
void ltt_event_write(struct lib_ring_buffer_ctx *ctx, const void *src,
}
static
}
static
-size_t ltt_packet_avail_size(struct channel *chan)
+size_t ltt_packet_avail_size(struct channel *chan
, struct shm_handle *handle
)
{
unsigned long o_begin;
struct lib_ring_buffer *buf;
{
unsigned long o_begin;
struct lib_ring_buffer *buf;
- buf =
chan->backend.buf;
/* Only for global buffer ! */
+ buf =
shmp(handle, chan->backend.buf[0].shmp);
/* Only for global buffer ! */
o_begin = v_read(&client_config, &buf->offset);
if (subbuf_offset(o_begin, chan) != 0) {
return chan->backend.subbuf_size - subbuf_offset(o_begin, chan);
o_begin = v_read(&client_config, &buf->offset);
if (subbuf_offset(o_begin, chan) != 0) {
return chan->backend.subbuf_size - subbuf_offset(o_begin, chan);
@@
-219,6
+238,7
@@
size_t ltt_packet_avail_size(struct channel *chan)
}
}
}
}
+#if 0
static
wait_queue_head_t *ltt_get_reader_wait_queue(struct channel *chan)
{
static
wait_queue_head_t *ltt_get_reader_wait_queue(struct channel *chan)
{
@@
-230,6
+250,7
@@
wait_queue_head_t *ltt_get_hp_wait_queue(struct channel *chan)
{
return &chan->hp_wait;
}
{
return &chan->hp_wait;
}
+#endif //0
static
int ltt_is_finalized(struct channel *chan)
static
int ltt_is_finalized(struct channel *chan)
@@
-244,8
+265,7
@@
int ltt_is_disabled(struct channel *chan)
}
static struct ltt_transport ltt_relay_transport = {
}
static struct ltt_transport ltt_relay_transport = {
- .name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING,
- .owner = THIS_MODULE,
+ .name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING "-mmap",
.ops = {
.channel_create = _channel_create,
.channel_destroy = ltt_channel_destroy,
.ops = {
.channel_create = _channel_create,
.channel_destroy = ltt_channel_destroy,
@@
-255,36
+275,21
@@
static struct ltt_transport ltt_relay_transport = {
.event_commit = ltt_event_commit,
.event_write = ltt_event_write,
.packet_avail_size = ltt_packet_avail_size,
.event_commit = ltt_event_commit,
.event_write = ltt_event_write,
.packet_avail_size = ltt_packet_avail_size,
- .get_reader_wait_queue = ltt_get_reader_wait_queue,
- .get_hp_wait_queue = ltt_get_hp_wait_queue,
+
//
.get_reader_wait_queue = ltt_get_reader_wait_queue,
+
//
.get_hp_wait_queue = ltt_get_hp_wait_queue,
.is_finalized = ltt_is_finalized,
.is_disabled = ltt_is_disabled,
},
};
.is_finalized = ltt_is_finalized,
.is_disabled = ltt_is_disabled,
},
};
-
static int __init ltt_ring_buffer_client_init
(void)
+
void RING_BUFFER_MODE_TEMPLATE_INIT
(void)
{
{
- /*
- * This vmalloc sync all also takes care of the lib ring buffer
- * vmalloc'd module pages when it is built as a module into LTTng.
- */
- wrapper_vmalloc_sync_all();
- printk(KERN_INFO "LTT : ltt ring buffer metadata client init\n");
+ DBG("LTT : ltt ring buffer client init\n");
ltt_transport_register(<t_relay_transport);
ltt_transport_register(<t_relay_transport);
- return 0;
}
}
-module_init(ltt_ring_buffer_client_init);
-
-static void __exit ltt_ring_buffer_client_exit(void)
+void RING_BUFFER_MODE_TEMPLATE_EXIT(void)
{
{
-
printk(KERN_INFO "LTT : ltt ring buffer metadata
client exit\n");
+
DBG("LTT : ltt ring buffer
client exit\n");
ltt_transport_unregister(<t_relay_transport);
}
ltt_transport_unregister(<t_relay_transport);
}
-
-module_exit(ltt_ring_buffer_client_exit);
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("LTTng ring buffer " RING_BUFFER_MODE_TEMPLATE_STRING
- " client");
This page took
0.027124 seconds
and
4
git commands to generate.