[{"id":21479,"web_url":"https://patchwork.libcamera.org/comment/21479/","msgid":"<YabCpQRf4KpLJpv9@pendragon.ideasonboard.com>","date":"2021-12-01T00:32:37","subject":"Re: [libcamera-devel] [PATCH v3 01/11] libcamera: Print Timer\n\tidentifier","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Dec 01, 2021 at 12:36:24AM +0100, Jacopo Mondi wrote:\n> The Timer debug output does not report to which timer a condition refers\n> to. Fix that by printing the Timer address.\n\nDo I assume correctly that this comes from an issue you were trying to\ndebug ? If so, could you share some information (for my own information,\ndoesn't have to be recorded in the commit message) ?\n\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/base/event_dispatcher_poll.cpp | 3 ++-\n>  src/libcamera/base/timer.cpp                 | 4 ++--\n>  2 files changed, 4 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/libcamera/base/event_dispatcher_poll.cpp b/src/libcamera/base/event_dispatcher_poll.cpp\n> index 8ee22d5adcc4..20cc6e617189 100644\n> --- a/src/libcamera/base/event_dispatcher_poll.cpp\n> +++ b/src/libcamera/base/event_dispatcher_poll.cpp\n> @@ -214,7 +214,8 @@ int EventDispatcherPoll::poll(std::vector<struct pollfd> *pollfds)\n>  \t\t\ttimeout = { 0, 0 };\n>  \n>  \t\tLOG(Event, Debug)\n> -\t\t\t<< \"timeout \" << timeout.tv_sec << \".\"\n> +\t\t\t<< \"timeout \" << nextTimer << \" \"\n> +\t\t\t<< timeout.tv_sec << \".\"\n\n\"timeout <pointer> <value>\" could be a bit hard to read, how about\n\n\t\tLOG(Event, Debug)\n\t\t\t<< \"next timer \" << nextTimer << \" expires in \"\n\t\t\t<< timeout.tv_sec << \".\"\n\t\t\t<< std::setfill('0') << std::setw(9)\n\t\t\t<< timeout.tv_nsec;\n\nIf you think that's overkill you can ignore it.\n\n>  \t\t\t<< std::setfill('0') << std::setw(9)\n>  \t\t\t<< timeout.tv_nsec;\n>  \t}\n> diff --git a/src/libcamera/base/timer.cpp b/src/libcamera/base/timer.cpp\n> index 9c54352d46bd..187336e3a1a4 100644\n> --- a/src/libcamera/base/timer.cpp\n> +++ b/src/libcamera/base/timer.cpp\n> @@ -96,7 +96,7 @@ void Timer::start(std::chrono::milliseconds duration)\n>  void Timer::start(std::chrono::steady_clock::time_point deadline)\n>  {\n>  \tif (Thread::current() != thread()) {\n> -\t\tLOG(Timer, Error) << \"Timer can't be started from another thread\";\n> +\t\tLOG(Timer, Error) << \"Timer \" << this << \" << can't be started from another thread\";\n\nMaybe a timer ID would be useful to have in the future for debugging\npurpose. Then we could inherit from Loggable. For now this will do.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \t\treturn;\n>  \t}\n>  \n> @@ -128,7 +128,7 @@ void Timer::stop()\n>  \t\treturn;\n>  \n>  \tif (Thread::current() != thread()) {\n> -\t\tLOG(Timer, Error) << \"Timer can't be stopped from another thread\";\n> +\t\tLOG(Timer, Error) << \"Timer \" << this << \" can't be stopped from another thread\";\n>  \t\treturn;\n>  \t}\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DCA0ABF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 Dec 2021 00:33:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3849F60720;\n\tWed,  1 Dec 2021 01:33:04 +0100 (CET)","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 D3DB960592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 Dec 2021 01:33:02 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4A31E8AE;\n\tWed,  1 Dec 2021 01:33:02 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"MWffP1ko\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638318782;\n\tbh=V1RzSbfoAnj0M3jrvULz1qHWFHO7B8FsxoEmRsYMuQs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=MWffP1ko4DUI/0n4AzdrhiuUH+CUss8/npn2+/bxzNr4Y2QVrLye/pKbFXtZj9R+/\n\tH89nn5EHzJ6uAPbwoANYhLf2r5W0aDKDHzFHTYmekcaH3fc/AD+Ilb7l09RHcQjIu3\n\tBzairjFOoyPKgT1a/IrUaC2sQVYJ4Racx6mia9ZI=","Date":"Wed, 1 Dec 2021 02:32:37 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YabCpQRf4KpLJpv9@pendragon.ideasonboard.com>","References":"<20211130233634.34173-1-jacopo@jmondi.org>\n\t<20211130233634.34173-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211130233634.34173-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v3 01/11] libcamera: Print Timer\n\tidentifier","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21500,"web_url":"https://patchwork.libcamera.org/comment/21500/","msgid":"<20211201102547.43unyo4vo64r4srg@uno.localdomain>","date":"2021-12-01T10:25:47","subject":"Re: [libcamera-devel] [PATCH v3 01/11] libcamera: Print Timer\n\tidentifier","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent\n\nOn Wed, Dec 01, 2021 at 02:32:37AM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Wed, Dec 01, 2021 at 12:36:24AM +0100, Jacopo Mondi wrote:\n> > The Timer debug output does not report to which timer a condition refers\n> > to. Fix that by printing the Timer address.\n>\n> Do I assume correctly that this comes from an issue you were trying to\n> debug ? If so, could you share some information (for my own information,\n> doesn't have to be recorded in the commit message) ?\n\nI didn't have any specific issue, I wanted to be sure the 'right'\ntimer was started at the right time, but just that displying such\ninformation without saying to what timer they belong is not that useful\n\n>\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/base/event_dispatcher_poll.cpp | 3 ++-\n> >  src/libcamera/base/timer.cpp                 | 4 ++--\n> >  2 files changed, 4 insertions(+), 3 deletions(-)\n> >\n> > diff --git a/src/libcamera/base/event_dispatcher_poll.cpp b/src/libcamera/base/event_dispatcher_poll.cpp\n> > index 8ee22d5adcc4..20cc6e617189 100644\n> > --- a/src/libcamera/base/event_dispatcher_poll.cpp\n> > +++ b/src/libcamera/base/event_dispatcher_poll.cpp\n> > @@ -214,7 +214,8 @@ int EventDispatcherPoll::poll(std::vector<struct pollfd> *pollfds)\n> >  \t\t\ttimeout = { 0, 0 };\n> >\n> >  \t\tLOG(Event, Debug)\n> > -\t\t\t<< \"timeout \" << timeout.tv_sec << \".\"\n> > +\t\t\t<< \"timeout \" << nextTimer << \" \"\n> > +\t\t\t<< timeout.tv_sec << \".\"\n>\n> \"timeout <pointer> <value>\" could be a bit hard to read, how about\n>\n> \t\tLOG(Event, Debug)\n> \t\t\t<< \"next timer \" << nextTimer << \" expires in \"\n> \t\t\t<< timeout.tv_sec << \".\"\n> \t\t\t<< std::setfill('0') << std::setw(9)\n> \t\t\t<< timeout.tv_nsec;\n>\n> If you think that's overkill you can ignore it.\n>\n\nIt's good! I'll test how it looks like and I'll eventually take it in\n\n> >  \t\t\t<< std::setfill('0') << std::setw(9)\n> >  \t\t\t<< timeout.tv_nsec;\n> >  \t}\n> > diff --git a/src/libcamera/base/timer.cpp b/src/libcamera/base/timer.cpp\n> > index 9c54352d46bd..187336e3a1a4 100644\n> > --- a/src/libcamera/base/timer.cpp\n> > +++ b/src/libcamera/base/timer.cpp\n> > @@ -96,7 +96,7 @@ void Timer::start(std::chrono::milliseconds duration)\n> >  void Timer::start(std::chrono::steady_clock::time_point deadline)\n> >  {\n> >  \tif (Thread::current() != thread()) {\n> > -\t\tLOG(Timer, Error) << \"Timer can't be started from another thread\";\n> > +\t\tLOG(Timer, Error) << \"Timer \" << this << \" << can't be started from another thread\";\n>\n> Maybe a timer ID would be useful to have in the future for debugging\n> purpose. Then we could inherit from Loggable. For now this will do.\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThanks\n  j\n\n>\n> >  \t\treturn;\n> >  \t}\n> >\n> > @@ -128,7 +128,7 @@ void Timer::stop()\n> >  \t\treturn;\n> >\n> >  \tif (Thread::current() != thread()) {\n> > -\t\tLOG(Timer, Error) << \"Timer can't be stopped from another thread\";\n> > +\t\tLOG(Timer, Error) << \"Timer \" << this << \" can't be stopped from another thread\";\n> >  \t\treturn;\n> >  \t}\n> >\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 69C2EBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  1 Dec 2021 10:25:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3188860718;\n\tWed,  1 Dec 2021 11:25:00 +0100 (CET)","from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 46A976011D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  1 Dec 2021 11:24:58 +0100 (CET)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 07AE71C0007;\n\tWed,  1 Dec 2021 10:24:56 +0000 (UTC)"],"Date":"Wed, 1 Dec 2021 11:25:47 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20211201102547.43unyo4vo64r4srg@uno.localdomain>","References":"<20211130233634.34173-1-jacopo@jmondi.org>\n\t<20211130233634.34173-2-jacopo@jmondi.org>\n\t<YabCpQRf4KpLJpv9@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<YabCpQRf4KpLJpv9@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 01/11] libcamera: Print Timer\n\tidentifier","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]