X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fconfig%2Fsession-config.c;h=4d5045f09237bf068f6fba08d13643c1acf17d12;hp=783a74a3f3aac46fb916bbc4f533d4c2bb313f05;hb=259c267446a63c501298f39a5d2397314b11f729;hpb=f5eeb9d734eb6727a2ee04f08e3eedf9827ed66f diff --git a/src/common/config/session-config.c b/src/common/config/session-config.c index 783a74a3f..4d5045f09 100644 --- a/src/common/config/session-config.c +++ b/src/common/config/session-config.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "session-config.h" #include "config-internal.h" @@ -131,6 +132,9 @@ const char * const config_element_trackers = "trackers"; const char * const config_element_targets = "targets"; const char * const config_element_target_pid = "pid_target"; +LTTNG_HIDDEN const char * const config_element_rotation_timer_interval = "rotation_schedule_timer_period"; +LTTNG_HIDDEN const char * const config_element_rotation_schedule = "rotation_schedule"; + const char * const config_domain_type_kernel = "KERNEL"; const char * const config_domain_type_ust = "UST"; const char * const config_domain_type_jul = "JUL"; @@ -2513,7 +2517,8 @@ int process_session_node(xmlNodePtr session_node, const char *session_name, const struct config_load_session_override_attr *overrides) { int ret, started = -1, snapshot_mode = -1; - uint64_t live_timer_interval = UINT64_MAX; + uint64_t live_timer_interval = UINT64_MAX, + rotation_timer_interval = 0; xmlChar *name = NULL; xmlChar *shm_path = NULL; xmlNodePtr domains_node = NULL; @@ -2571,7 +2576,9 @@ int process_session_node(xmlNodePtr session_node, const char *session_name, shm_path = node_content; } else { - /* attributes, snapshot_mode or live_timer_interval */ + /* + * attributes, snapshot_mode, live_timer_interval, rotation_size, + * rotation_timer_interval. */ xmlNodePtr attributes_child = xmlFirstElementChild(node); @@ -2591,7 +2598,8 @@ int process_session_node(xmlNodePtr session_node, const char *session_name, ret = -LTTNG_ERR_LOAD_INVALID_CONFIG; goto error; } - } else { + } else if (!strcmp((const char *) attributes_child->name, + config_element_live_timer_interval)) { /* live_timer_interval */ xmlChar *timer_interval_content = xmlNodeGetContent(attributes_child); @@ -2607,6 +2615,23 @@ int process_session_node(xmlNodePtr session_node, const char *session_name, goto error; } } + if (!strcmp((const char *) attributes_child->name, + config_element_rotation_timer_interval)) { + /* rotation_timer_interval */ + xmlChar *timer_interval_content = + xmlNodeGetContent(attributes_child); + if (!timer_interval_content) { + ret = -LTTNG_ERR_NOMEM; + goto error; + } + + ret = parse_uint(timer_interval_content, &rotation_timer_interval); + free(timer_interval_content); + if (ret) { + ret = -LTTNG_ERR_LOAD_INVALID_CONFIG; + goto error; + } + } } } @@ -2744,6 +2769,26 @@ domain_init_error: } } + if (rotation_timer_interval) { + struct lttng_rotation_schedule_attr *rotation_attr = lttng_rotation_schedule_attr_create(); + + if (!rotation_attr) { + goto error; + } + ret = lttng_rotation_schedule_attr_set_session_name(rotation_attr, (const char *) name); + if (ret) { + lttng_rotation_schedule_attr_destroy(rotation_attr); + goto error; + } + lttng_rotation_schedule_attr_set_timer_period(rotation_attr, + rotation_timer_interval); + ret = lttng_rotation_set_schedule(rotation_attr); + lttng_rotation_schedule_attr_destroy(rotation_attr); + if (ret) { + goto error; + } + } + if (started) { ret = lttng_start_tracing((const char *) name); if (ret) {