[libcamera-devel] [PATCH 3/9] test: timer: Test that deadline() isn't reset upon time out

Jacopo Mondi jacopo at jmondi.org
Sun Oct 6 20:58:01 CEST 2019


Hi Laurent,

On Sun, Oct 06, 2019 at 08:32:20AM +0300, Laurent Pinchart wrote:
> Verify that the timer deadline stays valid after the timer expires. As
> the test now uses the deadline in order to compute the jitter, the
> interval_ field isn't used anymore and can be removed.
>

Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
   j

> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
>  test/timer.cpp | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/test/timer.cpp b/test/timer.cpp
> index af922cb371cd..d4f16a9bdd97 100644
> --- a/test/timer.cpp
> +++ b/test/timer.cpp
> @@ -21,14 +21,13 @@ class ManagedTimer : public Timer
>  {
>  public:
>  	ManagedTimer()
> -		: Timer(), interval_(0)
> +		: Timer()
>  	{
>  		timeout.connect(this, &ManagedTimer::timeoutHandler);
>  	}
>
>  	void start(int msec)
>  	{
> -		interval_ = msec;
>  		start_ = std::chrono::steady_clock::now();
>  		expiration_ = std::chrono::steady_clock::time_point();
>
> @@ -37,9 +36,8 @@ public:
>
>  	int jitter()
>  	{
> -		std::chrono::steady_clock::duration duration = expiration_ - start_;
> -		int msecs = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
> -		return abs(msecs - interval_);
> +		std::chrono::steady_clock::duration duration = expiration_ - deadline();
> +		return abs(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count());
>  	}
>
>  private:
> @@ -48,7 +46,6 @@ private:
>  		expiration_ = std::chrono::steady_clock::now();
>  	}
>
> -	int interval_;
>  	std::chrono::steady_clock::time_point start_;
>  	std::chrono::steady_clock::time_point expiration_;
>  };
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20191006/83fb3f1b/attachment.sig>


More information about the libcamera-devel mailing list