Changeset 27885 in vbox
- Timestamp:
- Mar 31, 2010 12:16:27 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 10 edited
-
GuestImpl.cpp (modified) (3 diffs)
-
MachineImpl.cpp (modified) (4 diffs)
-
Performance.cpp (modified) (3 diffs)
-
PerformanceImpl.cpp (modified) (1 diff)
-
VMMDevInterface.cpp (modified) (1 diff)
-
idl/VirtualBox.xidl (modified) (2 diffs)
-
include/GuestImpl.h (modified) (3 diffs)
-
include/MachineImpl.h (modified) (2 diffs)
-
include/Performance.h (modified) (4 diffs)
-
testcase/Makefile.kmk (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/GuestImpl.cpp
r27852 r27885 218 218 } 219 219 220 HRESULT Guest::GetStatisticsUpdateInterval(ULONG *aUpdateInterval)220 STDMETHODIMP Guest::COMGETTER(StatisticsUpdateInterval)(ULONG *aUpdateInterval) 221 221 { 222 222 CheckComArgOutPointerValid(aUpdateInterval); … … 224 224 AutoCaller autoCaller(this); 225 225 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 226 226 227 227 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 228 228 229 229 *aUpdateInterval = mStatUpdateInterval; 230 231 return S_OK; 232 } 233 234 HRESULT Guest::SetStatisticsUpdateInterval (ULONG aUpdateInterval) 230 return S_OK; 231 } 232 233 STDMETHODIMP Guest::COMSETTER(StatisticsUpdateInterval)(ULONG aUpdateInterval) 235 234 { 236 235 AutoCaller autoCaller(this); … … 247 246 return S_OK; 248 247 } 248 249 STDMETHODIMP Guest::InternalGetStatistics(ULONG aCpuId, ULONG *aCpuUser, ULONG *aCpuKernel, ULONG *aCpuIdle, 250 ULONG *aMemTotal, ULONG *aMemFree, ULONG *aMemBalloon, ULONG *aMemCache, 251 ULONG *aPageTotal, ULONG *aPageFree) 252 { 253 return S_OK; 254 } 255 249 256 250 257 STDMETHODIMP Guest::SetCredentials(IN_BSTR aUserName, IN_BSTR aPassword, -
trunk/src/VBox/Main/MachineImpl.cpp
r27874 r27885 8935 8935 8936 8936 /* Guest metrics */ 8937 mGuestHAL = new pm::CollectorGuestHAL(this); 8937 8938 8938 8939 /* Create sub metrics */ … … 8951 8952 8952 8953 pm::SubMetric *guestPagedTotal = new pm::SubMetric("Guest/Pagefile/Usage/Total", "Total amount of space in the page file."); 8953 pm::SubMetric *guestPagedFree = new pm::SubMetric("Guest/Pagefile/Usage/Free", "Total amount of free space in the page file."); 8954 8955 pm::SubMetric *guestSystemProc = new pm::SubMetric("Guest/System/Processes", "Total number of guest processes."); 8956 pm::SubMetric *guestSystemThread = new pm::SubMetric("Guest/System/Threads", "Total number of guest threads."); 8954 pm::SubMetric *guestPagedFree = new pm::SubMetric("Guest/Pagefile/Usage/Free", "Free amount of free space in the page file."); 8957 8955 8958 8956 /* Create and register base metrics */ 8959 pm::BaseMetric *guestCpuLoad = new pm::GuestCpuLoad( &mGuestHAL, aMachine, guestLoadUser, guestLoadKernel, guestLoadIdle);8957 pm::BaseMetric *guestCpuLoad = new pm::GuestCpuLoad(mGuestHAL, aMachine, guestLoadUser, guestLoadKernel, guestLoadIdle); 8960 8958 aCollector->registerBaseMetric(guestCpuLoad); 8961 8959 8962 pm::BaseMetric *guestCpuMem = new pm::GuestRamUsage( &mGuestHAL, aMachine, guestMemTotal, guestMemFree, guestMemBalloon,8960 pm::BaseMetric *guestCpuMem = new pm::GuestRamUsage(mGuestHAL, aMachine, guestMemTotal, guestMemFree, guestMemBalloon, 8963 8961 guestMemCache, guestPagedTotal, guestPagedFree); 8964 8962 aCollector->registerBaseMetric(guestCpuMem); 8965 8966 pm::BaseMetric *guestSystem = new pm::GuestSystemUsage(&mGuestHAL, aMachine, guestSystemProc, guestSystemThread);8967 aCollector->registerBaseMetric(guestSystem);8968 8969 8963 8970 8964 aCollector->registerMetric(new pm::Metric(guestCpuLoad, guestLoadUser, 0)); … … 9012 9006 aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedFree, new pm::AggregateMin())); 9013 9007 aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedFree, new pm::AggregateMax())); 9014 9015 aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemProc, 0));9016 aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemProc, new pm::AggregateAvg()));9017 aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemProc, new pm::AggregateMin()));9018 aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemProc, new pm::AggregateMax()));9019 9020 aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemThread, 0));9021 aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemThread, new pm::AggregateAvg()));9022 aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemThread, new pm::AggregateMin()));9023 aCollector->registerMetric(new pm::Metric(guestSystem, guestSystemThread, new pm::AggregateMax()));9024 9008 }; 9025 9009 … … 9028 9012 aCollector->unregisterMetricsFor(aMachine); 9029 9013 aCollector->unregisterBaseMetricsFor(aMachine); 9014 9015 if (mGuestHAL) 9016 delete mGuestHAL; 9030 9017 }; 9031 9018 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ -
trunk/src/VBox/Main/Performance.cpp
r27858 r27885 28 28 */ 29 29 30 #ifndef VBOX_COLLECTOR_TEST_CASE 31 #include "VirtualBoxImpl.h" 32 #include "MachineImpl.h" 33 #endif 30 34 #include "Performance.h" 31 35 … … 119 123 } 120 124 125 #ifndef VBOX_COLLECTOR_TEST_CASE 121 126 CollectorGuestHAL::~CollectorGuestHAL() 122 127 { 123 // if (cEnabled) 124 // 128 Assert(!cEnabled); 125 129 } 126 130 127 131 int CollectorGuestHAL::enable() 128 132 { 133 HRESULT ret = S_OK; 134 135 if (ASMAtomicIncU32(&cEnabled) == 1) 136 { 137 #if 0 138 ComPtr<IInternalSessionControl> directControl; 139 140 ret = mMachine->getDirectControl(&directControl); 141 if (ret != S_OK) 142 return ret; 143 144 /* get the associated console */ 145 ComPtr<IConsole> console; 146 ret = directControl->COMGETTER(Console)(console.asOutParam())); 147 if (ret != S_OK) 148 return ret; 149 150 ComPtr<IGuest> guest; 151 ret = console->COMGETTER(Guest)(guest.asOutParam()); 152 if (ret == S_OK) 153 { 154 } 155 #endif 156 } 157 return ret; 158 } 159 160 int CollectorGuestHAL::disable() 161 { 162 if (ASMAtomicDecU32(&cEnabled) == 0) 163 { 164 } 129 165 return S_OK; 130 166 } 131 132 int CollectorGuestHAL::disable() 133 { 134 return S_OK; 135 } 167 #endif /* VBOX_COLLECTOR_TEST_CASE */ 136 168 137 169 bool BaseMetric::collectorBeat(uint64_t nowAt) … … 397 429 #endif 398 430 } 399 400 void GuestSystemUsage::init(ULONG period, ULONG length)401 {402 mPeriod = period;403 mLength = length;404 405 mThreads->init(mLength);406 mProcesses->init(mLength);407 }408 409 void GuestSystemUsage::preCollect(CollectorHints& /* hints */)410 {411 }412 413 void GuestSystemUsage::collect()414 {415 #if 0416 ULONG used;417 int rc = mHAL->getProcessMemoryUsage(mProcess, &used);418 if (RT_SUCCESS(rc))419 mUsed->put(used);420 #endif421 }422 423 431 424 432 void CircularBuffer::init(ULONG ulLength) -
trunk/src/VBox/Main/PerformanceImpl.cpp
r27822 r27885 92 92 "Guest/Pagefile/Usage/Free:min", 93 93 "Guest/Pagefile/Usage/Free:max", 94 "Guest/System/Processes",95 "Guest/System/Processes:avg",96 "Guest/System/Processes:min",97 "Guest/System/Processes:max",98 "Guest/System/Threads",99 "Guest/System/Threads:avg",100 "Guest/System/Threads:min",101 "Guest/System/Threads:max",102 94 }; 103 95 -
trunk/src/VBox/Main/VMMDevInterface.cpp
r27822 r27885 431 431 return VERR_INVALID_PARAMETER; /** @todo wrong error */ 432 432 433 guest-> GetStatisticsUpdateInterval(&val);433 guest->COMGETTER(StatisticsUpdateInterval)(&val); 434 434 *pulInterval = val; 435 435 return VINF_SUCCESS; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r27857 r27885 8353 8353 <interface 8354 8354 name="IGuest" extends="$unknown" 8355 uuid=" 2f6fba62-0d41-42fd-a891-51b7d87a9e84"8355 uuid="66dfe00b-f174-40d8-9d78-4e30d58137ed" 8356 8356 wsmap="managed" 8357 8357 > … … 8417 8417 <desc>Guest system memory balloon size in megabytes.</desc> 8418 8418 </attribute> 8419 8420 <attribute name="statisticsUpdateInterval" type="unsigned long"> 8421 <desc>Interval to update guest statistics in seconds.</desc> 8422 </attribute> 8423 8424 <method name="internalGetStatistics"> 8425 <desc> 8426 Internal method; do not use as it might change at any time 8427 </desc> 8428 <param name="cpuId" type="unsigned long" dir="in"> 8429 <desc>Virtual CPU id</desc> 8430 </param> 8431 <param name="cpuUser" type="unsigned long" dir="out"> 8432 <desc>Percentage of processor time spent in user mode as seen by the guest</desc> 8433 </param> 8434 <param name="cpuKernel" type="unsigned long" dir="out"> 8435 <desc>Percentage of processor time spent in kernel mode as seen by the guest</desc> 8436 </param> 8437 <param name="cpuIdle" type="unsigned long" dir="out"> 8438 <desc>Percentage of processor time spent idling as seen by the guest</desc> 8439 </param> 8440 <param name="memTotal" type="unsigned long" dir="out"> 8441 <desc>Total amount of physical guest RAM</desc> 8442 </param> 8443 <param name="memFree" type="unsigned long" dir="out"> 8444 <desc>Free amount of physical guest RAM</desc> 8445 </param> 8446 <param name="memBalloon" type="unsigned long" dir="out"> 8447 <desc>Amount of ballooned physical guest RAM</desc> 8448 </param> 8449 <param name="memCache" type="unsigned long" dir="out"> 8450 <desc>Total amount of guest (disk) cache memory</desc> 8451 </param> 8452 <param name="pagedTotal" type="unsigned long" dir="out"> 8453 <desc>Total amount of space in the page file</desc> 8454 </param> 8455 <param name="pagedFree" type="unsigned long" dir="out"> 8456 <desc>Free amount of space in the page file</desc> 8457 </param> 8458 </method> 8419 8459 8420 8460 <method name="setCredentials"> -
trunk/src/VBox/Main/include/GuestImpl.h
r27822 r27885 27 27 28 28 class Console; 29 30 #define GUEST_STAT_INVALID (ULONG)-131 29 32 30 class ATL_NO_VTABLE Guest : … … 65 63 STDMETHOD(COMGETTER(MemoryBalloonSize)) (ULONG *aMemoryBalloonSize); 66 64 STDMETHOD(COMSETTER(MemoryBalloonSize)) (ULONG aMemoryBalloonSize); 65 STDMETHOD(COMGETTER(StatisticsUpdateInterval)) (ULONG *aUpdateInterval); 66 STDMETHOD(COMSETTER(StatisticsUpdateInterval)) (ULONG aUpdateInterval); 67 67 68 68 // IGuest methods … … 74 74 IN_BSTR aUserName, IN_BSTR aPassword, 75 75 ULONG aTimeoutMS, ULONG* aPID); 76 STDMETHOD(InternalGetStatistics)(ULONG aCpuId, ULONG *aCpuUser, ULONG *aCpuKernel, ULONG *aCpuIdle, 77 ULONG *aMemTotal, ULONG *aMemFree, ULONG *aMemBalloon, ULONG *aMemCache, 78 ULONG *aPageTotal, ULONG *aPageFree); 76 79 77 80 // public methods that are not in IDL -
trunk/src/VBox/Main/include/MachineImpl.h
r27849 r27885 624 624 HRESULT openExistingSession(IInternalSessionControl *aControl); 625 625 626 HRESULT getDirectControl(ComPtr<IInternalSessionControl> *directControl) 627 { 628 HRESULT rc; 629 *directControl = mData->mSession.mDirectControl; 630 631 if (!*directControl) 632 rc = E_ACCESSDENIED; 633 else 634 rc = S_OK; 635 636 return rc; 637 } 638 626 639 #if defined(RT_OS_WINDOWS) 627 640 … … 796 809 void unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine); 797 810 798 pm::CollectorGuestHAL mGuestHAL;811 pm::CollectorGuestHAL *mGuestHAL; 799 812 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 800 813 -
trunk/src/VBox/Main/include/Performance.h
r27849 r27885 35 35 #include <list> 36 36 #include <vector> 37 38 /* Forward decl. */ 39 class Machine; 37 40 38 41 namespace pm … … 162 165 { 163 166 public: 164 CollectorGuestHAL( ) : cEnabled(0) {};167 CollectorGuestHAL(Machine *machine) : cEnabled(0), mMachine(machine) {}; 165 168 ~CollectorGuestHAL(); 166 169 … … 170 173 virtual int disable(); 171 174 protected: 172 unsigned cEnabled; 175 uint32_t cEnabled; 176 Machine *mMachine; 173 177 }; 174 178 … … 383 387 private: 384 388 SubMetric *mTotal, *mFree, *mBallooned, *mCache, *mPagedTotal, *mPagedFree; 385 };386 387 class GuestSystemUsage : public BaseMetric388 {389 public:390 GuestSystemUsage(CollectorGuestHAL *hal, ComPtr<IUnknown> object, SubMetric *processes, SubMetric *threads)391 : BaseMetric(hal, "System/Usage", object), mProcesses(processes), mThreads(threads) {};392 ~GuestSystemUsage() { delete mProcesses; delete mThreads; };393 394 void init(ULONG period, ULONG length);395 void preCollect(CollectorHints& hints);396 void collect();397 const char *getUnit() { return "kB"; };398 ULONG getMinValue() { return 0; };399 ULONG getMaxValue() { return INT32_MAX; };400 ULONG getScale() { return 1; }401 private:402 SubMetric *mProcesses, *mThreads;403 389 }; 404 390 -
trunk/src/VBox/Main/testcase/Makefile.kmk
r23848 r27885 113 113 ../Performance.cpp 114 114 tstCollector_INCS = ../include 115 tstCollector_DEFS += VBOX_COLLECTOR_TEST_CASE 115 116 tstCollector_LDFLAGS.darwin += -lproc 116 117 tstCollector_LDFLAGS.solaris += -lkstat
Note:
See TracChangeset
for help on using the changeset viewer.

