linux-mips
[Top] [All Lists]

Re: [PATCH v7 03/17] tracing: add MIPS specific trace_clock_local()

To: Wu Zhangjin <wuzhangjin@gmail.com>
Subject: Re: [PATCH v7 03/17] tracing: add MIPS specific trace_clock_local()
From: David Daney <ddaney@caviumnetworks.com>
Date: Tue, 10 Nov 2009 09:48:46 -0800
Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, zhangfx@lemote.com, zhouqg@gmail.com, Ralf Baechle <ralf@linux-mips.org>, rostedt@goodmis.org, Frederic Weisbecker <fweisbec@gmail.com>, Ingo Molnar <mingo@elte.hu>, Nicholas Mc Guire <der.herr@hofr.at>, Richard Sandiford <rdsandiford@googlemail.com>, Patrik Kluba <kpajko79@gmail.com>, Thomas Gleixner <tglx@linutronix.de>, Michal Simek <monstr@monstr.eu>
In-reply-to: <8f579e2cece16cd22358a4ec143ef6a8c462639b.1257779502.git.wuzhangjin@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <9dc81a7a9e5a292cccdf465c533a2b08d19d6021.1257779502.git.wuzhangjin@gmail.com> <b99c08397d9ff92ac5a72bda9131df41b702fc71.1257779502.git.wuzhangjin@gmail.com> <8f579e2cece16cd22358a4ec143ef6a8c462639b.1257779502.git.wuzhangjin@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
Wu Zhangjin wrote:
[...]
+ * trace_clock_local(): the simplest and least coherent tracing clock.
+ *
+ * Useful for tracing that does not cross to other CPUs nor
+ * does it go through idle events.
+ */
+u64 trace_clock_local(void)
+{
+       unsigned long flags;
+       u64 clock;
+
+       raw_local_irq_save(flags);
+
+       clock = mips_timecounter_read();
+
+       raw_local_irq_restore(flags);
+
+       return clock;
+}

Why disable interrupts?

Also you call the new function mips_timecounter_read(). Since sched_clock() is a weak function, you can override the definition with a more accurate version when possible. Then you could just directly call it here, instead of adding the new mips_timecounter_read() that the '[PATCH v7 02/17] tracing: add mips_timecounter_read() for MIPS' adds.

David Daney

<Prev in Thread] Current Thread [Next in Thread>