return 0;
}
+/**
+ * Get subbuffer size.
+ *
+ * @param channel Channel name
+ * @param pid Traced process ID
+ * @return subbuf size if successful, or error
+ */
+int ustcmd_get_subbuf_size(const char *channel, pid_t pid)
+{
+ char *cmd, *reply;
+ int result;
+
+ /* format: channel_cpu */
+ asprintf(&cmd, "%s %s_0", "get_subbuf_size", channel);
+
+ result = ustcmd_send_cmd(cmd, pid, &reply);
+ if (result) {
+ free(cmd);
+ free(reply);
+ return -1;
+ }
+
+ result = atoi(reply);
+ free(cmd);
+ free(reply);
+ return result;
+}
+
+/**
+ * Get subbuffer num.
+ *
+ * @param channel Channel name
+ * @param pid Traced process ID
+ * @return subbuf cnf if successful, or error
+ */
+int ustcmd_get_subbuf_num(const char *channel, pid_t pid)
+{
+ char *cmd, *reply;
+ int result;
+
+ /* format: channel_cpu */
+ asprintf(&cmd, "%s %s_0", "get_n_subbufs", channel);
+
+ result = ustcmd_send_cmd(cmd, pid, &reply);
+ if (result) {
+ free(cmd);
+ free(reply);
+ return -1;
+ }
+
+ result = atoi(reply);
+ free(cmd);
+ free(reply);
+ return result;
+}
/**
* Destroys an UST trace according to a PID.
extern int ustcmd_set_marker_state(const char *, int, pid_t);
extern int ustcmd_set_subbuf_size(const char *, pid_t);
extern int ustcmd_set_subbuf_num(const char *, pid_t);
+extern int ustcmd_get_subbuf_size(const char *, pid_t);
+extern int ustcmd_get_subbuf_num(const char *, pid_t);
extern int ustcmd_destroy_trace(pid_t);
extern int ustcmd_setup_and_start(pid_t);
extern int ustcmd_stop_trace(pid_t);
GET_ONLINE_PIDS,
SET_SUBBUF_SIZE,
SET_SUBBUF_NUM,
+ GET_SUBBUF_SIZE,
+ GET_SUBBUF_NUM,
UNKNOWN
};
--destroy-trace\t\t\tDestroy the trace\n\
--set-subbuf-size \"CHANNEL/bytes\"\tSet the size of subbuffers per channel\n\
--set-subbuf-num \"CHANNEL/n\"\tSet the number of subbuffers per channel\n\
+ --get-subbuf-size \"CHANNEL\"\t\tGet the size of subbuffers per channel\n\
+ --get-subbuf-num \"CHANNEL\"\t\tGet the number of subbuffers per channel\n\
--enable-marker \"CHANNEL/MARKER\"\tEnable a marker\n\
--disable-marker \"CHANNEL/MARKER\"\tDisable a marker\n\
--list-markers\t\t\tList the markers of the process, their\n\t\t\t\t\t state and format string\n\
{ "online-pids", 0, 0, GET_ONLINE_PIDS },
{ "set-subbuf-size", 1, 0, SET_SUBBUF_SIZE },
{ "set-subbuf-num", 1, 0, SET_SUBBUF_NUM },
+ { "get-subbuf-size", 1, 0, GET_SUBBUF_SIZE },
+ { "get-subbuf-num", 1, 0, GET_SUBBUF_NUM },
{ 0, 0, 0, 0 }
};
case DISABLE_MARKER:
case SET_SUBBUF_SIZE:
case SET_SUBBUF_NUM:
+ case GET_SUBBUF_SIZE:
+ case GET_SUBBUF_NUM:
opts->regex = strdup(optarg);
break;
ustcmd_set_subbuf_num(opts.regex, *pidit);
break;
+ case GET_SUBBUF_SIZE:
+ result = ustcmd_get_subbuf_size(opts.regex, *pidit);
+ if (result == -1) {
+ ERR("error while trying to get_subuf_size with PID %u\n", (unsigned int) *pidit);
+ break;
+ }
+
+ printf("the size of subbufers is %d\n", result);
+ break;
+
+ case GET_SUBBUF_NUM:
+ result = ustcmd_get_subbuf_num(opts.regex, *pidit);
+ if (result == -1) {
+ ERR("error while trying to get_subuf_num with PID %u\n", (unsigned int) *pidit);
+ break;
+ }
+
+ printf("the number of subbufers is %d\n", result);
+ break;
+
case ALLOC_TRACE:
result = ustcmd_alloc_trace(*pidit);
if (result) {