Display custom messages in MiniProfiler
2 answers
You can create subsections of code in your application using the following syntax:
using (MiniProfiler.Current.Step("Extremely Complex Stuff"))
{
var data = myClass.GetSomeDate();
data.Process();
}
You can also add custom timing profiles (useful for profiling certain types of interactions other than sql, for example: redis / caching integration) with CustomTiming
:
using (MiniProfiler.Current.CustomTiming("Redis", "GetData"))
{
var data = CacheHelper.GetDataFromCache();
}
I would suggest cloning the repo and playing with the Sample.MVC app to see more things that can be done (these are demos of everything I said out of the box).
+3
source to share
Just a slight improvement on Yaakov's answer,
If you have included a cache key like
using (MiniProfiler.Current.CustomTiming("Redis", key))
{
var data = CacheHelper.GetDataFromCache();
}
Then your MP tracks will be more useful as they tell you which keys are available and you will be alerted to any duplicates.
+1
source to share