Add function to main window to query CPU usage
parent
0364672cbb
commit
a9b3da010d
|
@ -88,6 +88,8 @@ OBSBasic::OBSBasic(QWidget *parent)
|
|||
this,
|
||||
SLOT(SceneItemNameEdited(QWidget*,
|
||||
QAbstractItemDelegate::EndEditHint)));
|
||||
|
||||
cpuUsageInfo = os_cpu_usage_info_start();
|
||||
}
|
||||
|
||||
static void SaveAudioDevice(const char *name, int channel, obs_data_t parent)
|
||||
|
@ -550,6 +552,8 @@ OBSBasic::~OBSBasic()
|
|||
* can be freed, and we have no control over the destruction order of
|
||||
* the Qt UI stuff, so we have to manually clear any references to
|
||||
* libobs. */
|
||||
os_cpu_usage_info_destroy(cpuUsageInfo);
|
||||
|
||||
delete properties;
|
||||
delete transformWindow;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "window-basic-properties.hpp"
|
||||
#include "window-basic-transform.hpp"
|
||||
|
||||
#include <util/platform.h>
|
||||
#include <util/util.hpp>
|
||||
|
||||
#include <QPointer>
|
||||
|
@ -61,6 +62,8 @@ private:
|
|||
|
||||
QNetworkAccessManager networkManager;
|
||||
|
||||
os_cpu_usage_info_t cpuUsageInfo = nullptr;
|
||||
|
||||
QBuffer logUploadPostData;
|
||||
QNetworkReply *logUploadReply = nullptr;
|
||||
QByteArray logUploadReturnData;
|
||||
|
@ -199,6 +202,11 @@ public:
|
|||
cy = previewCY;
|
||||
}
|
||||
|
||||
inline double GetCPUUsage() const
|
||||
{
|
||||
return os_cpu_usage_info_query(cpuUsageInfo);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual void changeEvent(QEvent *event) override;
|
||||
|
|
Loading…
Reference in New Issue