Changeset 10679 in vbox for trunk/src/VBox/Main/Performance.cpp
- Timestamp:
- Jul 15, 2008 6:59:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Performance.cpp
r10641 r10679 22 22 */ 23 23 24 #include <VBox/com/array.h> 24 25 #include <VBox/com/ptr.h> 26 #include <VBox/com/string.h> 25 27 #include <VBox/err.h> 26 28 #include <iprt/string.h> … … 219 221 } 220 222 223 void HostCpuMhz::init(unsigned long period, unsigned long length) 224 { 225 mPeriod = period; 226 mLength = length; 227 mMHz->init(mLength); 228 } 229 221 230 void HostCpuMhz::collect() 222 231 { … … 224 233 mHAL->getHostCpuMHz(&mhz); 225 234 mMHz->put(mhz); 235 } 236 237 void HostRamUsage::init(unsigned long period, unsigned long length) 238 { 239 mPeriod = period; 240 mLength = length; 241 mTotal->init(mLength); 242 mUsed->init(mLength); 243 mAvailable->init(mLength); 226 244 } 227 245 … … 236 254 237 255 256 257 void MachineCpuLoad::init(unsigned long period, unsigned long length) 258 { 259 mPeriod = period; 260 mLength = length; 261 mUser->init(mLength); 262 mKernel->init(mLength); 263 } 264 238 265 void MachineCpuLoad::collect() 239 266 { … … 259 286 mProcessUserPrev = processUser; 260 287 mProcessKernelPrev = processKernel; 288 } 289 290 void MachineRamUsage::init(unsigned long period, unsigned long length) 291 { 292 mPeriod = period; 293 mLength = length; 294 mUsed->init(mLength); 261 295 } 262 296 … … 361 395 } 362 396 397 Filter::Filter(ComSafeArrayIn(const BSTR, metricNames), 398 ComSafeArrayIn(IUnknown *, objects)) 399 { 400 com::SafeIfaceArray <IUnknown> objectArray(ComSafeArrayInArg(objects)); 401 com::SafeArray <BSTR> nameArray(ComSafeArrayInArg(metricNames)); 402 for (size_t i = 0; i < objectArray.size(); ++i) 403 processMetricList(std::string(com::Utf8Str(nameArray[i])), objectArray[i]); 404 } 405 406 void Filter::processMetricList(const std::string &name, const IUnknown *object) 407 { 408 std::string::size_type startPos = 0; 409 410 for (std::string::size_type pos = name.find(","); 411 pos != std::string::npos; 412 pos = name.find(",", startPos)) 413 { 414 mElements.push_back(std::make_pair(object, name.substr(startPos, pos - startPos))); 415 startPos = pos + 1; 416 } 417 mElements.push_back(std::make_pair(object, name.substr(startPos))); 418 } 419 420 bool Filter::match(const IUnknown *object, const std::string &name) const 421 { 422 return true; 423 }
Note:
See TracChangeset
for help on using the changeset viewer.