forked from qt-creator/qt-creator
AppStatisticMonitor: add empty data provider for non-implemented OSes
Add a NullDataProvider to support building & running on OSes that do not have an actual data provider implemented (currently Linux, Windows, macOS). Limit also the instantiation of a LinuxDataProvider to Linux, as that data provider is built only on Linux. Change-Id: Ia9bea9e6d76ee6558efe62e16a9fcf559ab0a4d7 Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
@@ -329,14 +329,36 @@ private:
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ------------------------- NullDataProvider --------------------------------
|
||||||
|
|
||||||
|
class NullDataProvider : public IDataProvider
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NullDataProvider(qint64 pid, QObject *parent = nullptr)
|
||||||
|
: IDataProvider(pid, parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
double getCpuConsumption()
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double getMemoryConsumption()
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
IDataProvider *createDataProvider(qint64 pid)
|
IDataProvider *createDataProvider(qint64 pid)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return new WindowsDataProvider(pid);
|
return new WindowsDataProvider(pid);
|
||||||
#elif defined(Q_OS_MACOS)
|
#elif defined(Q_OS_MACOS)
|
||||||
return new MacDataProvider(pid);
|
return new MacDataProvider(pid);
|
||||||
#else // Q_OS_LINUX
|
#elif defined(Q_OS_LINUX)
|
||||||
return new LinuxDataProvider(pid);
|
return new LinuxDataProvider(pid);
|
||||||
|
#else
|
||||||
|
return new NullDataProvider(pid);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user