[Patch 1/5] I/O statistics through request queues: timeval_to_us()

From: Martin Peschke
Date: Sat Oct 21 2006 - 08:57:55 EST


The next patch requires a timeval-to-microseconds conversion.
Introducing a helper function (and fixing a comment).

Signed-off-by: Martin Peschke <mp3@xxxxxxxxxx>
---

time.h | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletion(-)

diff -urp a/include/linux/time.h b/include/linux/time.h
--- a/include/linux/time.h 2006-10-03 16:25:53.000000000 +0200
+++ b/include/linux/time.h 2006-10-06 21:36:08.000000000 +0200
@@ -133,8 +133,20 @@ static inline s64 timespec_to_ns(const s
}

/**
+ * timeval_to_us - Convert timeval to microseconds
+ * @tv: pointer to the timeval variable to be converted
+ *
+ * Returns the scalar nanosecond representation of the timeval
+ * parameter.
+ */
+static inline s64 timeval_to_us(const struct timeval *tv)
+{
+ return ((s64) tv->tv_sec * USEC_PER_SEC) + tv->tv_usec;
+}
+
+/**
* timeval_to_ns - Convert timeval to nanoseconds
- * @ts: pointer to the timeval variable to be converted
+ * @tv: pointer to the timeval variable to be converted
*
* Returns the scalar nanosecond representation of the timeval
* parameter.


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