Changeset 37580 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jun 21, 2011 1:23:35 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r37558 r37580 35 35 { 36 36 ComPtr<IMedium> pMedium; 37 uint64_t uSize;37 ULONG uWeight; 38 38 }MEDIUMTASK; 39 39 … … 48 48 Guid snapshotUuid; 49 49 Utf8Str strSaveStateFile; 50 uint64_t cbSize;50 ULONG uWeight; 51 51 }SAVESTATETASK; 52 52 … … 333 333 rc = machine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments)); 334 334 if (FAILED(rc)) throw rc; 335 /* Add all attachments (and the reparents) of the different335 /* Add all attachments (and their parents) of the different 336 336 * machines to a worker list. */ 337 337 for (size_t a = 0; a < sfaAttachments.size(); ++a) … … 371 371 MEDIUMTASK mt; 372 372 mt.pMedium = pSrcMedium; 373 mt.u Size = lSize;373 mt.uWeight = (lSize + _1M - 1) / _1M; 374 374 mtc.chain.append(mt); 375 375 … … 382 382 * diff image is small in size, it could need some time to create 383 383 * it. Adding the biggest size in the chain should balance this a 384 * little bit more. */ 385 int64_t uMaxSize = 0; 384 * little bit more, i.e. the weight is the sum of the data which 385 * needs to be read and written. */ 386 uint64_t uMaxSize = 0; 386 387 for (size_t e = mtc.chain.size(); e > 0; --e) 387 388 { 388 389 MEDIUMTASK &mt = mtc.chain.at(e - 1); 390 mt.uWeight += uMaxSize; 391 392 /* Calculate progress data */ 393 ++uCount; 394 uTotalWeight += mt.uWeight; 395 389 396 /* Save the max size for better weighting of diff image 390 397 * creation. */ 391 uMaxSize = RT_MAX(uMaxSize, mt.uSize); 392 mt.uSize = (mt.uSize + uMaxSize) / 2; 393 394 /* Calculate progress data */ 395 ++uCount; 396 uTotalWeight += mt.uSize; 398 uMaxSize = RT_MAX(uMaxSize, mt.uWeight); 397 399 } 398 400 d->llMedias.append(mtc); … … 406 408 sst.snapshotUuid = machine->getSnapshotId(); 407 409 sst.strSaveStateFile = bstrSrcSaveStatePath; 408 int vrc = RTFileQuerySize(sst.strSaveStateFile.c_str(), &sst.cbSize); 410 uint64_t cbSize; 411 int vrc = RTFileQuerySize(sst.strSaveStateFile.c_str(), &cbSize); 409 412 if (RT_FAILURE(vrc)) 410 413 throw p->setError(VBOX_E_IPRT_ERROR, p->tr("Could not query file size of '%s' (%Rrc)"), sst.strSaveStateFile.c_str(), vrc); 414 /* same rule as above: count both the data which needs to 415 * be read and written */ 416 sst.uWeight = 2 * (cbSize + _1M - 1) / _1M; 411 417 d->llSaveStateFiles.append(sst); 412 418 ++uCount; 413 uTotalWeight += sst. cbSize;419 uTotalWeight += sst.uWeight; 414 420 } 415 421 } … … 555 561 if (FAILED(rc)) throw rc; 556 562 557 rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(), mt.u Size);563 rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(), mt.uWeight); 558 564 if (FAILED(rc)) throw rc; 559 565 … … 709 715 710 716 /* Move to next sub-operation. */ 711 rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Copy save state file '%s' ..."), RTPathFilename(sst.strSaveStateFile.c_str())).raw(), sst. cbSize);717 rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Copy save state file '%s' ..."), RTPathFilename(sst.strSaveStateFile.c_str())).raw(), sst.uWeight); 712 718 if (FAILED(rc)) throw rc; 713 719 /* Copy the file only if it was not copied already. */
Note:
See TracChangeset
for help on using the changeset viewer.