From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/4] tst_timer: Add nano second conversions
Date: Tue, 11 Sep 2018 00:18:44 +0200 [thread overview]
Message-ID: <20180910221843.GA28616@dell5510> (raw)
In-Reply-To: <20180910084442.17720-2-rpalethorpe@suse.com>
Hi Richard,
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
It'd be nice to add doc into doc/test-writing-guidelines.txt.
(I know the docs isn't complete, at least tst_timeval_diff_ms() is not
mentioned.
> ---
> include/tst_timer.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
> diff --git a/include/tst_timer.h b/include/tst_timer.h
> index 0fd7ed6cf..577bc88ef 100644
> --- a/include/tst_timer.h
> +++ b/include/tst_timer.h
> @@ -34,6 +34,11 @@
> #include <sys/time.h>
> #include <time.h>
> +static inline long long tst_timespec_to_ns(struct timespec t)
> +{
> + return t.tv_sec * 1000000000 + t.tv_nsec;
> +}
> +
> /*
> * Converts timespec to microseconds.
> */
> @@ -166,6 +171,12 @@ static inline struct timespec tst_timespec_diff(struct timespec t1,
> return res;
> }
> +static inline long long tst_timespec_diff_ns(struct timespec t1,
> + struct timespec t2)
> +{
> + return t1.tv_nsec - t2.tv_nsec + 1000000000LL * (t1.tv_sec - t2.tv_sec);
I guess this can be just 1000000000 (nitpicking).
> +}
> +
> static inline long long tst_timespec_diff_us(struct timespec t1,
> struct timespec t2)
> {
Kind regards,
Petr
next prev parent reply other threads:[~2018-09-10 22:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-10 8:44 [LTP] [PATCH v2 0/4] New Fuzzy Sync library API Richard Palethorpe
2018-09-10 8:44 ` [LTP] [PATCH v2 1/4] tst_timer: Add nano second conversions Richard Palethorpe
2018-09-10 22:18 ` Petr Vorel [this message]
2018-09-11 9:44 ` Richard Palethorpe
2018-09-10 8:44 ` [LTP] [PATCH v2 2/4] fzsync: Simplify API with start/end race calls and limit exec time Richard Palethorpe
2018-09-10 11:46 ` Richard Palethorpe
2018-09-26 9:40 ` Li Wang
2018-10-08 12:32 ` Richard Palethorpe
2018-10-09 8:12 ` Li Wang
2018-10-03 12:57 ` Cyril Hrubis
2018-09-10 8:44 ` [LTP] [PATCH v2 3/4] Convert tests to use fzsync_{start, end}_race API Richard Palethorpe
2018-09-10 8:44 ` [LTP] [PATCH v2 4/4] Add delay bias for difficult races Richard Palethorpe
2018-09-10 22:38 ` Petr Vorel
2018-09-11 9:14 ` Richard Palethorpe
2018-10-03 11:30 ` Cyril Hrubis
2018-10-03 13:46 ` Cyril Hrubis
2018-10-08 9:52 ` Richard Palethorpe
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=20180910221843.GA28616@dell5510 \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/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