public async Task <R> CallAsyncFuncAndRecordStatsAsync <R>(Func <Task <R> > func, bool hideExceptions) { Stopwatch sw = new Stopwatch(); try { sw.Restart(); var result = await func(); SunnyDay.AddCallTiming(sw.ElapsedTicks); return(result); } catch (Exception e) { RainyDay.AddCallTiming(sw.ElapsedTicks); if (!hideExceptions) { if (!_exceptionHandler(e)) { throw; } } return(default(R)); } }
public void CallActionAndRecordStats(Action action) { Stopwatch sw = new Stopwatch(); try { sw.Restart(); action(); SunnyDay.AddCallTiming(sw.ElapsedTicks); } catch (Exception e) { RainyDay.AddCallTiming(sw.ElapsedTicks); } }
public async Task CallAsyncFuncAndRecordStatsAsync(Func <Task> func) { Stopwatch sw = new Stopwatch(); try { sw.Restart(); await func(); SunnyDay.AddCallTiming(sw.ElapsedTicks); } catch (Exception e) { RainyDay.AddCallTiming(sw.ElapsedTicks); } }
public T CallFuncAndRecordStats <T, P>(Func <P, T> func, P param) { T result = default(T); Stopwatch sw = new Stopwatch(); try { sw.Restart(); result = func(param); SunnyDay.AddCallTiming(sw.ElapsedTicks); } catch (Exception e) { RainyDay.AddCallTiming(sw.ElapsedTicks); } return(result); }
public void CallActionAndRecordStats(Action action, bool hideExceptions = false) { Stopwatch sw = new Stopwatch(); try { sw.Restart(); action(); SunnyDay.AddCallTiming(sw.ElapsedTicks); } catch (Exception) { RainyDay.AddCallTiming(sw.ElapsedTicks); if (!hideExceptions) { throw; } } }
public async Task CallAsyncFuncAndRecordStatsAsync <P>(Func <P, Task> func, P param, bool hideExceptions = false) { Stopwatch sw = new Stopwatch(); try { sw.Restart(); await func(param); SunnyDay.AddCallTiming(sw.ElapsedTicks); } catch (Exception) { RainyDay.AddCallTiming(sw.ElapsedTicks); if (!hideExceptions) { throw; } } }
public T CallFuncAndRecordStats <T>(Func <T> func, bool hideExceptions = false) { T result = default(T); Stopwatch sw = new Stopwatch(); try { sw.Restart(); result = func(); SunnyDay.AddCallTiming(sw.ElapsedTicks); } catch (Exception) { RainyDay.AddCallTiming(sw.ElapsedTicks); if (!hideExceptions) { throw; } } return(result); }
public async Task CallAsyncFuncAndRecordStatsAsync(Func <Task> func, bool hideExceptions) { Stopwatch sw = new Stopwatch(); try { sw.Restart(); await func(); SunnyDay.AddCallTiming(sw.ElapsedTicks); } catch (Exception e) { RainyDay.AddCallTiming(sw.ElapsedTicks); if (!hideExceptions) { if (!_exceptionHandler(e)) { throw; } } } }