Performance improvement of DRC in the small layout case (log view overhead reduced)

This commit is contained in:
Matthias Koefferlein 2023-07-15 12:58:09 +02:00
parent b4502d1766
commit 0b50d9e87a
2 changed files with 11 additions and 1 deletions

View File

@ -120,6 +120,8 @@ LogFile::LogFile (size_t max_entries, bool register_global)
{
connect (&m_timer, SIGNAL (timeout ()), this, SLOT (timeout ()));
m_last_yield = tl::Clock::current ();
m_timer.setSingleShot (true);
m_timer.setInterval (0);
@ -190,6 +192,9 @@ LogFile::timeout ()
bool attn = false, last_attn = false;
m_lock.lock ();
m_last_yield = tl::Clock::current ();
if (m_generation_id != m_last_generation_id) {
attn = m_has_errors || m_has_warnings;
last_attn = m_last_attn;
@ -197,6 +202,7 @@ LogFile::timeout ()
m_last_generation_id = m_generation_id;
changed = true;
}
m_lock.unlock ();
if (changed) {
@ -254,7 +260,9 @@ LogFile::yield ()
{
// will update on next processEvents
if (lay::ApplicationBase::instance ()->qapp_gui () && QThread::currentThread () == lay::ApplicationBase::instance ()->qapp_gui ()->thread ()) {
m_timer.start ();
if ((tl::Clock::current () - m_last_yield).seconds () > 0.2) {
m_timer.start ();
}
}
}

View File

@ -26,6 +26,7 @@
#include "ui_LogViewerDialog.h"
#include "tlLog.h"
#include "tlTimer.h"
#include "layCommon.h"
#include <QTimer>
@ -220,6 +221,7 @@ signals:
void attention_changed (bool f);
private:
tl::Clock m_last_yield;
QTimer m_timer;
mutable QMutex m_lock;
LogReceiver m_error_receiver;