Skip to content

Instantly share code, notes, and snippets.

@kenegozi
Created July 22, 2012 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenegozi/3158878 to your computer and use it in GitHub Desktop.
Save kenegozi/3158878 to your computer and use it in GitHub Desktop.
Statically logging method call latencies
interface IDoWork {
void DoThis();
string WhatsThat(int that);
}
class DoWork : IDoWork {
public void DoThis() {
Log.Action("DoWork.DoThis", () => DoThisImpl() );
}
public string WhatsThat(int that) {
return Log.Func("DidWork.ChangedTheNameForgotTheString", () => "It is " + that);
}
}
// assuming Log.Method is a way to run the given Action/Func,
// meter the latency keyed by method, and do something with the data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment