[lttng-dev] LTTng live viewer development

Evgeniy Osipov Evgeniy.Osipov at itiviti.com
Fri Sep 30 14:26:44 UTC 2016


Hi there!

I’m quite new to LTTng live technology and I need to create some kind of live LTTng events handling utility. Looking at babeltrace git repository I’ve found that there is a special format “lttng-live” and some lttng-live-plugin that could be easily used in my own viewer, for example:

struct bt_context * ctx = bt_context_create();
int handle_id = bt_context_add_trace(ctx, "net://127.0.0.1:5344/host/blah-blah-blah", "lttng-live", NULL, NULL, NULL);

These lines enters infinite loop reading live LTTng data and prints out every single LTTng tracing event on a screen with use of “ctf-text” format module.

Could you please recommend me the best way how to implement LTTng live events handling utility?
Is it possible to make use of “lttng-live” module to call my own “struct bt_ctf_event” event handler somehow?


Also, one thing that I’ve found while using ‘jemalloc' allocator is that code in file babeltrace/formats/lttng-live/lttng-live-plugin.c leads to memory double free:

static int lttng_live_open_trace_read(const char *path)
{
…
end_free:
    g_hash_table_destroy(ctx->session->ctf_traces);
    g_free(ctx->session);
    g_free(ctx->session->streams);
    g_free(ctx);

    if (lttng_live_should_quit()) {
        ret = 0;
    }
    return ret;
}

Changing order of lines "g_free(ctx->session);” and “g_free(ctx->session->streams);” fixes it:

static int lttng_live_open_trace_read(const char *path)
{
…
end_free:
    g_hash_table_destroy(ctx->session->ctf_traces);
    g_free(ctx->session->streams);
    g_free(ctx->session);
    g_free(ctx);

    if (lttng_live_should_quit()) {
        ret = 0;
    }
    return ret;
}



Thanks in advance!

Evgeniy Osipov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20160930/f0b159e4/attachment.html>


More information about the lttng-dev mailing list