Add FPS counter
This commit is contained in:
@ -39,6 +39,13 @@ Pane {
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
text: __controller.performance + ' FPS'
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.fillHeight: true
|
||||
|
||||
|
@ -149,6 +149,8 @@ void DmxController::sendDmxBuffer()
|
||||
if (m_lastInfo.msecsTo(now) >= 1000)
|
||||
{
|
||||
qInfo("%i per second", m_counter);
|
||||
m_lastCounter = m_counter;
|
||||
emit performanceChanged(m_counter);
|
||||
m_counter = 0;
|
||||
m_lastInfo = now;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
class DmxController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int performance READ performance NOTIFY performanceChanged)
|
||||
|
||||
public:
|
||||
explicit DmxController(QObject *parent = nullptr);
|
||||
@ -24,6 +25,11 @@ public:
|
||||
|
||||
QReadWriteLock &projectLock() { return m_projectLock; }
|
||||
|
||||
int performance() const { return m_lastCounter; }
|
||||
|
||||
signals:
|
||||
void performanceChanged(int performance);
|
||||
|
||||
protected:
|
||||
friend class DmxControllerThread;
|
||||
|
||||
@ -41,4 +47,5 @@ private:
|
||||
|
||||
QDateTime m_lastInfo;
|
||||
int m_counter;
|
||||
std::atomic<int> m_lastCounter;
|
||||
};
|
||||
|
Reference in New Issue
Block a user