Changeset 26186 in vbox for trunk/src/VBox/Main/HostImpl.cpp
- Timestamp:
- Feb 3, 2010 1:07:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r26177 r26186 225 225 */ 226 226 # if defined (RT_OS_DARWIN) 227 m->pUSBProxyService = new USBProxyServiceDarwin 227 m->pUSBProxyService = new USBProxyServiceDarwin(this); 228 228 # elif defined (RT_OS_LINUX) 229 m->pUSBProxyService = new USBProxyServiceLinux 229 m->pUSBProxyService = new USBProxyServiceLinux(this); 230 230 # elif defined (RT_OS_OS2) 231 231 m->pUSBProxyService = new USBProxyServiceOs2 (this); 232 232 # elif defined (RT_OS_SOLARIS) 233 m->pUSBProxyService = new USBProxyServiceSolaris 233 m->pUSBProxyService = new USBProxyServiceSolaris(this); 234 234 # elif defined (RT_OS_WINDOWS) 235 m->pUSBProxyService = new USBProxyServiceWindows 235 m->pUSBProxyService = new USBProxyServiceWindows(this); 236 236 # elif defined (RT_OS_FREEBSD) 237 m->pUSBProxyService = new USBProxyServiceFreeBSD 237 m->pUSBProxyService = new USBProxyServiceFreeBSD(this); 238 238 # else 239 m->pUSBProxyService = new USBProxyService 239 m->pUSBProxyService = new USBProxyService(this); 240 240 # endif 241 241 HRESULT hrc = m->pUSBProxyService->init(); … … 248 248 249 249 #if defined (RT_OS_WINDOWS) 250 m->pHostPowerService = new HostPowerServiceWin 250 m->pHostPowerService = new HostPowerServiceWin(m->pParent); 251 251 #elif defined (RT_OS_DARWIN) 252 m->pHostPowerService = new HostPowerServiceDarwin 252 m->pHostPowerService = new HostPowerServiceDarwin(m->pParent); 253 253 #else 254 m->pHostPowerService = new HostPowerService 254 m->pHostPowerService = new HostPowerService(m->pParent); 255 255 #endif 256 256 … … 1157 1157 ComObjPtr<HostUSBDeviceFilter> filter; 1158 1158 filter.createObject(); 1159 HRESULT rc = filter->init 1159 HRESULT rc = filter->init(this, aName); 1160 1160 ComAssertComRCRet (rc, rc); 1161 1161 rc = filter.queryInterfaceTo(aFilter); … … 1203 1203 1204 1204 if (pFilter->mInList) 1205 return setError 1206 tr("The given USB device filter is already in the list"));1205 return setError(E_INVALIDARG, 1206 tr("The given USB device filter is already in the list")); 1207 1207 1208 1208 /* iterate to the position... */ … … 1248 1248 1249 1249 if (!m->llUSBDeviceFilters.size()) 1250 return setError 1251 tr("The USB device filter list is empty"));1250 return setError(E_INVALIDARG, 1251 tr("The USB device filter list is empty")); 1252 1252 1253 1253 if (aPosition >= m->llUSBDeviceFilters.size()) 1254 return setError 1255 tr("Invalid position: %lu (must be in range [0, %lu])"),1256 aPosition, m->llUSBDeviceFilters.size() - 1);1254 return setError(E_INVALIDARG, 1255 tr("Invalid position: %lu (must be in range [0, %lu])"), 1256 aPosition, m->llUSBDeviceFilters.size() - 1); 1257 1257 1258 1258 ComObjPtr<HostUSBDeviceFilter> filter; … … 1369 1369 1370 1370 if (!found) 1371 return setError (E_INVALIDARG, HostNetworkInterface::tr (1372 1371 return setError(E_INVALIDARG, 1372 HostNetworkInterface::tr("The host network interface with the given name could not be found")); 1373 1373 1374 1374 found->setVirtualBox(m->pParent); … … 1407 1407 1408 1408 if (!found) 1409 return setError (E_INVALIDARG, HostNetworkInterface::tr (1410 1409 return setError(E_INVALIDARG, 1410 HostNetworkInterface::tr("The host network interface with the given GUID could not be found")); 1411 1411 1412 1412 found->setVirtualBox(m->pParent); … … 1448 1448 1449 1449 STDMETHODIMP Host::FindUSBDeviceByAddress(IN_BSTR aAddress, 1450 IHostUSBDevice **aDevice)1450 IHostUSBDevice **aDevice) 1451 1451 { 1452 1452 #ifdef VBOX_WITH_USB … … 2402 2402 2403 2403 #ifdef VBOX_WITH_RESOURCE_USAGE_API 2404 void Host::registerMetrics 2404 void Host::registerMetrics(PerformanceCollector *aCollector) 2405 2405 { 2406 2406 pm::CollectorHAL *hal = aCollector->getHAL(); 2407 2407 /* Create sub metrics */ 2408 pm::SubMetric *cpuLoadUser = new pm::SubMetric 2408 pm::SubMetric *cpuLoadUser = new pm::SubMetric("CPU/Load/User", 2409 2409 "Percentage of processor time spent in user mode."); 2410 pm::SubMetric *cpuLoadKernel = new pm::SubMetric 2410 pm::SubMetric *cpuLoadKernel = new pm::SubMetric("CPU/Load/Kernel", 2411 2411 "Percentage of processor time spent in kernel mode."); 2412 pm::SubMetric *cpuLoadIdle = new pm::SubMetric 2412 pm::SubMetric *cpuLoadIdle = new pm::SubMetric("CPU/Load/Idle", 2413 2413 "Percentage of processor time spent idling."); 2414 pm::SubMetric *cpuMhzSM = new pm::SubMetric 2414 pm::SubMetric *cpuMhzSM = new pm::SubMetric("CPU/MHz", 2415 2415 "Average of current frequency of all processors."); 2416 pm::SubMetric *ramUsageTotal = new pm::SubMetric 2416 pm::SubMetric *ramUsageTotal = new pm::SubMetric("RAM/Usage/Total", 2417 2417 "Total physical memory installed."); 2418 pm::SubMetric *ramUsageUsed = new pm::SubMetric 2418 pm::SubMetric *ramUsageUsed = new pm::SubMetric("RAM/Usage/Used", 2419 2419 "Physical memory currently occupied."); 2420 pm::SubMetric *ramUsageFree = new pm::SubMetric 2420 pm::SubMetric *ramUsageFree = new pm::SubMetric("RAM/Usage/Free", 2421 2421 "Physical memory currently available to applications."); 2422 2422 /* Create and register base metrics */ … … 2424 2424 ComObjPtr<Host> tmp = this; 2425 2425 tmp.queryInterfaceTo(&objptr); 2426 pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw 2426 pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw(hal, objptr, cpuLoadUser, cpuLoadKernel, 2427 2427 cpuLoadIdle); 2428 2428 aCollector->registerBaseMetric (cpuLoad); 2429 pm::BaseMetric *cpuMhz = new pm::HostCpuMhz 2429 pm::BaseMetric *cpuMhz = new pm::HostCpuMhz(hal, objptr, cpuMhzSM); 2430 2430 aCollector->registerBaseMetric (cpuMhz); 2431 pm::BaseMetric *ramUsage = new pm::HostRamUsage 2431 pm::BaseMetric *ramUsage = new pm::HostRamUsage(hal, objptr, ramUsageTotal, ramUsageUsed, 2432 2432 ramUsageFree); 2433 2433 aCollector->registerBaseMetric (ramUsage); 2434 2434 2435 aCollector->registerMetric 2436 aCollector->registerMetric 2437 2438 aCollector->registerMetric 2439 2440 aCollector->registerMetric 2441 2442 2443 aCollector->registerMetric 2444 aCollector->registerMetric 2445 2446 aCollector->registerMetric 2447 2448 aCollector->registerMetric 2449 2450 2451 aCollector->registerMetric 2452 aCollector->registerMetric 2453 2454 aCollector->registerMetric 2455 2456 aCollector->registerMetric 2457 2458 2459 aCollector->registerMetric 2460 aCollector->registerMetric 2461 2462 aCollector->registerMetric 2463 2464 aCollector->registerMetric 2465 2466 2467 aCollector->registerMetric 2468 aCollector->registerMetric 2469 2470 aCollector->registerMetric 2471 2472 aCollector->registerMetric 2473 2474 2475 aCollector->registerMetric 2476 aCollector->registerMetric 2477 2478 aCollector->registerMetric 2479 2480 aCollector->registerMetric 2481 2482 2483 aCollector->registerMetric 2484 aCollector->registerMetric 2485 2486 aCollector->registerMetric 2487 2488 aCollector->registerMetric 2489 2435 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0)); 2436 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 2437 new pm::AggregateAvg())); 2438 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 2439 new pm::AggregateMin())); 2440 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 2441 new pm::AggregateMax())); 2442 2443 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 0)); 2444 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 2445 new pm::AggregateAvg())); 2446 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 2447 new pm::AggregateMin())); 2448 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadKernel, 2449 new pm::AggregateMax())); 2450 2451 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 0)); 2452 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 2453 new pm::AggregateAvg())); 2454 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 2455 new pm::AggregateMin())); 2456 aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadIdle, 2457 new pm::AggregateMax())); 2458 2459 aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 0)); 2460 aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 2461 new pm::AggregateAvg())); 2462 aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 2463 new pm::AggregateMin())); 2464 aCollector->registerMetric(new pm::Metric(cpuMhz, cpuMhzSM, 2465 new pm::AggregateMax())); 2466 2467 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 0)); 2468 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 2469 new pm::AggregateAvg())); 2470 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 2471 new pm::AggregateMin())); 2472 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageTotal, 2473 new pm::AggregateMax())); 2474 2475 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 0)); 2476 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 2477 new pm::AggregateAvg())); 2478 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 2479 new pm::AggregateMin())); 2480 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageUsed, 2481 new pm::AggregateMax())); 2482 2483 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 0)); 2484 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 2485 new pm::AggregateAvg())); 2486 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 2487 new pm::AggregateMin())); 2488 aCollector->registerMetric(new pm::Metric(ramUsage, ramUsageFree, 2489 new pm::AggregateMax())); 2490 2490 }; 2491 2491 2492 2492 void Host::unregisterMetrics (PerformanceCollector *aCollector) 2493 2493 { 2494 aCollector->unregisterMetricsFor 2495 aCollector->unregisterBaseMetricsFor 2494 aCollector->unregisterMetricsFor(this); 2495 aCollector->unregisterBaseMetricsFor(this); 2496 2496 }; 2497 2497 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
Note:
See TracChangeset
for help on using the changeset viewer.