On 2011-10-03 17:44, Andrei Alexandrescu wrote:
On 10/3/11 8:59 AM, Jens Mueller wrote:
4. Test results should be exposed to the caller.
Usually, it is enough to write the results to the console. But you may
want to post process the results. Being it either graphically or to
output XML for whatever reason.
I think it would be beneficial to add this flexibility and separate the
benchmarking logic from its generating the output.
It might be useful to add the used CPU using std.cpuid to the output.

We should decouple collection from formatting. However, this complicates
matters because we'd need to expose the benchmark results structure.
I'll think of it.

Not necessarily. The user could provide a delegate as a callback, something like this:

struct Result
{
    string func;
    double relative;
    double calls;
    double tCall;
    double callsPerSecond;
}

alias void delegate (Result result) Formatter;

Doesn't seem complicated to me. Then the module could provide a default formatter that does what the module currently does.

--
/Jacob Carlborg

Reply via email to