[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e9f35eec-0001-5259-1096-53730179229d@kernel.org>
Date: Thu, 25 Nov 2021 14:42:17 +0100
From: Daniel Bristot de Oliveira <bristot@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Tao Zhou <tao.zhou@...ux.dev>, Ingo Molnar <mingo@...hat.com>,
Tom Zanussi <zanussi@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Juri Lelli <juri.lelli@...hat.com>,
Clark Williams <williams@...hat.com>,
John Kacur <jkacur@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-rt-users@...r.kernel.org, linux-trace-devel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V7 02/14] rtla: Helper functions for rtla
On 11/24/21 22:37, Steven Rostedt wrote:
> On Fri, 29 Oct 2021 21:26:05 +0200
> Daniel Bristot de Oliveira <bristot@...nel.org> wrote:
>
>> +/*
>> + * enable_tracer_by_name - enable a tracer on the given instance
>> + */
>> +int enable_tracer_by_name(struct tracefs_instance *inst, const char *tracer)
>> +{
>> + enum tracefs_tracers t;
>> + int retval;
>> +
>> + t = TRACEFS_TRACER_CUSTOM;
>> +
>> + debug_msg("enabling %s tracer\n", tracer);
>> +
>> + retval = tracefs_tracer_set(inst, t, tracer);
>
> Interesting. We had discussions about having the custom option (which I
> fought for, for this very reason).
>
>> + if (retval < 0) {
>> + if (errno == ENODEV)
>> + err_msg("tracer %s not found!\n", tracer);
>> +
>> + err_msg("failed to enable the tracer %s\n", tracer);
>> + return -1;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +/*
>> + * disable_tracer - set nop tracer to the insta
>> + */
>> +void disable_tracer(struct tracefs_instance *inst)
>> +{
>> + enum tracefs_tracers t = TRACEFS_TRACER_NOP;
>> + int retval;
>> +
>> + retval = tracefs_tracer_set(inst, t);
>> + if (retval < 0)
>> + err_msg("oops, error disabling tracer\n");
>> +}
>> +
>> +/*
>> + * create_instance - create a trace instance with *instance_name
>> + */
>> +struct tracefs_instance *create_instance(char *instance_name)
>> +{
>> + return tracefs_instance_create(instance_name);
>> +}
>> +
>> +/*
>> + * destroy_instance - remove a trace instance and free the data
>> + */
>> +void destroy_instance(struct tracefs_instance *inst)
>> +{
>> + tracefs_instance_destroy(inst);
>> + tracefs_instance_free(inst);
>> +}
>> +
>> +/*
>> + * save_trace_to_file - save the trace output of the instance to the file
>> + */
>> +int save_trace_to_file(struct tracefs_instance *inst, const char *filename)
>> +{
>> + const char *file = "trace";
>> + mode_t mode = 0644;
>> + char *buffer[4096];
>
> Did you really mean to have buffer be 4096 strings?
>
> Or did you mean:
>
> char buffer[4096];
I should be "char buffer[4096];" I will fix that.
(The * is probably a left over from the idea of using a malloc(4096)...)
-- Daniel
> (i.e. a single string of 4096 size)?
>
> -- Steve
>
Powered by blists - more mailing lists