diff --git a/bin/mpirunDebug b/bin/mpirunDebug index a7a0cb32b0..7911e06e98 100755 --- a/bin/mpirunDebug +++ b/bin/mpirunDebug @@ -100,10 +100,10 @@ echo "run $args" > $PWD/gdbCommands echo "where" >> $PWD/gdbCommands echo "Constructed gdb initialization file $PWD/gdbCommands" -$ECHO "Choose running method: 0)normal 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind: \c" +$ECHO "Choose running method: 0)normal 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind 6)gperftools(callgrind): \c" read method case "$method" in -0 | 1 | 2 | 3 | 4 | 5 ) +0 | 1 | 2 | 3 | 4 | 5 | 6) # okay ;; *) @@ -199,6 +199,11 @@ do echo "$sourceFoam; cd $PWD; valgrind $exec $args; read dummy" >> $procCmdFile echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema ;; + 6) + echo "$sourceFoam; cd $PWD; CPUPROFILE=log.profiler_$proc $exec $args; \ + pprof --callgrind $exec log.profiler_$proc > log.profiler_$proc.callgrind;" >> $procCmdFile + echo "${node}$procCmdFile" >> $PWD/mpirun.schema + ;; esac chmod +x $procCmdFile diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 19a6c2b321..155c4c2eb4 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -79,21 +79,35 @@ Foam::word Foam::Time::controlDictName("controlDict"); void Foam::Time::adjustDeltaT() { + bool adjustTime = false; + scalar timeToNextWrite = VGREAT; + if (writeControl_ == wcAdjustableRunTime) { - scalar interval = writeInterval_; - if (secondaryWriteControl_ == wcAdjustableRunTime) - { - interval = min(interval, secondaryWriteInterval_); - } - - - scalar timeToNextWrite = max + adjustTime = true; + timeToNextWrite = max ( 0.0, - (outputTimeIndex_ + 1)*interval - (value() - startTime_) + (outputTimeIndex_ + 1)*writeInterval_ - (value() - startTime_) ); + } + if (secondaryWriteControl_ == wcAdjustableRunTime) + { + adjustTime = true; + timeToNextWrite = max + ( + 0.0, + min + ( + timeToNextWrite, + (secondaryOutputTimeIndex_ + 1)*secondaryWriteInterval_ + - (value() - startTime_) + ) + ); + } + if (adjustTime) + { scalar nSteps = timeToNextWrite/deltaT_ - SMALL; // For tiny deltaT the label can overflow! @@ -1130,10 +1144,10 @@ Foam::Time& Foam::Time::operator++() / secondaryWriteInterval_ ); - if (outputIndex > outputTimeIndex_) + if (outputIndex > secondaryOutputTimeIndex_) { outputTime_ = true; - outputTimeIndex_ = outputIndex; + secondaryOutputTimeIndex_ = outputIndex; } } break; @@ -1145,10 +1159,10 @@ Foam::Time& Foam::Time::operator++() returnReduce(elapsedCpuTime(), maxOp()) / secondaryWriteInterval_ ); - if (outputIndex > outputTimeIndex_) + if (outputIndex > secondaryOutputTimeIndex_) { outputTime_ = true; - outputTimeIndex_ = outputIndex; + secondaryOutputTimeIndex_ = outputIndex; } } break; @@ -1160,10 +1174,10 @@ Foam::Time& Foam::Time::operator++() returnReduce(label(elapsedClockTime()), maxOp