Changeset 40470 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Mar 15, 2012 6:18:49 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r39576 r40470 201 201 ComPtr <IConsole> console = ComPtr<IConsole>()); 202 202 const char *machineStateToName(MachineState_T machineState, bool fShort); 203 HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl, 204 VMINFO_DETAILS details); 203 205 204 206 /* VBoxManageList.cpp */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp
r40469 r40470 187 187 188 188 /** 189 * Converts bandwidth group type to a string.190 * @returns String representation.191 * @param enmType Bandwidth control group type.192 */193 inline const char * typeToString(BandwidthGroupType_T enmType)194 {195 switch (enmType)196 {197 case BandwidthGroupType_Disk: return "Disk";198 case BandwidthGroupType_Network: return "Network";199 }200 return "unknown";201 }202 203 /**204 189 * Handles the 'bandwidthctl myvm list' sub-command. 205 190 * @returns Exit code. … … 230 215 231 216 /* See showVMInfo. */ 217 if (FAILED(showBandwidthGroups(rptrBWControl, enmDetails))) 218 return RTEXITCODE_FAILURE; 219 #if 0 232 220 com::SafeIfaceArray<IBandwidthGroup> bwGroups; 233 221 CHECK_ERROR2_RET(rptrBWControl, GetAllBandwidthGroups(ComSafeArrayAsOutParam(bwGroups)), RTEXITCODE_FAILURE); … … 249 237 cMaxMbPerSec); 250 238 } 239 #endif 251 240 252 241 return RTEXITCODE_SUCCESS; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r40469 r40470 230 230 RTPrintf("\"\n"); 231 231 } 232 } 233 234 /** 235 * Converts bandwidth group type to a string. 236 * @returns String representation. 237 * @param enmType Bandwidth control group type. 238 */ 239 inline const char * bwGroupTypeToString(BandwidthGroupType_T enmType) 240 { 241 switch (enmType) 242 { 243 case BandwidthGroupType_Disk: return "Disk"; 244 case BandwidthGroupType_Network: return "Network"; 245 } 246 return "unknown"; 247 } 248 249 HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl, 250 VMINFO_DETAILS details) 251 { 252 int rc = S_OK; 253 SafeIfaceArray<IBandwidthGroup> bwGroups; 254 255 CHECK_ERROR_RET(bwCtrl, GetAllBandwidthGroups(ComSafeArrayAsOutParam(bwGroups)), rc); 256 257 for (size_t i = 0; i < bwGroups.size(); i++) 258 { 259 Bstr strName; 260 ULONG cMaxMbPerSec; 261 BandwidthGroupType_T enmType; 262 263 CHECK_ERROR_RET(bwGroups[i], COMGETTER(Name)(strName.asOutParam()), rc); 264 CHECK_ERROR_RET(bwGroups[i], COMGETTER(Type)(&enmType), rc); 265 CHECK_ERROR_RET(bwGroups[i], COMGETTER(MaxMbPerSec)(&cMaxMbPerSec), rc); 266 267 const char *pszType = bwGroupTypeToString(enmType); 268 if (details == VMINFO_MACHINEREADABLE) 269 RTPrintf("BandwidthGroup%zu=%ls,%s,%d\n", i, strName.raw(), pszType, cMaxMbPerSec); 270 else 271 RTPrintf("Name: '%ls', Type: %s, Limit: %d Mbytes/sec\n", strName.raw(), pszType, cMaxMbPerSec); 272 } 273 if (details != VMINFO_MACHINEREADABLE && bwGroups.size() != 0) 274 RTPrintf("\n"); 275 276 return rc; 232 277 } 233 278 … … 1837 1882 { 1838 1883 ComPtr<IBandwidthControl> bwCtrl; 1839 SafeIfaceArray<IBandwidthGroup> bwGroups;1840 1841 1884 CHECK_ERROR_RET(machine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam()), rc); 1842 1885 1843 CHECK_ERROR_RET(bwCtrl, GetAllBandwidthGroups(ComSafeArrayAsOutParam(bwGroups)), rc); 1844 1845 for (size_t i = 0; i < bwGroups.size(); i++) 1846 { 1847 Bstr strName; 1848 ULONG cMaxMbPerSec; 1849 BandwidthGroupType_T enmType; 1850 1851 CHECK_ERROR_RET(bwGroups[i], COMGETTER(Name)(strName.asOutParam()), rc); 1852 CHECK_ERROR_RET(bwGroups[i], COMGETTER(Type)(&enmType), rc); 1853 CHECK_ERROR_RET(bwGroups[i], COMGETTER(MaxMbPerSec)(&cMaxMbPerSec), rc); 1854 1855 const char *pszType = "unknown"; 1856 switch (enmType) 1857 { 1858 case BandwidthGroupType_Disk: pszType = "disk"; break; 1859 case BandwidthGroupType_Network: pszType = "network"; break; 1860 } 1861 if (details == VMINFO_MACHINEREADABLE) 1862 RTPrintf("BandwidthGroup%zu=%ls,%s,%d\n", strName.raw(), pszType, cMaxMbPerSec); 1863 else 1864 RTPrintf("Name: '%ls', Type: %s, Limit: %d Mbytes/sec\n", strName.raw(), pszType, cMaxMbPerSec); 1865 } 1866 if (details != VMINFO_MACHINEREADABLE && bwGroups.size() != 0) 1867 RTPrintf("\n"); 1886 rc = showBandwidthGroups(bwCtrl, details); 1868 1887 } 1869 1888
Note:
See TracChangeset
for help on using the changeset viewer.