public QTTime(long timeValue, nint timeScale, TimeFlags flags) { #if XAMCORE_2_0 this.timeValue = timeValue; this.timeScale = timeScale; this.flags = (nint)(long)flags; #else TimeValue = timeValue; TimeScale = timeScale; Flags = flags; #endif }
protected override void PostProcess(DemoParsingInfo infoObj, TimeFlags arg, bool isDefault) { bool showTotal = _sdt.ValidFlags.HasFlag(SimpleDemoTimer.Flags.TotalTimeValid); bool showAdjusted = _sdt.ValidFlags.HasFlag(SimpleDemoTimer.Flags.AdjustedTimeValid); bool overwrite = (arg & TimeFlags.AlwaysShowTotalTime) != 0; if (!overwrite && infoObj.NumDemos == 1) { return; } // show message if only one is invalid, or if we're overwriting and either is invalid if ((showTotal ^ showAdjusted) || (overwrite && (!showTotal || !showAdjusted))) { string which; if (!showTotal && !showAdjusted) { which = "Total and adjusted"; } else if (!showTotal) { which = "Total"; } else { which = "Adjusted"; } Utils.Warning($"{which} time may not be valid.\n\n"); } Utils.PushForegroundColor(ConsoleColor.Green); if (showTotal || overwrite) { Console.WriteLine($"{"Total measured time", FmtIdt}: {Utils.FormatTime(_sdt.TotalTime)}"); Console.WriteLine($"{"Total measured ticks", FmtIdt}: {_sdt.TotalTicks}"); showAdjusted &= _sdt.TotalTicks != _sdt.AdjustedTicks; } if (showAdjusted || overwrite) { Console.WriteLine($"{"Total adjusted time", FmtIdt}: {Utils.FormatTime(_sdt.AdjustedTime)}"); Console.WriteLine($"{"Total adjusted ticks", FmtIdt}: {_sdt.AdjustedTicks}"); } Utils.PopForegroundColor(); if (!showTotal && !showAdjusted && !overwrite) { Console.WriteLine($"Not showing total time from {DefaultAliases[0]} since it may not be valid. Use '{DefaultAliases[0]} {TimeFlags.AlwaysShowTotalTime}' to show it regardless."); } }
protected override void Process(DemoParsingInfo infoObj, TimeFlags arg, bool isDefault) { infoObj.PrintOptionMessage("timing demo"); try { if ((arg & TimeFlags.NoHeader) == 0) { WriteHeader(infoObj.CurrentDemo, Console.Out, infoObj.SetupInfo.ExecutableOptions != 1); } _sdt.Consume(infoObj.CurrentDemo); if (!infoObj.FailedLastParse) { WriteAdjustedTime(infoObj.CurrentDemo, Console.Out, (arg & TimeFlags.TimeFirstTick) != 0); Console.WriteLine(); } } catch (Exception) { Utils.Warning("Timing demo failed.\n"); } }
public QTTime(long timeValue, int timeScale) { TimeValue = timeValue; TimeScale = timeScale; Flags = 0; }
public QTTime(long timeValue, int timeScale, TimeFlags flags) { TimeValue = timeValue; TimeScale = timeScale; Flags = flags; }
public QTTime(long timeValue, nint timeScale, TimeFlags flags) { this.timeValue = timeValue; this.timeScale = timeScale; this.flags = (nint)(long)flags; }
protected override void AfterParse(DemoParsingSetupInfo setupObj, TimeFlags arg, bool isDefault) { setupObj.ExecutableOptions++; _sdt = new SimpleDemoTimer((arg & TimeFlags.TimeFirstTick) != 0); }