Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit cb9b6898 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

ContextStopWatch: for easier debugging added

parent fe882351
No related branches found
No related tags found
No related merge requests found
using System;
using System.Diagnostics;
namespace TUGraz.VectoCore.Utils
{
/// <summary>
/// StopWatch which works like an IDisposable-Context.
/// Usage: using(new ContextStopWatch("main")) { ... }
/// </summary>
public class ContextStopWatch : Stopwatch, IDisposable
{
private readonly string _name;
public ContextStopWatch(string name = null)
{
Start();
_name = name;
}
public void Dispose()
{
Stop();
if (_name != null)
Console.WriteLine("{0}: {1}", _name, Elapsed);
else
Console.WriteLine(Elapsed);
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment