Added automatic benchmark

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@324 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2011-05-11 20:02:21 +00:00
parent 4c03cd9bda
commit 8b5623bc1d
12 changed files with 5536 additions and 60 deletions

View file

@ -61,14 +61,38 @@
</trycatch>
</target>
<target name="reports" description="generate code analysis reports">
<headers name="turtle"/>
<target name="bench" description="run compilation benchmark">
<quiet>
<delete file="${reports.dir}/benchmark-${platform}.log"/>
<touch file="${reports.dir}/benchmark-${platform}.log"/>
<delete dir="${out.dir}/turtle_bench"/>
</quiet>
<for param="file">
<fileset dir="${applications.dir}/turtle_bench" includes="*.cpp"/>
<sequential>
<record name="${reports.dir}/benchmark-${platform}.log" action="start" append="true"/>
<ant target="-bench">
<property name="file" value="@{file}"/>
</ant>
<record name="${reports.dir}/benchmark-${platform}.log" action="stop"/>
</sequential>
</for>
</target>
<target name="bench" description="build compilation benchmark">
<build-app name="turtle_bench" mode="all">
<includepath path="${applications.dir}/turtle_bench"/>
</build-app>
<target name="-bench">
<echo>${file}</echo>
<stopwatch name="bench"/>
<quiet>
<compile name="bench" input="${applications.dir}/turtle_bench" outdir="${out.dir}/turtle_bench" excludes="**">
<includepath path="${libraries.dir}"/>
<fileset file="${file}"/>
</compile>
</quiet>
<stopwatch name="bench" action="total"/>
</target>
<target name="reports" description="generate code analysis reports">
<headers name="turtle"/>
</target>
<target name="export" description="export distribution">

View file

@ -183,7 +183,39 @@
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hpp;hxx;hm;inl;inc;xsd"
>
<File
RelativePath="..\..\src\applications\turtle_bench\turtle_bench.cpp"
RelativePath="..\..\src\applications\turtle_bench\turtle_bench_0_class.cpp"
>
</File>
<File
RelativePath="..\..\src\applications\turtle_bench\turtle_bench_0_class_10_max_args.cpp"
>
</File>
<File
RelativePath="..\..\src\applications\turtle_bench\turtle_bench_0_class_20_max_args.cpp"
>
</File>
<File
RelativePath="..\..\src\applications\turtle_bench\turtle_bench_0_class_30_max_args.cpp"
>
</File>
<File
RelativePath="..\..\src\applications\turtle_bench\turtle_bench_30_classes_30_methods_30_args_30_max_args.cpp"
>
</File>
<File
RelativePath="..\..\src\applications\turtle_bench\turtle_bench_30_classes_30_methods_9_args.cpp"
>
</File>
<File
RelativePath="..\..\src\applications\turtle_bench\turtle_bench_30_classes_30_methods_9_args_10_max_args.cpp"
>
</File>
<File
RelativePath="..\..\src\applications\turtle_bench\turtle_bench_30_classes_30_methods_9_args_20_max_args.cpp"
>
</File>
<File
RelativePath="..\..\src\applications\turtle_bench\turtle_bench_30_classes_30_methods_9_args_30_max_args.cpp"
>
</File>
</Filter>

View file

@ -1,53 +0,0 @@
//
// Copyright Mathieu Champlon 2010
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MOCK_BENCH_NUMBER_OF_METHODS
#define MOCK_BENCH_NUMBER_OF_METHODS 30
#endif
#ifndef MOCK_BENCH_NUMBER_OF_ARGS
#define MOCK_BENCH_NUMBER_OF_ARGS 9
#endif
//#define MOCK_MAX_ARGS MOCK_BENCH_NUMBER_OF_ARGS
#ifndef MOCK_BENCH_NUMBER_OF_CLASSES
#define MOCK_BENCH_NUMBER_OF_CLASSES 20
#endif
#include <turtle/mock.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#define MOCK_BENCH_IDENTITY(z, n, d) d
#define MOCK_BENCH_METHOD(z, n, d) virtual void f##n( d ) = 0;
namespace
{
class base_class
{
public:
virtual ~base_class() {}
BOOST_PP_REPEAT(MOCK_BENCH_NUMBER_OF_METHODS, MOCK_BENCH_METHOD, BOOST_PP_ENUM(MOCK_BENCH_NUMBER_OF_ARGS, MOCK_BENCH_IDENTITY, int))
};
}
#define MOCK_BENCH_MOCK_METHOD(z, n, d) MOCK_METHOD( f##n, MOCK_BENCH_NUMBER_OF_ARGS )
#define MOCK_BENCH_BASE_CLASS(z, n, d) \
MOCK_BASE_CLASS( BOOST_PP_CAT( mock_class, n ), base_class ) \
{ \
BOOST_PP_REPEAT(MOCK_BENCH_NUMBER_OF_METHODS, MOCK_BENCH_MOCK_METHOD,) \
};
BOOST_PP_REPEAT(MOCK_BENCH_NUMBER_OF_CLASSES, MOCK_BENCH_BASE_CLASS,)
#define MOCK_BENCH_INSTANTIATION(z, n, d) mock_class##n c##n;
int main()
{
BOOST_PP_REPEAT(MOCK_BENCH_NUMBER_OF_CLASSES, MOCK_BENCH_INSTANTIATION,)
return 0;
}

View file

@ -0,0 +1,14 @@
//
// Copyright Mathieu Champlon 2011
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <turtle/mock.hpp>
int main()
{
return 0;
}

View file

@ -0,0 +1,10 @@
//
// Copyright Mathieu Champlon 2011
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#define MOCK_MAX_ARGS 10
#include <turtle/mock.hpp>

View file

@ -0,0 +1,10 @@
//
// Copyright Mathieu Champlon 2011
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#define MOCK_MAX_ARGS 20
#include <turtle/mock.hpp>

View file

@ -0,0 +1,10 @@
//
// Copyright Mathieu Champlon 2011
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#define MOCK_MAX_ARGS 30
#include <turtle/mock.hpp>

File diff suppressed because it is too large Load diff