projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: remove test_ctf_writer_clock.py
[babeltrace.git]
/
src
/
plugins
/
ctf
/
lttng-live
/
metadata.c
diff --git
a/src/plugins/ctf/lttng-live/metadata.c
b/src/plugins/ctf/lttng-live/metadata.c
index decae60ec5df21b2eb51330b7b3cace7ca589364..0061565ee219c3e20851d84f00810f61a506fccd 100644
(file)
--- a/
src/plugins/ctf/lttng-live/metadata.c
+++ b/
src/plugins/ctf/lttng-live/metadata.c
@@
-24,9
+24,10
@@
* SOFTWARE.
*/
* SOFTWARE.
*/
+#define BT_COMP_LOG_SELF_COMP self_comp
#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/SRC.CTF.LTTNG-LIVE/META"
#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/SRC.CTF.LTTNG-LIVE/META"
-#include "logging/
lo
g.h"
+#include "logging/
comp-loggin
g.h"
#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
#include <stdint.h>
@@
-38,6
+39,7
@@
#include "metadata.h"
#include "../common/metadata/decoder.h"
#include "metadata.h"
#include "../common/metadata/decoder.h"
+#include "../common/metadata/ctf-meta-configure-ir-trace.h"
#define TSDL_MAGIC 0x75d11d57
#define TSDL_MAGIC 0x75d11d57
@@
-57,7
+59,8
@@
struct packet_header {
static
bool stream_classes_all_have_default_clock_class(bt_trace_class *tc,
static
bool stream_classes_all_have_default_clock_class(bt_trace_class *tc,
- bt_logging_level log_level)
+ bt_logging_level log_level,
+ bt_self_component *self_comp)
{
uint64_t i, sc_count;
const bt_clock_class *cc = NULL;
{
uint64_t i, sc_count;
const bt_clock_class *cc = NULL;
@@
-73,7
+76,7
@@
bool stream_classes_all_have_default_clock_class(bt_trace_class *tc,
cc = bt_stream_class_borrow_default_clock_class_const(sc);
if (!cc) {
ret = false;
cc = bt_stream_class_borrow_default_clock_class_const(sc);
if (!cc) {
ret = false;
- BT_LOGE("Stream class doesn't have a default clock class: "
+ BT_
COMP_
LOGE("Stream class doesn't have a default clock class: "
"sc-id=%" PRIu64 ", sc-name=\"%s\"",
bt_stream_class_get_id(sc),
bt_stream_class_get_name(sc));
"sc-id=%" PRIu64 ", sc-name=\"%s\"",
bt_stream_class_get_id(sc),
bt_stream_class_get_name(sc));
@@
-117,8
+120,6
@@
enum lttng_live_iterator_status lttng_live_metadata_update(
{
struct lttng_live_session *session = trace->session;
struct lttng_live_metadata *metadata = trace->metadata;
{
struct lttng_live_session *session = trace->session;
struct lttng_live_metadata *metadata = trace->metadata;
- struct lttng_live_component *lttng_live =
- session->lttng_live_msg_iter->lttng_live_comp;
ssize_t ret = 0;
size_t size, len_read = 0;
char *metadata_buf = NULL;
ssize_t ret = 0;
size_t size, len_read = 0;
char *metadata_buf = NULL;
@@
-127,6
+128,7
@@
enum lttng_live_iterator_status lttng_live_metadata_update(
enum lttng_live_iterator_status status =
LTTNG_LIVE_ITERATOR_STATUS_OK;
bt_logging_level log_level = trace->log_level;
enum lttng_live_iterator_status status =
LTTNG_LIVE_ITERATOR_STATUS_OK;
bt_logging_level log_level = trace->log_level;
+ bt_self_component *self_comp = trace->self_comp;
/* No metadata stream yet. */
if (!metadata) {
/* No metadata stream yet. */
if (!metadata) {
@@
-150,7
+152,7
@@
enum lttng_live_iterator_status lttng_live_metadata_update(
/* Open for writing */
fp = bt_open_memstream(&metadata_buf, &size);
if (!fp) {
/* Open for writing */
fp = bt_open_memstream(&metadata_buf, &size);
if (!fp) {
- BT_LOGE("Metadata open_memstream: %s", strerror(errno));
+ BT_
COMP_
LOGE("Metadata open_memstream: %s", strerror(errno));
goto error;
}
goto error;
}
@@
-184,7
+186,8
@@
enum lttng_live_iterator_status lttng_live_metadata_update(
metadata->trace = NULL;
}
if (errno == EINTR) {
metadata->trace = NULL;
}
if (errno == EINTR) {
- if (lttng_live_graph_is_canceled(lttng_live)) {
+ if (lttng_live_graph_is_canceled(
+ session->lttng_live_msg_iter)) {
status = LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
goto end;
}
status = LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
goto end;
}
@@
-192,7
+195,7
@@
enum lttng_live_iterator_status lttng_live_metadata_update(
}
if (bt_close_memstream(&metadata_buf, &size, fp)) {
}
if (bt_close_memstream(&metadata_buf, &size, fp)) {
- BT_LOGE("bt_close_memstream: %s", strerror(errno));
+ BT_
COMP_
LOGE("bt_close_memstream: %s", strerror(errno));
}
ret = 0;
fp = NULL;
}
ret = 0;
fp = NULL;
@@
-208,25
+211,38
@@
enum lttng_live_iterator_status lttng_live_metadata_update(
fp = bt_fmemopen(metadata_buf, len_read, "rb");
if (!fp) {
fp = bt_fmemopen(metadata_buf, len_read, "rb");
if (!fp) {
- BT_LOGE("Cannot memory-open metadata buffer: %s",
+ BT_
COMP_
LOGE("Cannot memory-open metadata buffer: %s",
strerror(errno));
goto error;
}
/*
strerror(errno));
goto error;
}
/*
- * The call to ctf_metadata_decoder_
decode will append new metadata to
- * our current trace class.
+ * The call to ctf_metadata_decoder_
append_content() will append
+ *
new metadata to
our current trace class.
*/
*/
- decoder_status = ctf_metadata_decoder_decode(metadata->decoder, fp);
+ decoder_status = ctf_metadata_decoder_append_content(
+ metadata->decoder, fp);
switch (decoder_status) {
case CTF_METADATA_DECODER_STATUS_OK:
if (!trace->trace_class) {
switch (decoder_status) {
case CTF_METADATA_DECODER_STATUS_OK:
if (!trace->trace_class) {
+ struct ctf_trace_class *tc =
+ ctf_metadata_decoder_borrow_ctf_trace_class(
+ metadata->decoder);
+
trace->trace_class =
ctf_metadata_decoder_get_ir_trace_class(
metadata->decoder);
trace->trace = bt_trace_create(trace->trace_class);
trace->trace_class =
ctf_metadata_decoder_get_ir_trace_class(
metadata->decoder);
trace->trace = bt_trace_create(trace->trace_class);
+ if (!trace->trace) {
+ goto error;
+ }
+ if (ctf_trace_class_configure_ir_trace(tc,
+ trace->trace)) {
+ goto error;
+ }
if (!stream_classes_all_have_default_clock_class(
if (!stream_classes_all_have_default_clock_class(
- trace->trace_class, log_level)) {
+ trace->trace_class, log_level,
+ self_comp)) {
/* Error logged in function. */
goto error;
}
/* Error logged in function. */
goto error;
}
@@
-239,9
+255,7
@@
enum lttng_live_iterator_status lttng_live_metadata_update(
case CTF_METADATA_DECODER_STATUS_INCOMPLETE:
status = LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
break;
case CTF_METADATA_DECODER_STATUS_INCOMPLETE:
status = LTTNG_LIVE_ITERATOR_STATUS_AGAIN;
break;
- case CTF_METADATA_DECODER_STATUS_ERROR:
- case CTF_METADATA_DECODER_STATUS_INVAL_VERSION:
- case CTF_METADATA_DECODER_STATUS_IR_VISITOR_ERROR:
+ default:
goto error;
}
goto error;
}
@@
-254,7
+268,7
@@
end:
closeret = fclose(fp);
if (closeret) {
closeret = fclose(fp);
if (closeret) {
- BT_LOGE("Error on fclose");
+ BT_
COMP_
LOGE("Error on fclose");
}
}
free(metadata_buf);
}
}
free(metadata_buf);
@@
-263,22
+277,17
@@
end:
BT_HIDDEN
int lttng_live_metadata_create_stream(struct lttng_live_session *session,
BT_HIDDEN
int lttng_live_metadata_create_stream(struct lttng_live_session *session,
- uint64_t ctf_trace_id,
- uint64_t stream_id,
+ uint64_t ctf_trace_id, uint64_t stream_id,
const char *trace_name)
{
const char *trace_name)
{
- struct lttng_live_component *lttng_live =
- session->lttng_live_msg_iter->lttng_live_comp;
struct lttng_live_metadata *metadata = NULL;
struct lttng_live_trace *trace;
struct lttng_live_metadata *metadata = NULL;
struct lttng_live_trace *trace;
- const char *match;
struct ctf_metadata_decoder_config cfg = {
.log_level = session->log_level,
struct ctf_metadata_decoder_config cfg = {
.log_level = session->log_level,
- .self_comp =
- bt_self_component_source_as_self_component(
- lttng_live->self_comp),
+ .self_comp = session->self_comp,
.clock_class_offset_s = 0,
.clock_class_offset_ns = 0,
.clock_class_offset_s = 0,
.clock_class_offset_ns = 0,
+ .create_trace_class = true,
};
metadata = g_new0(struct lttng_live_metadata, 1);
};
metadata = g_new0(struct lttng_live_metadata, 1);
@@
-286,13
+295,9
@@
int lttng_live_metadata_create_stream(struct lttng_live_session *session,
return -1;
}
metadata->log_level = session->log_level;
return -1;
}
metadata->log_level = session->log_level;
+ metadata->self_comp = session->self_comp;
metadata->stream_id = stream_id;
metadata->stream_id = stream_id;
- match = strstr(trace_name, session->session_name->str);
- if (!match) {
- goto error;
- }
-
metadata->decoder = ctf_metadata_decoder_create(&cfg);
if (!metadata->decoder) {
goto error;
metadata->decoder = ctf_metadata_decoder_create(&cfg);
if (!metadata->decoder) {
goto error;
This page took
0.024999 seconds
and
4
git commands to generate.