lkml.org 
[lkml]   [2017]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 04/11] trace-cmd: Extract parse_record_options() from trace_record()
From
Date
On Tue, 2017-11-28 at 11:48 -0500, Steven Rostedt wrote:
>
> Is there a reason that init_instance() isn't called in
> init_common_record_context()?
>

Hi Steven,

init_instance() has been put into init_common_record_context() later,
in patch 8, "Making start,extract,stream,profile separate funcs".


> Also, why not just do the "init_common_record_context()" in
> parse_record_options()?
>

Because they do semantically different things: trace_* function might
want to do something before parsing the options, but after initilizing the context.
That is what already happens in trace_profile(): during the refactoring I was able
to remove a heading if (IS_PROFILE(ctx)) containing:

handle_init = trace_init_profile;
ctx.events = 1;

and a tail:

/*
* If no instances were set, then enable profiling on the top instance.
*/
if (!buffer_instances)
top_instance.profile = 1;

Since that code was profile-specific, I put it in trace_profile(),
without 'if' statements, clearly.

Vlad


\
 
 \ /
  Last update: 2017-11-28 19:18    [W:0.105 / U:1.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site