Skip to content
Snippets Groups Projects
Commit 3b1729c4 authored by Eloi Bail's avatar Eloi Bail Committed by Guillaume Roguez
Browse files

daemon: re-implement fps display within logs


Refs #68874

Change-Id: Ic53407f183d79327972ecb9e490cb246023478a7
Signed-off-by: default avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent 9142eb77
Branches
Tags
No related merge requests found
......@@ -284,6 +284,10 @@ SinkClient::stop() noexcept
#endif // !HAVE_SHM
SinkClient::SinkClient(const std::string& id) : id_ {id}
#ifdef DEBUG_FPS
, frameCount_(0u)
, lastFrameDebug_(std::chrono::system_clock::now())
#endif
{}
void
......@@ -292,6 +296,17 @@ SinkClient::update(Observable<std::shared_ptr<VideoFrame>>* /*obs*/,
{
auto f = frame_p; // keep a local reference during rendering
#ifdef DEBUG_FPS
auto currentTime = std::chrono::system_clock::now();
const std::chrono::duration<double> seconds = currentTime - lastFrameDebug_;
++frameCount_;
if (seconds.count() > 1) {
RING_DBG("%s: FPS %f", id_.c_str(), frameCount_ / seconds.count());
frameCount_ = 0;
lastFrameDebug_ = currentTime;
}
#endif
#if HAVE_SHM
shm_->render_frame(*f.get());
#endif
......
......@@ -80,6 +80,11 @@ class SinkClient : public VideoFramePassiveReader
std::function<void(unsigned char*)> target_;
std::vector<unsigned char> targetData_;
#ifdef DEBUG_FPS
unsigned frameCount_;
std::chrono::time_point<std::chrono::system_clock> lastFrameDebug_;
#endif
#if HAVE_SHM
// using shared_ptr and not unique_ptr as ShmHolder is forwared only
std::shared_ptr<ShmHolder> shm_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment