Boost logo

Boost :

Subject: Re: [boost] [build] Performance tests
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-11-22 03:28:38


vicente.botet wrote:

[sorry for previously posting an incomplete draft of this response]

>> You should be able to do this:
>>
>> exe hello : hello.cpp ;
>> run-output hello.output : hello ;
>> time hello.time : hello.output ;
>>
>> The first metatarget just builds exe, as usual. The second runs the executable
>> (capturing the output). The third records the time spend to run the executed.
>>
>> You might need to 'import testing ; ' on top.
>>
>>> Are there some examples of performance tests for some Boost libraries?
>>
>> I am not aware of such.
>>
>> Hope this helps,
>
> Thanks for the hint. I didn't know run-output and time.
>
> This allows me to get the time but in order to get again the time I need to force to build all
> with -a.
>
> $ bjam -q perf
> ...patience...
> ...found 2444 targets...
> ...updating 5 targets...
> gcc.archive /sandbox/stm/branches/vbe/libs/stm/build/bin/gcc-3.4.4/debug/link-st
> atic/threading-multi/libboost_STM.a
> gcc.link bin/gcc-3.4.4/debug/threading-multi/perf_counter.exe
> testing.capture-output bin/gcc-3.4.4/debug/threading-multi/perf_counter.run
> testing.time bin/gcc-3.4.4/debug/threading-multi/perf_counter.time
> user: [perf_counter.run] 0.106000
> system: [perf_counter.run] 0.122000
> ...updated 5 targets...

> I would like to build all the executables targets once, and then be able to run performance tests
> several times. Is this possible?

It's now possible -- using trunk version of Boost.Build. Add

        always hello.output ;

> BTW, I need to pass some args when running the test program. I do this now as
>
> alias dir_invalid
> :
> [ run stm : -bench rbtree -dir -threads 4 -inserts 100 : : : rbtree_dir_t4_i100 ]
> ...
> ;
>
> How can I integrate run-output and time in a test suite?

You might want to try:

        run stm : -bench rbtree -dir -threads 4 -inserts 100 : : : rbtree_dir_t4_i100
          time rbtree_dir_t4_i100.time : rbtree_dir_t4_i100.output ;

You can also create a helper function, run-with-time, like so:

rule run-with-time ( sources + : args * : input-files * : requirements * : target-name ? :
    default-build * )
{
    local t = [ run $(sources) : $(args) : $(input-files) : $(requirements) : $(target-name) ] ;
    local name = [ $(t).name ] ;
    time $(name).time : $(name) ;
}

Beware that the above is untested (but should work)

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk