add options to set subbuf size and cnt
[ust.git] / libustcmd / ustcmd.c
index bbb6928c3bff3fda77e02b380d93305d75b9e9cb..930c078fcd9510aebad1eff190d0817a5280e092 100644 (file)
@@ -101,6 +101,55 @@ int ustcmd_set_marker_state(const char *mn, int state, pid_t pid)
        return 0;
 }
 
+/**
+ * Set subbuffer size.
+ *
+ * @param channel_size Channel name and size
+ * @param pid          Traced process ID
+ * @return             0 if successful, or error
+ */
+int ustcmd_set_subbuf_size(const char *channel_size, pid_t pid)
+{
+       char *cmd;
+       int result;
+
+       asprintf(&cmd, "%s %s", "set_subbuf_size", channel_size);
+
+       result = ustcmd_send_cmd(cmd, pid, NULL);
+       if (result) {
+               free(cmd);
+               return 1;
+       }
+
+       free(cmd);
+       return 0;
+}
+
+/**
+ * Set subbuffer num.
+ *
+ * @param channel_num  Channel name and num
+ * @param pid          Traced process ID
+ * @return             0 if successful, or error
+ */
+int ustcmd_set_subbuf_num(const char *channel_size, pid_t pid)
+{
+       char *cmd;
+       int result;
+
+       asprintf(&cmd, "%s %s", "set_subbuf_num", channel_size);
+
+       result = ustcmd_send_cmd(cmd, pid, NULL);
+       if (result) {
+               free(cmd);
+               return 1;
+       }
+
+       free(cmd);
+       return 0;
+}
+
+
 /**
  * Destroys an UST trace according to a PID.
  *
@@ -111,7 +160,7 @@ int ustcmd_destroy_trace(pid_t pid)
 {
        int result;
 
-       result = ustcmd_send_cmd("destroy", pid, NULL);
+       result = ustcmd_send_cmd("trace_destroy", pid, NULL);
        if (result) {
                return USTCMD_ERR_GEN;
        }
@@ -137,6 +186,24 @@ int ustcmd_setup_and_start(pid_t pid)
        return 0;
 }
 
+/**
+ * Creates an UST trace according to a PID.
+ *
+ * @param pid  Traced process ID
+ * @return     0 if successful, or error USTCMD_ERR_GEN
+ */
+int ustcmd_create_trace(pid_t pid)
+{
+       int result;
+
+       result = ustcmd_send_cmd("trace_create", pid, NULL);
+       if (result) {
+               return USTCMD_ERR_GEN;
+       }
+
+       return 0;
+}
+
 /**
  * Starts an UST trace according to a PID.
  *
@@ -155,6 +222,24 @@ int ustcmd_start_trace(pid_t pid)
        return 0;
 }
 
+/**
+ * Alloc an UST trace according to a PID.
+ *
+ * @param pid  Traced process ID
+ * @return     0 if successful, or error USTCMD_ERR_GEN
+ */
+int ustcmd_alloc_trace(pid_t pid)
+{
+       int result;
+
+       result = ustcmd_send_cmd("trace_alloc", pid, NULL);
+       if (result) {
+               return USTCMD_ERR_GEN;
+       }
+
+       return 0;
+}
+
 /**
  * Stops an UST trace according to a PID.
  *
@@ -255,7 +340,7 @@ int ustcmd_get_cmsf(struct marker_status **cmsf, const pid_t pid)
        while (big_str[i] != '\0') {
                char state;
 
-               sscanf(big_str + i, "%a[^/]/%a[^ ] %c %a[^\n]",
+               sscanf(big_str + i, "marker: %a[^/]/%a[^ ] %c %a[^\n]",
                        &tmp_cmsf[cmsf_ind].channel,
                        &tmp_cmsf[cmsf_ind].marker,
                        &state,
This page took 0.028548 seconds and 4 git commands to generate.