Skip to content

Time Info

TimeInfo is the wall-time profiling helper used to instrument a simulation's main loop. It records timestamps at user-defined labels and prints a formatted report — useful for locating the expensive portions of the time step without attaching an external profiler.

Key Classes and Concepts

  • TimeInfo: simple timer accumulator.
    • Start / mark helpers record a timestamp against a label.
    • PrintWallClockSummary() (or equivalent) emits the totals.

Usage

Input

None.

Output

Console-formatted summary at the cadence you choose to print it (e.g. every $STime steps via RunTimeControl).

Example

cpp
#include "Tools/TimeInfo.h"

TimeInfo Timer;

for(RTC.tStep = RTC.tStart; RTC.tStep <= RTC.nSteps; RTC.IncrementTimeStep())
{
    Timer.SetStart();

    IP.Set(Phi, BC);                      Timer.SetTimeStamp("IP.Set");
    DO.CalculatePhaseFieldIncrements(Phi, IP);   Timer.SetTimeStamp("DO.Incr");
    Phi.NormalizeIncrements(BC, RTC.dt);  Timer.SetTimeStamp("Normalize");
    Phi.MergeIncrements(BC, RTC.dt);      Timer.SetTimeStamp("Merge");

    if (RTC.WriteToScreen())
    {
        Timer.PrintWallClockSummary();
    }
}

Dependencies

Released under the GNU GPLv3 License.