Lttng-ctl: Expose sessiond cmd_clear_session command
[lttng-tools.git] / include / lttng / session.h
index 7211eeec1ca11b7a3e4062148c00a9f7a46b92ad..dff6b45d40dedcf09001d76c1c7124f10c5e49d9 100644 (file)
@@ -84,6 +84,41 @@ extern int lttng_create_session_snapshot(const char *name,
 extern int lttng_create_session_live(const char *name, const char *url,
                unsigned int timer_interval);
 
+/*
+ * Clear a tracing session.
+ *
+ * Clear the data buffers and trace data.
+ *
+ * For sessions saving trace data to disk and streaming over the network to a
+ * relay daemon, the buffers content and existing stream files are cleared when
+ * the clear command is issued.
+ *
+ * For snapshot sessions (flight recorder), only the buffer content is cleared.
+ * Prior snapshots are individually recorded to disk, and are therefore
+ * untouched by this "clear" command.
+ *
+ * For live sessions streaming over network to a relay daemon, the buffers
+ * will be cleared, and the files on the relay daemon side will be cleared as
+ * well. However, any active live trace viewer currently reading an existing
+ * trace packet will be able to proceed to read that packet entirely before
+ * skipping over cleared stream data.
+ *
+ * The clear command guarantees that no trace data preceding the instant it is
+ * called will be in the resulting trace.
+ *
+ * Trace data produced from the moment it is called and when the
+ * function returned might be present in the resulting trace.
+ *
+ * Return 0 on success else a negative LTTng error code.
+ *
+ * Important error codes:
+ *    LTTNG_ERR_CLEAR_DISALLOWED_RELAY
+ *    LTTNG_ERR_CLEAR_NOT_AVAILABLE
+ *    LTTNG_ERR_CLEAR_NOT_AVAILABLE_RELAY
+ *    LTTNG_ERR_CLEAR_FAIL_CONSUMER
+*/
+extern int lttng_clear_session(const char *name);
+
 /*
  * Destroy a tracing session.
  *
@@ -162,23 +197,6 @@ extern int lttng_untrack_pid(struct lttng_handle *handle, int pid);
 extern int lttng_list_tracker_pids(struct lttng_handle *handle,
                int *enabled, int32_t **pids, size_t *nr_pids);
 
-/*
- * Ask the session daemon where the data for this session is currently being
- * written to. If rotations occured during a session, this call is useful to
- * know the location of the last chunk.
- *
- * Return 0 and allocate chunk_path if rotations occured for this session, the
- * caller needs to free chunk_path.
- * Return 1 if no rotation occured during the session, chunk_path is left
- * unallocated.
- *
- * Return a negative LTTng error code on error (readable with lttng_strerror).
- *
- * FIXME: Return an lttng_location object rather than a path.
- */
-extern int lttng_session_get_current_archive_location(const char *session_name,
-               char **chunk_path);
-
 #ifdef __cplusplus
 }
 #endif
This page took 0.028176 seconds and 5 git commands to generate.