VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/activity/UIMonitorCommon.h@ 103164

Last change on this file since 103164 was 103164, checked in by vboxsync, 8 months ago

FE/Qt: bugref:10501. Moving some cloud machine related functions to the common code area.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/* $Id: UIMonitorCommon.h 103164 2024-02-01 16:14:28Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMonitorCommon class declaration.
4 */
5
6/*
7 * Copyright (C) 2016-2023 Oracle and/or its affiliates.
8 *
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
26 */
27
28#ifndef FEQT_INCLUDED_SRC_activity_UIMonitorCommon_h
29#define FEQT_INCLUDED_SRC_activity_UIMonitorCommon_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <QPainterPath>
35#include "UIProgressTask.h"
36#include "COMEnums.h"
37#include "CStringArray.h"
38#include "CCloudMachine.h"
39
40class SHARED_LIBRARY_STUFF UIProgressTaskReadCloudMachineMetricList : public UIProgressTask
41{
42 Q_OBJECT;
43
44signals:
45
46 void sigMetricListReceived(QVector<QString> metricNamesList);
47
48public:
49
50 UIProgressTaskReadCloudMachineMetricList(QObject *pParent, CCloudMachine comCloudMachine);
51
52protected:
53
54 virtual CProgress createProgress() RT_OVERRIDE;
55 virtual void handleProgressFinished(CProgress &comProgress) RT_OVERRIDE;
56
57private:
58
59 CCloudMachine m_comCloudMachine;
60 CStringArray m_metricNamesArray;
61};
62
63
64class SHARED_LIBRARY_STUFF UIProgressTaskReadCloudMachineMetricData : public UIProgressTask
65{
66 Q_OBJECT;
67
68signals:
69
70 void sigMetricDataReceived(KMetricType enmMetricType, QVector<QString> data, QVector<QString> timeStamps);
71
72public:
73
74 UIProgressTaskReadCloudMachineMetricData(QObject *pParent, CCloudMachine comCloudMachine,
75 KMetricType enmMetricType, ULONG uDataPointsCount);
76
77protected:
78
79 virtual CProgress createProgress() RT_OVERRIDE;
80 virtual void handleProgressFinished(CProgress &comProgress) RT_OVERRIDE;
81
82private:
83
84 CCloudMachine m_comCloudMachine;
85 CStringArray m_metricData;
86 CStringArray m_timeStamps;
87 KMetricType m_enmMetricType;
88 ULONG m_uDataPointsCount;
89};
90
91
92/** UIDebuggerMetricData is used as data storage while parsing the xml stream received from IMachineDebugger. */
93struct UIDebuggerMetricData
94{
95 UIDebuggerMetricData()
96 : m_counter(0){}
97 UIDebuggerMetricData(const QString &strName, quint64 counter)
98 : m_strName(strName)
99 , m_counter(counter){}
100 QString m_strName;
101 quint64 m_counter;
102};
103
104
105class SHARED_LIBRARY_STUFF UIMonitorCommon
106{
107
108public:
109
110 /** @name Static utility methods that query and parse IMachineDebugger outputs for specific metrix types.
111 * @{ */
112 static void getNetworkLoad(CMachineDebugger &debugger, quint64 &uOutNetworkReceived, quint64 &uOutNetworkTransmitted);
113 static void getDiskLoad(CMachineDebugger &debugger, quint64 &uOutDiskWritten, quint64 &uOutDiskRead);
114 static void getVMMExitCount(CMachineDebugger &debugger, quint64 &uOutVMMExitCount);
115 /** @} */
116 static void getRAMLoad(CPerformanceCollector &comPerformanceCollector, QVector<QString> &nameList,
117 QVector<CUnknown>& objectList, quint64 &iOutTotalRAM, quint64 &iOutFreeRAM);
118
119
120 static QPainterPath doughnutSlice(const QRectF &outerRectangle, const QRectF &innerRectangle, float fStartAngle, float fSweepAngle);
121 static QPainterPath wholeArc(const QRectF &rectangle);
122 static void drawCombinedDoughnutChart(quint64 data1, const QColor &data1Color,
123 quint64 data2, const QColor &data2Color,
124 QPainter &painter, quint64 iMaximum,
125 const QRectF &chartRect, const QRectF &innerRect, int iOverlayAlpha);
126
127 /* Returns a rectangle which is co-centric with @p outerFrame and scaled by @p fScaleX and fScaleY. */
128 static QRectF getScaledRect(const QRectF &outerFrame, float fScaleX, float fScaleY);
129
130 static void drawDoughnutChart(QPainter &painter, quint64 iMaximum, quint64 data,
131 const QRectF &chartRect, const QRectF &innerRect, int iOverlayAlpha, const QColor &color);
132
133 static quint64 determineTotalRAMAmount(CCloudMachine &comCloudMachine);
134
135private:
136
137 /** Parses the xml string we get from the IMachineDebugger and returns an array of UIDebuggerMetricData. */
138 static QVector<UIDebuggerMetricData> getAndParseStatsFromDebugger(CMachineDebugger &debugger, const QString &strQuery);
139
140};
141
142#endif /* !FEQT_INCLUDED_SRC_activity_UIMonitorCommon_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette