lkml.org 
[lkml]   [2006]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Patch 1/8] Setup
From
Date
On Tue, 2006-05-02 at 11:42 +0530, Balbir Singh wrote:
> /*
> + * sub = end - start, in normalized form
> + */
> +static inline void timespec_sub(struct timespec *start, struct timespec *end,
> + struct timespec *sub)
> +{
> + set_normalized_timespec(sub, end->tv_sec - start->tv_sec,
> + end->tv_nsec - start->tv_nsec);
> +}

Please use the existing ktime_t functions for that purpose. The ktime_t
format has nanosecond resolution and is optimized for 32/64bit machines.

> +static inline void delayacct_start(struct timespec *start)
> +{
> + do_posix_clock_monotonic_gettime(start);
> +}

Please get rid of this wrapper and use the ktime based functions for
that.

> +/*
> + * Finish delay accounting for a statistic using
> + * its timestamps (@start, @end), accumalator (@total) and @count
> + */
> +
> +static inline void delayacct_end(struct timespec *start, struct timespec *end,
> + u64 *total, u32 *count)

Please use ktime_t for total.

> +{
> + struct timespec ts = {0, 0};
> + s64 ns;
> +
> + do_posix_clock_monotonic_gettime(end);
> + timespec_sub(&ts, start, end);
> + ns = timespec_to_ns(&ts);
> + if (ns < 0)
> + return;

monotonic time is monotonic increasing. So delta is always >= 0 !

tglx


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-09 11:49    [W:0.101 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site