[libcamera-devel] [PATCH v4 01/11] libcamera: Print Timer identifier
Jacopo Mondi
jacopo at jmondi.org
Wed Dec 1 15:29:26 CET 2021
The Timer debug output does not report to which timer a condition refers
to. Fix that by printing the Timer address.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
src/libcamera/base/event_dispatcher_poll.cpp | 9 +++++----
src/libcamera/base/timer.cpp | 4 ++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/libcamera/base/event_dispatcher_poll.cpp b/src/libcamera/base/event_dispatcher_poll.cpp
index 8ee22d5adcc4..7c5a3bb39ff9 100644
--- a/src/libcamera/base/event_dispatcher_poll.cpp
+++ b/src/libcamera/base/event_dispatcher_poll.cpp
@@ -213,10 +213,11 @@ int EventDispatcherPoll::poll(std::vector<struct pollfd> *pollfds)
else
timeout = { 0, 0 };
- LOG(Event, Debug)
- << "timeout " << timeout.tv_sec << "."
- << std::setfill('0') << std::setw(9)
- << timeout.tv_nsec;
+ LOG(Event, Debug)
+ << "next timer " << nextTimer << " expires in "
+ << timeout.tv_sec << "."
+ << std::setfill('0') << std::setw(9)
+ << timeout.tv_nsec;
}
return ppoll(pollfds->data(), pollfds->size(),
diff --git a/src/libcamera/base/timer.cpp b/src/libcamera/base/timer.cpp
index 9c54352d46bd..187336e3a1a4 100644
--- a/src/libcamera/base/timer.cpp
+++ b/src/libcamera/base/timer.cpp
@@ -96,7 +96,7 @@ void Timer::start(std::chrono::milliseconds duration)
void Timer::start(std::chrono::steady_clock::time_point deadline)
{
if (Thread::current() != thread()) {
- LOG(Timer, Error) << "Timer can't be started from another thread";
+ LOG(Timer, Error) << "Timer " << this << " << can't be started from another thread";
return;
}
@@ -128,7 +128,7 @@ void Timer::stop()
return;
if (Thread::current() != thread()) {
- LOG(Timer, Error) << "Timer can't be stopped from another thread";
+ LOG(Timer, Error) << "Timer " << this << " can't be stopped from another thread";
return;
}
--
2.33.1
More information about the libcamera-devel
mailing list