From: Steven Rostedt <rostedt@goodmis.org>
To: Vladislav Valtchev <vladislav.valtchev@gmail.com>
Cc: linux-kernel@vger.kernel.org, y.karadz@gmail.com
Subject: Re: [PATCH 08/11] trace-cmd: Making start,extract,stream,profile separate funcs
Date: Tue, 28 Nov 2017 14:35:35 -0500 [thread overview]
Message-ID: <20171128143535.54b6ea74@gandalf.local.home> (raw)
In-Reply-To: <1511894062.1754.21.camel@gmail.com>
On Tue, 28 Nov 2017 20:34:22 +0200
Vladislav Valtchev <vladislav.valtchev@gmail.com> wrote:
> On Tue, 2017-11-28 at 12:14 -0500, Steven Rostedt wrote:
> > As everything is doing both init_common_record_context() and
> > parse_record_options() why not just move the
> > init_common_record_context() into parse_record_options(). If you need
> > to do something special (like set events = 1 for profile) have that
> > done in parse_record_options() if the cmd is CMD_record. Yes, you need
> > to pass the CMD_* to parse_record_options() in this case.
> >
>
> Actually, I spent some effort trying to avoid exactly that:
> "if" statments in "overly generic code". In my view, the point
> of having several trace_* functions is to be able to write specific code
> for them, without conditional branches.
But not if they are not necessary.
>
> I understand that, clearly, there is a trade-off because the extreme of that is to
> have a different copy of a function like parse_record_options() for each command.
> On the other hand, when you have an IF (cmd is PROFILE) at the beginning and an
> if (cmd is PROFILE) at the end, it looks to me a good thing to move that code in the
> specific trace_profile() function. It's all about finding the right balance:
It's a single file. If this was a library function, then sure, I could
understand. But the if would be useful to see how things are different
in one place. The only reason you broke it up, was because of one user.
Are you sure that one user couldn't do it better?
If we left the if statement in, you would see the answer would be yes!
> the previous extreme (before the refactoring) was to have everything in trace_record()
> with much more if statements and that looked more complicated to follow, at least for me.
Obviously it wasn't for me ;-)
>
> Clearly, I fully understand that the location of that "right balance" is pretty subjective.
>
> Do you have a strong opinion on that?
Yes. Simply because we lost the fact that we can do it better.
There's a reason I asked about why the "events = 1" was needed? And
saying "it was there before" is not the right answer. You are changing
the flow of the code. These are not subtle changes. These are
legitimate changes to the flow. Even though they are only to make it
easier to understand. The algorithm is changing. Look again, and tell
me, why is "events = 1" needed? And for that matter, the setting of
handle_init. If it is needed, why?
-- Steve
next prev parent reply other threads:[~2017-11-28 19:35 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-23 16:33 [PATCH 00/11] trace-cmd: Refactoring trace_record() Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 01/11] trace-cmd: Extract trace_stop() from trace_record() Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 02/11] trace-cmd: Extract trace_restart() " Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 03/11] trace-cmd: Extract trace_reset() " Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 04/11] trace-cmd: Extract parse_record_options() " Vladislav Valtchev (VMware)
2017-11-28 16:48 ` Steven Rostedt
2017-11-28 18:17 ` Vladislav Valtchev
2017-11-28 18:30 ` Steven Rostedt
2017-11-28 18:57 ` Vladislav Valtchev
2017-11-28 19:15 ` Steven Rostedt
2017-11-29 14:53 ` Steven Rostedt
2017-11-29 15:18 ` Vladislav Valtchev
2017-11-23 16:33 ` [PATCH 05/11] trace-cmd: Rename trace_profile() to trace_profile_int() Vladislav Valtchev (VMware)
2017-11-28 17:05 ` Steven Rostedt
2017-11-28 19:00 ` Vladislav Valtchev
2017-11-23 16:33 ` [PATCH 06/11] trace-cmd: Replacing cmd flags w/ a trace_cmd enum Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 07/11] trace-cmd: Extracting record_trace() Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 08/11] trace-cmd: Making start,extract,stream,profile separate funcs Vladislav Valtchev (VMware)
2017-11-28 17:14 ` Steven Rostedt
2017-11-28 18:34 ` Vladislav Valtchev
2017-11-28 19:35 ` Steven Rostedt [this message]
2017-11-29 10:03 ` Vladislav Valtchev
2017-11-29 12:48 ` Steven Rostedt
2017-11-23 16:33 ` [PATCH 09/11] trace-cmd: Consolidate ARRAY_SIZE() in trace-cmd.h Vladislav Valtchev (VMware)
2017-11-28 17:16 ` Steven Rostedt
2017-11-23 16:33 ` [PATCH 10/11] trace-cmd: Making the "die" functions noreturn Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 11/11] trace-cmd: Introducing get_trace_cmd_type() Vladislav Valtchev (VMware)
2017-11-28 17:17 ` Steven Rostedt
2017-11-28 18:32 ` Steven Rostedt
2017-11-28 19:04 ` Vladislav Valtchev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171128143535.54b6ea74@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vladislav.valtchev@gmail.com \
--cc=y.karadz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®