public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 3/4] tst_timer: Create interface for using multiple timers
Date: Thu, 16 Aug 2018 15:06:28 +0200	[thread overview]
Message-ID: <87a7pm4g17.fsf@rpws.prws.suse.cz> (raw)
In-Reply-To: <20180816122728.GE6547@rei>

Hello,

Cyril Hrubis <chrubis@suse.cz> writes:

> Hi!
>> > +/**
>> > + * Encapsulates a stopwatch timer.
>> > + *
>> > + * Useful when you need to use multiple timers in a single test.
>> > + */
>> > +struct tst_timer {
>> > +	/** The POSIX clock type  */
>> > +	clockid_t clock_id;
>> > +	/** How much time can pass before tst_timer_expired_st() returns true */
>> > +	struct timespec limit;
>> > +	/** Where to start measuring time from */
>> > +	struct timespec start_time;
>> > +};
>
> On a related note, do you really think that we will need nsec resoltion
> for the timeout timers? I would say that keeping the limit as unsigned
> integer holding number of seconds would be more than enough.

I agree that seconds are appropriate for test timeouts, but it is
practically 'free' to use the struct here because of the existing API to
compare timespec structs. Also I might use this interface to time
syscalls and maybe remove some code duplication.

--
Thank you,
Richard.

  reply	other threads:[~2018-08-16 13:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16 12:00 [LTP] [PATCH v3 1/4] lib: Allow user to easily get LTP_TIMEOUT_MUL value Richard Palethorpe
2018-08-16 12:00 ` [LTP] [PATCH v3 2/4] tst_timer: Convert to new library Richard Palethorpe
2018-08-16 12:08   ` Cyril Hrubis
2018-08-16 12:00 ` [LTP] [PATCH v3 3/4] tst_timer: Create interface for using multiple timers Richard Palethorpe
2018-08-16 12:22   ` Cyril Hrubis
2018-08-16 12:27     ` Cyril Hrubis
2018-08-16 13:06       ` Richard Palethorpe [this message]
2018-08-16 12:58     ` Richard Palethorpe
2018-08-16 12:59       ` Cyril Hrubis
2018-08-16 12:00 ` [LTP] [PATCH v3 4/4] fzsync: Limit execution time to prevent test timeouts Richard Palethorpe
2018-08-17  7:43   ` Li Wang
2018-08-17  9:04     ` Li Wang

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=87a7pm4g17.fsf@rpws.prws.suse.cz \
    --to=rpalethorpe@suse.de \
    --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