[59646] | 1 | /* $Id: UIMonitorCommon.h 103803 2024-03-12 11:15:18Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
[83346] | 3 | * VBox Qt GUI - UIMonitorCommon class declaration.
|
---|
[59646] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2016-2023 Oracle and/or its affiliates.
|
---|
[59646] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
| 25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
[59646] | 26 | */
|
---|
| 27 |
|
---|
[88119] | 28 | #ifndef FEQT_INCLUDED_SRC_activity_UIMonitorCommon_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_activity_UIMonitorCommon_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[59646] | 33 |
|
---|
[103131] | 34 | #include <QPainterPath>
|
---|
| 35 | #include "UIProgressTask.h"
|
---|
| 36 | #include "CStringArray.h"
|
---|
| 37 | #include "CCloudMachine.h"
|
---|
| 38 |
|
---|
| 39 | class SHARED_LIBRARY_STUFF UIProgressTaskReadCloudMachineMetricList : public UIProgressTask
|
---|
| 40 | {
|
---|
| 41 | Q_OBJECT;
|
---|
| 42 |
|
---|
| 43 | signals:
|
---|
| 44 |
|
---|
| 45 | void sigMetricListReceived(QVector<QString> metricNamesList);
|
---|
| 46 |
|
---|
| 47 | public:
|
---|
| 48 |
|
---|
| 49 | UIProgressTaskReadCloudMachineMetricList(QObject *pParent, CCloudMachine comCloudMachine);
|
---|
| 50 |
|
---|
| 51 | protected:
|
---|
| 52 |
|
---|
| 53 | virtual CProgress createProgress() RT_OVERRIDE;
|
---|
| 54 | virtual void handleProgressFinished(CProgress &comProgress) RT_OVERRIDE;
|
---|
| 55 |
|
---|
| 56 | private:
|
---|
| 57 |
|
---|
| 58 | CCloudMachine m_comCloudMachine;
|
---|
| 59 | CStringArray m_metricNamesArray;
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | class SHARED_LIBRARY_STUFF UIProgressTaskReadCloudMachineMetricData : public UIProgressTask
|
---|
| 64 | {
|
---|
| 65 | Q_OBJECT;
|
---|
| 66 |
|
---|
| 67 | signals:
|
---|
| 68 |
|
---|
| 69 | void sigMetricDataReceived(KMetricType enmMetricType, QVector<QString> data, QVector<QString> timeStamps);
|
---|
| 70 |
|
---|
| 71 | public:
|
---|
| 72 |
|
---|
| 73 | UIProgressTaskReadCloudMachineMetricData(QObject *pParent, CCloudMachine comCloudMachine,
|
---|
| 74 | KMetricType enmMetricType, ULONG uDataPointsCount);
|
---|
| 75 |
|
---|
| 76 | protected:
|
---|
| 77 |
|
---|
| 78 | virtual CProgress createProgress() RT_OVERRIDE;
|
---|
| 79 | virtual void handleProgressFinished(CProgress &comProgress) RT_OVERRIDE;
|
---|
| 80 |
|
---|
| 81 | private:
|
---|
| 82 |
|
---|
| 83 | CCloudMachine m_comCloudMachine;
|
---|
| 84 | CStringArray m_metricData;
|
---|
| 85 | CStringArray m_timeStamps;
|
---|
| 86 | KMetricType m_enmMetricType;
|
---|
| 87 | ULONG m_uDataPointsCount;
|
---|
| 88 | };
|
---|
| 89 |
|
---|
| 90 |
|
---|
[81097] | 91 | /** UIDebuggerMetricData is used as data storage while parsing the xml stream received from IMachineDebugger. */
|
---|
| 92 | struct UIDebuggerMetricData
|
---|
[80406] | 93 | {
|
---|
[81097] | 94 | UIDebuggerMetricData()
|
---|
[80406] | 95 | : m_counter(0){}
|
---|
[97654] | 96 | UIDebuggerMetricData(const QString &strName, quint64 counter)
|
---|
| 97 | : m_strName(strName)
|
---|
[80406] | 98 | , m_counter(counter){}
|
---|
| 99 | QString m_strName;
|
---|
[80494] | 100 | quint64 m_counter;
|
---|
[80406] | 101 | };
|
---|
| 102 |
|
---|
[81097] | 103 |
|
---|
[83346] | 104 | class SHARED_LIBRARY_STUFF UIMonitorCommon
|
---|
[59646] | 105 | {
|
---|
| 106 |
|
---|
| 107 | public:
|
---|
| 108 |
|
---|
[89000] | 109 | /** @name Static utility methods that query and parse IMachineDebugger outputs for specific metrix types.
|
---|
[83304] | 110 | * @{ */
|
---|
| 111 | static void getNetworkLoad(CMachineDebugger &debugger, quint64 &uOutNetworkReceived, quint64 &uOutNetworkTransmitted);
|
---|
| 112 | static void getDiskLoad(CMachineDebugger &debugger, quint64 &uOutDiskWritten, quint64 &uOutDiskRead);
|
---|
| 113 | static void getVMMExitCount(CMachineDebugger &debugger, quint64 &uOutVMMExitCount);
|
---|
| 114 | /** @} */
|
---|
[83380] | 115 | static void getRAMLoad(CPerformanceCollector &comPerformanceCollector, QVector<QString> &nameList,
|
---|
| 116 | QVector<CUnknown>& objectList, quint64 &iOutTotalRAM, quint64 &iOutFreeRAM);
|
---|
[83304] | 117 |
|
---|
[83496] | 118 |
|
---|
| 119 | static QPainterPath doughnutSlice(const QRectF &outerRectangle, const QRectF &innerRectangle, float fStartAngle, float fSweepAngle);
|
---|
| 120 | static QPainterPath wholeArc(const QRectF &rectangle);
|
---|
| 121 | static void drawCombinedDoughnutChart(quint64 data1, const QColor &data1Color,
|
---|
| 122 | quint64 data2, const QColor &data2Color,
|
---|
| 123 | QPainter &painter, quint64 iMaximum,
|
---|
| 124 | const QRectF &chartRect, const QRectF &innerRect, int iOverlayAlpha);
|
---|
| 125 |
|
---|
[83509] | 126 | /* Returns a rectangle which is co-centric with @p outerFrame and scaled by @p fScaleX and fScaleY. */
|
---|
| 127 | static QRectF getScaledRect(const QRectF &outerFrame, float fScaleX, float fScaleY);
|
---|
[83496] | 128 |
|
---|
[83509] | 129 | static void drawDoughnutChart(QPainter &painter, quint64 iMaximum, quint64 data,
|
---|
| 130 | const QRectF &chartRect, const QRectF &innerRect, int iOverlayAlpha, const QColor &color);
|
---|
| 131 |
|
---|
[103164] | 132 | static quint64 determineTotalRAMAmount(CCloudMachine &comCloudMachine);
|
---|
| 133 |
|
---|
[80369] | 134 | private:
|
---|
[80381] | 135 |
|
---|
[81097] | 136 | /** Parses the xml string we get from the IMachineDebugger and returns an array of UIDebuggerMetricData. */
|
---|
[83304] | 137 | static QVector<UIDebuggerMetricData> getAndParseStatsFromDebugger(CMachineDebugger &debugger, const QString &strQuery);
|
---|
[80406] | 138 |
|
---|
[59646] | 139 | };
|
---|
| 140 |
|
---|
[88119] | 141 | #endif /* !FEQT_INCLUDED_SRC_activity_UIMonitorCommon_h */
|
---|