Commit a9f7f2e1 authored by Florent D'Halluin's avatar Florent D'Halluin Committed by Alexandre Duret-Lutz
Browse files

Add cbs (libbench).

* cbs: Add directory.
* configure.ac: Add AC_CONFIG_SUBDIRS for cbs.
* Makefile.am: Add cbs subdir.
parent 9563f878
2009-04-06 d-halluin <d-halluin@lrde.epita.fr>
Add cbs (libbench).
* cbs: Add directory.
* configure.ac: Add AC_CONFIG_SUBDIRS for cbs.
* Makefile.am: Add cbs subdir.
2009-06-05 Alexandre Duret-Lutz <adl@lrde.epita.fr>
 
BOOST_CPPFLAGS were ignored while compiling lib/.
......
......@@ -20,7 +20,7 @@ if ENABLE_VAUCANSWIG
MAYBE_VAUCANSWIG = vaucanswig
endif
SUBDIRS = gnulib lib include src data $(MAYBE_TAF_KIT) $(MAYBE_VAUCANSWIG) \
SUBDIRS = gnulib cbs lib include src data $(MAYBE_TAF_KIT) $(MAYBE_VAUCANSWIG) \
tools doc build-aux debian
EXTRA_DIST = vaucanson.spec ChangeLog.1 ChangeLog.2 README NEWS m4/gnulib-cache.m4
......
CBS authors are:
* Florent D'Halluin d-halluin@lrde.epita.fr
2009-04-06 d-halluin <d-halluin@lrde.epita.fr>
Add .gitignore files in empty directories.
* build-aux/.gitignore: New.
* m4/.gitignore: New.
2009-04-06 d-halluin <d-halluin@lrde.epita.fr>
Update README.
* README: Update.
2009-04-06 d-halluin <d-halluin@lrde.epita.fr>
Install headers in the proper directory.
$(includedir)/cbs/bench/
* include/Makefile.am: Install all headers.
* configure.ac: Remove unused headers.
* include/cbs/Makefile.am: Deleted.
* include/cbs/bench/Makefile.am: Deleted.
2009-04-03 d-halluin <d-halluin@lrde.epita.fr>
Use Autotools.
## CBS, a C++ benchmarking suite.
##
## Copyright (C) 2007, 2009 The CBS Authors.
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## The complete GNU General Public Licence Notice can be found as the
## `COPYING' file in the root directory.
##
## The CBS Authors consists of people listed in the `AUTHORS' file.
include $(top_srcdir)/cbs.mk
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = lib demo include
CBS, a C++ benchmarking suite
This project is being developed at the LRDE to provide performance analysis
tools for the Vaucanson library.
CBS contains:
* libbench: measure performance of equiped C++ code.
#! /bin/sh
autoreconf --force --verbose --install
## CBS, a C++ benchmarking suite.
##
## Copyright (C) 2007, 2009 The CBS Authors.
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## The complete GNU General Public Licence Notice can be found as the
## `COPYING' file in the root directory.
##
## The CBS Authors consists of people listed in the `AUTHORS' file.
AM_CPPFLAGS = \
-I$(top_builddir) \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
$(BOOST_CPPFLAGS)
AM_CXXFLAGS = $(CXXFLAGS_STRICT)
AM_LDFLAGS = $(BOOST_LDFLAGS)
# CBS, a C++ benchmarking suite.
#
# Copyright (C) 2007, 2009 The CBS Authors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# The complete GNU General Public Licence Notice can be found as the
# `COPYING' file in the root directory.
#
# The CBS Authors consists of people listed in the `AUTHORS' file.
AC_PREREQ(2.61)
AC_INIT([cbs], [0.1], d-halluin@lrde.epita.fr)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([lib])
AM_INIT_AUTOMAKE([1.10 tar-ustar no-define dist-bzip2])
# Checks for programs.
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
# Checks for library functions.
AC_CONFIG_FILES([
Makefile
lib/Makefile
include/Makefile
demo/Makefile
demo/timer/Makefile
demo/bench/Makefile])
AC_OUTPUT
## CBS, a C++ benchmarking suite.
##
## Copyright (C) 2007, 2009 The CBS Authors.
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## The complete GNU General Public Licence Notice can be found as the
## `COPYING' file in the root directory.
##
## The CBS Authors consists of people listed in the `AUTHORS' file.
include $(top_srcdir)/cbs.mk
SUBDIRS = timer bench
## CBS, a C++ benchmarking suite.
##
## Copyright (C) 2007, 2009 The CBS Authors.
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## The complete GNU General Public Licence Notice can be found as the
## `COPYING' file in the root directory.
##
## The CBS Authors consists of people listed in the `AUTHORS' file.
include $(top_srcdir)/cbs.mk
noinst_PROGRAMS = demo-bench
demo_bench_SOURCES = main.cc
demo_bench_LDADD = $(top_builddir)/lib/libbench.la
demo_bench_CPPFLAGS = $(AM_CPPFLAGS)
#!/bin/sh
##
make && ./timer-demo && ./display.sh&
#!/bin/sh
##
dot -Tpng benchmark_1.dot -o benchmark_1.png
dot -Tpng benchmark_10.dot -o benchmark_10.png
dot -Tpng benchmark_100.dot -o benchmark_100.png
dot -Tpng benchmark_1000.dot -o benchmark_1000.png
dot -Tpng benchmark_10000.dot -o benchmark_10000.png
display benchmark_1.png &
display benchmark_10.png &
display benchmark_100.png &
display benchmark_1000.png &
display benchmark_10000.png &
// main.cc: this file is part of the CBS project.
//
// CBS, a C++ benchmarking suite.
//
// Copyright (C) 2007, 2009 Florent D'Halluin.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// The complete GNU General Public Licence Notice can be found as the
// `COPYING' file in the root directory.
//
#include <iostream>
#include <sstream>
#include <cbs/bench/bench_macros.hh>
#define WAIT(Duration) \
for (int j = 0; j < 10; ++j) \
for (int k = 0; k < 270 * Duration; ++k) \
{ \
int* i = new int(4); \
delete i; \
}
void a();
void b(int);
void c(int);
void d(int);
void e();
int main()
{
for (int n = 1, iter = 0; iter <= 20; n *= 2, ++iter)
{
BENCH_START("Bench demo", "A simple benchmark with a single parameter");
std::cout << "[" << iter << "] Bench for n=" << n << "..." << std::endl;
a();
for (int i = 0; i < n; ++i)
e();
BENCH_STOP();
{
std::stringstream parameter;
parameter << iter;
BENCH_PARAMETER("iteration", parameter.str());
}
{
std::stringstream parameter;
parameter << n;
BENCH_PARAMETER("n", parameter.str());
std::string name = "benchmark_" + parameter.str();
BENCH_SAVE(name + ".out", bench::Options(bench::Options::VE_NORMAL,
bench::Options::FO_TEXT,
0));
BENCH_SAVE(name + ".xml", bench::Options());
BENCH_SAVE(name + ".dot", bench::Options(bench::Options::VE_MINIMAL,
bench::Options::FO_DOT));
}
}
}
void a()
{
BENCH_TASK_SCOPED("Task A");
for (int i = 0; i < 42; ++i)
{
b(5);
}
}
void b(int x)
{
BENCH_TASK_SCOPED("Task B");
WAIT(2)
c(x);
}
void c(int x)
{
BENCH_TASK_SCOPED("Task C");
WAIT(4)
d(x);
}
void d(int x)
{
BENCH_TASK_SCOPED("Task D");
WAIT(1)
if (x > 0)
b(x - 1);
}
void e()
{
BENCH_TASK_SCOPED("Task E");
WAIT(3)
d(0);
}
#!/bin/sh
cat *.xml |\
sed -n '
s/ <parameter name="[^"]*" value="\([0-9]*\)" \/>/\1/p
s/ <result name="[^"]*" value="\([0-9]*\)" \/>/\1/p
s/<\/bench>/NL/p
' |\
tr '\012' ' ' |\
sed '
{
s/ NL /\
/g
}' |\
sort -g > plot.plot
## CBS, a C++ benchmarking suite.
##
## Copyright (C) 2007, 2009 The CBS Authors.
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## The complete GNU General Public Licence Notice can be found as the
## `COPYING' file in the root directory.
##
## The CBS Authors consists of people listed in the `AUTHORS' file.
include $(top_srcdir)/cbs.mk
noinst_PROGRAMS = demo-timer
demo_timer_SOURCES = main.cc
demo_timer_LDADD = $(top_builddir)/lib/libbench.la
demo_timer_CPPFLAGS = $(AM_CPPFLAGS) -O0
#!/bin/sh
##
make && ./timer-demo.sh && ./display.sh&
#!/bin/sh
##
dot -Tpng timer.dot -o timer.png
display timer.png
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment