VirtualBox

Changeset 37555 in vbox for trunk


Ignore:
Timestamp:
Jun 20, 2011 1:38:18 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72395
Message:

Main-CloneVM: better progress weighting for diff images

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp

    r37531 r37555  
    374374                    mtc.chain.append(mt);
    375375
     376                    /* Query next parent. */
     377                    rc = pSrcMedium->COMGETTER(Parent)(pSrcMedium.asOutParam());
     378                    if (FAILED(rc)) throw rc;
     379                };
     380                /* Currently the creation of diff images involves reading at least
     381                 * the biggest parent in the previous chain. So even if the new
     382                 * diff image is small in size, it could need some time to create
     383                 * it. Adding the biggest size in the chain should balance this a
     384                 * little bit more. */
     385                int64_t uMaxSize = 0;
     386                for (size_t e = mtc.chain.size(); e > 0; --e)
     387                {
     388                    MEDIUMTASK &mt = mtc.chain.at(e - 1);
     389                    /* Save the max size for better weighting of diff image
     390                     * creation. */
     391                    uMaxSize = RT_MAX(uMaxSize, mt.uSize);
     392                    mt.uSize = (mt.uSize + uMaxSize) / 2;
     393
    376394                    /* Calculate progress data */
    377395                    ++uCount;
    378                     uTotalWeight += lSize;
    379 
    380                     /* Query next parent. */
    381                     rc = pSrcMedium->COMGETTER(Parent)(pSrcMedium.asOutParam());
    382                     if (FAILED(rc)) throw rc;
    383                 };
     396                    uTotalWeight += mt.uSize;
     397                }
    384398                d->llMedias.append(mtc);
    385399            }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette