I have a set of HTTP calls to benchmark:
public class HttpExamples
{
[Benchmark]
public void GetExampleCom()
{
var request = WebRequest.CreateHttp("http://example.com");
var webResponse = request.GetResponse();
}
[Benchmark]
public void GetExampleComSsl()
{
var request = WebRequest.CreateHttp("https://example.com");
var webResponse = request.GetResponse();
}
}
Occasionally, one of the requests will fail for some reason. At present, this seems to halt the bench-marking, what I'd prefer would be for it to handle the exception in some way.
Can this be achieved?
I'd like to:
- Eliminate failures from results.
- Flag that they happened
Bonus points:
- Keep measures of failures so we can see how failures affect results.
- Be able to see results for different types of exceptions.
- Do a 'thing' on failure (clean up some what)