@@ -290,8 +290,6 @@ struct tracecmd_option *
tracecmd_add_option_v(struct tracecmd_output *handle,
unsigned short id, const struct iovec *vector, int count);
-struct tracecmd_option *tracecmd_add_buffer_option(struct tracecmd_output *handle,
- const char *name, int cpus);
int tracecmd_add_buffer_info(struct tracecmd_output *handle, const char *name, int cpus);
int tracecmd_write_buffer_info(struct tracecmd_output *handle);
@@ -1334,9 +1334,8 @@ int tracecmd_append_options(struct tracecmd_output *handle)
return 0;
}
-struct tracecmd_option *
-tracecmd_add_buffer_option(struct tracecmd_output *handle, const char *name,
- int cpus)
+static struct tracecmd_option *
+add_buffer_option(struct tracecmd_output *handle, const char *name, int cpus)
{
struct tracecmd_option *option;
char *buf;
@@ -1387,7 +1386,7 @@ int tracecmd_write_buffer_info(struct tracecmd_output *handle)
struct tracecmd_buffer *buf;
list_for_each_entry(buf, &handle->buffers, list) {
- option = tracecmd_add_buffer_option(handle, buf->name, buf->cpus);
+ option = add_buffer_option(handle, buf->name, buf->cpus);
if (!option)
return -1;
buf->option = option;
@@ -4169,7 +4169,6 @@ static void touch_file(const char *file)
}
static void append_buffer(struct tracecmd_output *handle,
- struct tracecmd_option *buffer_option,
struct buffer_instance *instance,
char **temp_files)
{
@@ -4197,7 +4196,7 @@ static void append_buffer(struct tracecmd_output *handle,
touch_file(temp_files[i]);
}
- tracecmd_append_buffer_cpu_data(handle, buffer_option,
+ tracecmd_append_buffer_cpu_data(handle, NULL,
cpu_count, temp_files);
for (i = 0; i < instance->cpu_count; i++) {
@@ -4482,7 +4481,6 @@ error:
static void record_data(struct common_record_context *ctx)
{
- struct tracecmd_option **buffer_options;
struct tracecmd_output *handle;
struct buffer_instance *instance;
bool local = false;
@@ -4551,9 +4549,6 @@ static void record_data(struct common_record_context *ctx)
}
if (buffers) {
- buffer_options = malloc(sizeof(*buffer_options) * buffers);
- if (!buffer_options)
- die("Failed to allocate buffer options");
i = 0;
for_each_instance(instance) {
int cpus = instance->cpu_count != local_cpu_count ?
@@ -4561,10 +4556,9 @@ static void record_data(struct common_record_context *ctx)
if (instance->msg_handle)
continue;
-
- buffer_options[i++] = tracecmd_add_buffer_option(handle,
- tracefs_instance_get_name(instance->tracefs),
- cpus);
+ tracecmd_add_buffer_info(handle,
+ tracefs_instance_get_name(instance->tracefs),
+ cpus);
add_buffer_stat(handle, instance);
}
}
@@ -4599,7 +4593,7 @@ static void record_data(struct common_record_context *ctx)
if (instance->msg_handle)
continue;
print_stat(instance);
- append_buffer(handle, buffer_options[i++], instance, temp_files);
+ append_buffer(handle, instance, temp_files);
}
}
When recording trace buffers, use the newly introduced library API for describing the buffers. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- .../include/private/trace-cmd-private.h | 2 -- lib/trace-cmd/trace-output.c | 7 +++---- tracecmd/trace-record.c | 16 +++++----------- 3 files changed, 8 insertions(+), 17 deletions(-)