{"id":2108,"url":"https://patchwork.libcamera.org/api/1.1/patches/2108/?format=json","web_url":"https://patchwork.libcamera.org/patch/2108/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191006053226.8976-4-laurent.pinchart@ideasonboard.com>","date":"2019-10-06T05:32:20","name":"[libcamera-devel,3/9] test: timer: Test that deadline() isn't reset upon time out","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"dab5fdc1553b3499196fb7f47a6144156f91f688","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2108/mbox/","series":[{"id":522,"url":"https://patchwork.libcamera.org/api/1.1/series/522/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=522","date":"2019-10-06T05:32:17","name":"Timer fixes and enhancements","version":1,"mbox":"https://patchwork.libcamera.org/series/522/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2108/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2108/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 37BD561967\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  6 Oct 2019 07:32:37 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(modemcable151.96-160-184.mc.videotron.ca [184.160.96.151])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 54A9273E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  6 Oct 2019 07:32:36 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1570339956;\n\tbh=kEGCTuidhIjcKppbkB5bxzA/zzUVL1xO20g5whvZ3Fs=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=asJ+wcj2Z8ou5u5m26S5JXtFZQT4GtCiKhQn/a6dLII2O2qte6M8g0nQNnaYDpics\n\tgE5NoVJ3XU1k6GvGT+6nvsidW+yx+ey2FAuw7qDT70SvzPkOk3WULreh/YC8H6mo4h\n\tYBOtmX4FB0pt+IaQk84n6wjHa8GApTYTyEl5NHYA=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun,  6 Oct 2019 08:32:20 +0300","Message-Id":"<20191006053226.8976-4-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20191006053226.8976-1-laurent.pinchart@ideasonboard.com>","References":"<20191006053226.8976-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 3/9] test: timer: Test that deadline()\n\tisn't reset upon time out","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sun, 06 Oct 2019 05:32:37 -0000"},"content":"Verify that the timer deadline stays valid after the timer expires. As\nthe test now uses the deadline in order to compute the jitter, the\ninterval_ field isn't used anymore and can be removed.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/timer.cpp | 9 +++------\n 1 file changed, 3 insertions(+), 6 deletions(-)","diff":"diff --git a/test/timer.cpp b/test/timer.cpp\nindex af922cb371cd..d4f16a9bdd97 100644\n--- a/test/timer.cpp\n+++ b/test/timer.cpp\n@@ -21,14 +21,13 @@ class ManagedTimer : public Timer\n {\n public:\n \tManagedTimer()\n-\t\t: Timer(), interval_(0)\n+\t\t: Timer()\n \t{\n \t\ttimeout.connect(this, &ManagedTimer::timeoutHandler);\n \t}\n \n \tvoid start(int msec)\n \t{\n-\t\tinterval_ = msec;\n \t\tstart_ = std::chrono::steady_clock::now();\n \t\texpiration_ = std::chrono::steady_clock::time_point();\n \n@@ -37,9 +36,8 @@ public:\n \n \tint jitter()\n \t{\n-\t\tstd::chrono::steady_clock::duration duration = expiration_ - start_;\n-\t\tint msecs = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();\n-\t\treturn abs(msecs - interval_);\n+\t\tstd::chrono::steady_clock::duration duration = expiration_ - deadline();\n+\t\treturn abs(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count());\n \t}\n \n private:\n@@ -48,7 +46,6 @@ private:\n \t\texpiration_ = std::chrono::steady_clock::now();\n \t}\n \n-\tint interval_;\n \tstd::chrono::steady_clock::time_point start_;\n \tstd::chrono::steady_clock::time_point expiration_;\n };\n","prefixes":["libcamera-devel","3/9"]}