<commit_before>
#include <gloperate-qt/viewer/UpdateManager.h>

#include <QTime>

#include <gloperate/viewer/ViewerContext.h>


namespace gloperate_qt
{


UpdateManager::UpdateManager(gloperate::ViewerContext * viewerContext)
: m_viewerContext(viewerContext)
{
    // Connect update timer
    QObject::connect(
        &m_timer, &QTimer::timeout,
        this, &UpdateManager::onTimer
    );

    // Setup timer
    m_timer.setSingleShot(false);
    m_timer.start(0);

    // Start time measurement
    m_time.start();
}

UpdateManager::~UpdateManager()
{
}

void UpdateManager::wakeTimer()
{
    m_timer.start(0);
}

void UpdateManager::onTimer()
{
    // Get time delta
    float delta = m_time.elapsed() / 1000.0f;
    m_time.restart();

    // Update timing
    if (!m_viewerContext->update(delta))
    {
        m_timer.stop();
    }
}
<commit_msg>Do not use Qt timer to calculate time delta, let time manager use its high-performance timer instead<commit_after>
#include <gloperate-qt/viewer/UpdateManager.h>

#include <QTime>

#include <gloperate/viewer/ViewerContext.h>


namespace gloperate_qt
{


UpdateManager::UpdateManager(gloperate::ViewerContext * viewerContext)
: m_viewerContext(viewerContext)
{
    // Connect update timer
    QObject::connect(
        &m_timer, &QTimer::timeout,
        this, &UpdateManager::onTimer
    );

    // Setup timer
    m_timer.setSingleShot(false);
    m_timer.start(0);

    // Start time measurement
    m_time.start();
}

UpdateManager::~UpdateManager()
{
}

void UpdateManager::wakeTimer()
{
    m_timer.start(0);
}

void UpdateManager::onTimer()
{
    // Restart timer
    m_time.restart();

    // Update timing
    if (!m_viewerContext->update())
    {
        m_timer.stop();
    }
}

{'fraction_non_alphanumeric': 0.13038483630097644, 'fraction_numerical': 0.005169442848937392, 'mean_word_length': 3.4213197969543145, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1557421', 'n_tokens_mistral': 603, 'n_tokens_neox': 589, 'n_words': 105}