public void Update() { //switch iteration mode if (Input.GetKeyDown(KeyCode.LeftBracket)) { selectedAlgorithm = ((int)selectedAlgorithm) == aMin ? (Algorithm)aMax : (Algorithm)(selectedAlgorithm - 1); TempText.setTempText($"Selected algorithm: {selectedAlgorithm.ToString()}", 3); } if (Input.GetKeyDown(KeyCode.RightBracket)) { selectedAlgorithm = ((int)selectedAlgorithm) == aMax ? (Algorithm)aMin : (Algorithm)(selectedAlgorithm + 1); TempText.setTempText($"Selected algorithm: {selectedAlgorithm.ToString()}", 3); } if (Input.GetKeyDown(KeyCode.Semicolon)) { iterationMode = ((int)iterationMode) == iMin ? (IterationMode)iMax : (IterationMode)(iterationMode - 1); TempText.setTempText($"Selected iteration mode: {iterationMode.ToString()}", 3); } if (Input.GetKeyDown(KeyCode.Quote)) { iterationMode = ((int)iterationMode) == iMax ? (IterationMode)iMin : (IterationMode)(iterationMode + 1); TempText.setTempText($"Selected iteration mode: {iterationMode.ToString()}", 3); } }
public override string ToString() { var builder = new StringBuilder(); builder.Append((IterationMode.ToString() + IterationStage).PadRight(IterationInfoNameMaxWidth, ' ')); builder.Append(' '); // Usually, a benchmarks takes more than 10 iterations (rarely more than 99) // PadLeft(2, ' ') looks like a good trade-off between alignment and amount of characters builder.Append(IterationIndex.ToString(MainCultureInfo).PadLeft(2, ' ')); builder.Append(": "); builder.Append(Operations.ToString(MainCultureInfo)); builder.Append(' '); builder.Append(OpSymbol); builder.Append(", "); builder.Append(Nanoseconds.ToString("0.00", MainCultureInfo)); builder.Append(' '); builder.Append(NsSymbol); builder.Append(", "); builder.Append(GetAverageTime().ToString(MainCultureInfo).ToAscii()); builder.Append("/op"); return(builder.ToString()); }
public string ToOutputLine() { string alignedIterationMode = IterationMode.ToString().PadRight(IterationModeNameMaxWidth, ' '); // Usually, a benchmarks takes more than 10 iterations (rarely more than 99) // PadLeft(2, ' ') looks like a good trade-off between alignment and amount of characters string alignedIterationIndex = IterationIndex.ToString().PadLeft(2, ' '); return($"{alignedIterationMode} {alignedIterationIndex}: {GetDisplayValue()}"); }