Changeset 895

Show
Ignore:
Timestamp:
03/13/08 19:56:34
Author:
robert
Message:

Improved the time reporting so that it now provides the estimated number of days, hours, minutes and seconds till completion.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/vpb/MachinePool.cpp

    r889 r895  
    327327        } 
    328328 
    329         log(osg::NOTICE,"machine=%s completed task=%s in %f seconds",getHostName().c_str(),task->getFileName().c_str(),duration); 
     329        log(osg::NOTICE,"machine=%s completed task=%s in %.1f seconds",getHostName().c_str(),task->getFileName().c_str(),duration); 
    330330    } 
    331331     
     
    859859    estimatedTimeOfLastCompletion += numTaskPendingAcrossAllCores*averageTaskTime; 
    860860    double estimateTimeToCompletion = estimatedTimeOfLastCompletion-currentTime; 
    861      
    862     log(osg::NOTICE,"Number of tasks completed %i, running %i, pending %i. Estimated time to completion %.1f seconds, %2.1f percent done.",numTasksCompleted, numTasksRunning, numTasksPending, estimateTimeToCompletion, 100.0*currentTime/estimatedTimeOfLastCompletion); 
     861 
     862    double daysToCompletion = floor(estimateTimeToCompletion / (24.0*60.0*60.0) ); 
     863    double secondsRemainder = estimateTimeToCompletion - daysToCompletion*24.0*60.0*60.0; 
     864    double hoursToCompletion = floor(secondsRemainder / (60.0*60.0)); 
     865    secondsRemainder = secondsRemainder - hoursToCompletion*60.0*60.0; 
     866     
     867    double minutesToCompletion = floor(secondsRemainder / 60.0); 
     868    secondsRemainder = secondsRemainder - minutesToCompletion*60.0; 
     869 
     870    if (daysToCompletion>0.0) 
     871    { 
     872        log(osg::NOTICE,"Number of tasks completed %i, running %i, pending %i. Estimated time to completion %d days, %d hours, %d minutes, %2.1f percent done.", 
     873            numTasksCompleted, numTasksRunning, numTasksPending,  
     874            int(daysToCompletion), int(hoursToCompletion), int(minutesToCompletion), 
     875            100.0*currentTime/estimatedTimeOfLastCompletion); 
     876    } 
     877    else if (hoursToCompletion>0.0) 
     878    { 
     879        log(osg::NOTICE,"Number of tasks completed %i, running %i, pending %i. Estimated time to completion %d hours, %d minutes, %2.1f percent done.", 
     880            numTasksCompleted, numTasksRunning, numTasksPending,  
     881            int(hoursToCompletion), int(minutesToCompletion), 
     882            100.0*currentTime/estimatedTimeOfLastCompletion); 
     883    } 
     884    else if (minutesToCompletion>0.0) 
     885    { 
     886        log(osg::NOTICE,"Number of tasks completed %i, running %i, pending %i. Estimated time to completion %d minutes, %d seconds, %2.1f percent done.", 
     887            numTasksCompleted, numTasksRunning, numTasksPending,  
     888            int(minutesToCompletion),int(secondsRemainder), 
     889            100.0*currentTime/estimatedTimeOfLastCompletion); 
     890    }     
     891    else 
     892    { 
     893        log(osg::NOTICE,"Number of tasks completed %i, running %i, pending %i. Estimated time to completion %d seconds, %2.1f percent done.", 
     894            numTasksCompleted, numTasksRunning, numTasksPending,  
     895            int(secondsRemainder), 
     896            100.0*currentTime/estimatedTimeOfLastCompletion); 
     897    } 
    863898 
    864899}