| To: | Steven Rostedt <srostedt@redhat.com> |
|---|---|
| Subject: | Re: [PATCH 5/5] tracing, MIPS: Fix set_graph_function of function graph tracer |
| From: | wu zhangjin <wuzhangjin@gmail.com> |
| Date: | Fri, 21 Jan 2011 17:09:17 +0800 |
| Cc: | Sergei Shtylyov <sshtylyov@mvista.com>, Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=swmR9407BeWmXSd/s7Qo+zFIIRyl17UwX3cN32FWOSs=; b=I6yXfmQEn13ZZmm7b7ZzrtBhtmYCBvQojcqvlV+k9mUZVGjCdAUNtts0tlTsPmLiFJ 4QmvhFcWOAGqIVbTnQZft+DKFBxTDbHsmNOaDeTHajBOamJ/5Icnv5UWaNEyHNqmm9ys UL33jcKNGIRd38IXdVZeZXLbiyYtUDuEWNPHE= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=SGuWZ/O8TBP0RyoqMETmUk/dG8COWU7zP06CXfmQF9CgGm5N052+3izDfmyIl1Xpij /LGBIYuc34mw5xa4oihIhMdYZljwz8Oi324QOscdmMSDdzFQqyBiUe7+dg1m/k/1Daj7 SLez+ZVjXWhbdJnxA6axBqDwCSi8koRnIk/j4= |
| In-reply-to: | <1295532278.19789.12.camel@fedora> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <cover.1295464855.git.wuzhangjin@gmail.com> <9967898043e58db7b311d35695e9422e67cef5f6.1295464855.git.wuzhangjin@gmail.com> <4D381677.3000502@mvista.com> <1295532278.19789.12.camel@fedora> |
| Sender: | linux-mips-bounce@linux-mips.org |
On Thu, Jan 20, 2011 at 10:04 PM, Steven Rostedt <srostedt@redhat.com> wrote: [...] >> > + >> > + insns = (in_kernel_space(self_ra)) ? 2 : (MCOUNT_OFFSET_INSNS + 1); >> >> Unneeded parens. > > agreed > >> >> > + trace.func = self_ra - (MCOUNT_INSN_SIZE * insns); >> >> Here too. > > I like the parens here. Yes, it is basic math precedence, but it stands > out to a reviewer who has their brain more focused on correct code than > thinking about which op has precedence. > > Reviewing code that has: > > trace.func = self_ra - MCOUNT_INSN_SIZE * insns; > > And as I my mother language reads left to right, my thought process > goes: subtract MCOUNT_INSN_SIZE from self_ra and then times insns... oh > wait, times goes first; stop reset, restart... subtract MCOUNT_INSN_SIZE > times insns from self_ra. That stop reset and restart of the thought > process breaks the train of thought and could waste a lot more time than > just the moment it happened. All this is avoided by the parenthesis that > automatically trigger the brain to think those go first. > > I say, leave these in. Yeah, agree ;-) parens have become one important part of my coding style for it have saved me from being confused by the problems like you mentioned above. This is similar to using "a=++i" or "i++; a=i;", the latter is longer but clearer, although If we put them together, the former is also clear, but If we encounter "a=++i;" and "a=i++;" at the same time, we may have a headache ;-) Will resend it asap with your feedback. Thanks, Wu Zhangjin > > -- Steve > > > |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | 24k data cache, PIPT or VIPT?, COLin |
|---|---|
| Next by Date: | Re: [PATCH v4 3/5] MIPS/Perf-events: Fix event check in validate_event(), Sergei Shtylyov |
| Previous by Thread: | Re: [PATCH 5/5] tracing, MIPS: Fix set_graph_function of function graph tracer, Steven Rostedt |
| Next by Thread: | Re: [PATCH 2/2] MIPS: Optimize TLB handlers for Octeon CPUs, Jonas Gorski |
| Indexes: | [Date] [Thread] [Top] [All Lists] |