From: Matt Reuther <mreuther@umich.edu>
To: Adrian Bunk <bunk@stusta.de>
Cc: Andrew Morton <akpm@osdl.org>,
LKML <linux-kernel@vger.kernel.org>, Jay Lan <jlan@sgi.com>
Subject: Re: [-mm patch] add timespec_to_us() and use it in kernel/tsacct.c
Date: Wed, 9 Aug 2006 07:57:12 -0400 [thread overview]
Message-ID: <200608090757.12890.mreuther@umich.edu> (raw)
In-Reply-To: <20060807133240.GB3691@stusta.de>
On Monday 07 August 2006 09:32 am, Adrian Bunk wrote:
> On Sun, Aug 06, 2006 at 10:21:29PM -0700, Andrew Morton wrote:
> > On Sun, 6 Aug 2006 23:30:19 -0400
> What about the patch below that adds a timespec_to_us() to time.h and
> uses this function in kernel/tsacct.c?
>
>
> <-- snip -->
>
>
> This patch adds a timespec_to_us() to include/linux/time.h and uses it
> to fix a compile error in kernel/tsacct.c .
>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
>
> ---
>
> include/linux/time.h | 12 ++++++++++++
> kernel/tsacct.c | 2 +-
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> --- linux-2.6.18-rc3-mm2-full/include/linux/time.h.old 2006-08-06
> 19:56:50.000000000 +0200 +++
> linux-2.6.18-rc3-mm2-full/include/linux/time.h 2006-08-06
> 20:00:51.000000000 +0200 @@ -132,6 +132,18 @@
> }
>
> /**
> + * timespec_to_us - Convert timespec to microseconds
> + * @ts: pointer to the timespec variable to be converted
> + *
> + * Returns the scalar microsecond representation of the timespec
> + * parameter.
> + */
> +static inline s64 timespec_to_us(const struct timespec *ts)
> +{
> + return ((s64) ts->tv_sec * USEC_PER_SEC) + ts->tv_nsec / NSEC_PER_USEC;
> +}
> +
> +/**
> * timeval_to_ns - Convert timeval to nanoseconds
> * @ts: pointer to the timeval variable to be converted
> *
> --- linux-2.6.18-rc3-mm2-full/kernel/tsacct.c.old 2006-08-06
> 19:54:45.000000000 +0200 +++
> linux-2.6.18-rc3-mm2-full/kernel/tsacct.c 2006-08-06 19:56:44.000000000
> +0200 @@ -36,7 +36,7 @@
> do_posix_clock_monotonic_gettime(&uptime);
> ts = timespec_sub(uptime, current->group_leader->start_time);
> /* rebase elapsed time to usec */
> - stats->ac_etime = (timespec_to_ns(&ts))/NSEC_PER_USEC;
> + stats->ac_etime = timespec_to_us(&ts);
> stats->ac_btime = xtime.tv_sec - ts.tv_sec;
> if (thread_group_leader(tsk)) {
> stats->ac_exitcode = tsk->exit_code;
This patch also compiles for me without errors.
Matt
prev parent reply other threads:[~2006-08-10 2:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-07 3:30 2.6.18-rc3-mm2 Compile Error Matt Reuther
2006-08-07 5:21 ` Andrew Morton
2006-08-07 11:31 ` Matt Reuther
2006-08-07 13:32 ` [-mm patch] add timespec_to_us() and use it in kernel/tsacct.c Adrian Bunk
2006-08-07 20:24 ` Andrew Morton
2006-08-07 20:46 ` Adrian Bunk
2006-08-08 0:02 ` Paul Mackerras
2006-08-09 11:57 ` Matt Reuther [this message]
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=200608090757.12890.mreuther@umich.edu \
--to=mreuther@umich.edu \
--cc=akpm@osdl.org \
--cc=bunk@stusta.de \
--cc=jlan@sgi.com \
--cc=linux-kernel@vger.kernel.org \
/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®