Skip to content

Commit 4157abd

Browse files
author
John Farrier
committed
Merge branch 'release/v1.1.0'
2 parents 62d0169 + d3ca550 commit 4157abd

File tree

7 files changed

+116
-54
lines changed

7 files changed

+116
-54
lines changed

.travis.yml

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,33 @@
1-
language:
2-
- cpp
3-
1+
language: cpp
42
compiler:
5-
- clang
6-
- gcc
7-
8-
# Setup different environments to test
9-
env:
10-
global:
11-
- GCC_VERSION="4.9"
12-
matrix:
13-
- CPP14=0
14-
- CPP14=1
3+
- gcc
4+
# - clang # This is not currently working because it seems to still be looking at GCC include directories.
155

16-
# Setup repos etc before installation
176
before_install:
18-
- if [ "$CXX" == "g++" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
19-
- if [ "$CXX" == "clang++" -a "$CPP14" == "0" ]; then sudo add-apt-repository -y ppa:h-rayflood/llvm; fi
20-
- sudo apt-get update -qq
7+
- echo "yes" | sudo add-apt-repository ppa:kalakris/cmake
8+
- echo "yes" | sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
9+
- sudo apt-get update -qq
10+
- sudo apt-get install -qq
11+
- sudo apt-get install cmake
12+
# g++4.8.1
13+
- if [ "$CXX" == "g++" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
14+
15+
# clang 3.4
16+
- if [ "$CXX" == "clang++" ]; then sudo add-apt-repository -y ppa:h-rayflood/llvm; fi
17+
18+
- sudo apt-get update -qq
2119

22-
# Install dependencies
2320
install:
24-
# install g++ 4.8, if tests are run with g++
25-
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq "g++-${GCC_VERSION}"; fi
26-
- if [ "$CXX" = "g++" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
27-
28-
# install clang-3.4 if CPP14==1
29-
- if [ "$CXX" == "clang++" -a "$CPP14" == "0" ]; then sudo apt-get install --allow-unauthenticated -qq clang-3.3; fi
30-
31-
- if [ "$CXX" == "clang++" ]; then cwd=$(pwd); fi
32-
33-
# Install libc++ if tests are run with clang++
34-
- if [ "$CXX" == "clang++" -a "$CPP14" == "0" ]; then svn co --quiet http://llvm.org/svn/llvm-project/libcxx/trunk@181765 libcxx; fi
35-
- if [ "$CXX" == "clang++" -a "$CPP14" == "1" ]; then svn co --quiet http://llvm.org/svn/llvm-project/libcxx/trunk@201601 libcxx; fi
36-
37-
- if [ "$CXX" == "clang++" ]; then cd libcxx/lib && bash buildit; fi
38-
- if [ "$CXX" == "clang++" ]; then sudo cp ./libc++.so.1.0 /usr/lib/; fi
39-
- if [ "$CXX" == "clang++" ]; then sudo mkdir /usr/include/c++/v1; fi
40-
- if [ "$CXX" == "clang++" ]; then cd .. && sudo cp -r include/* /usr/include/c++/v1/; fi
41-
- if [ "$CXX" == "clang++" ]; then cd /usr/lib && sudo ln -sf libc++.so.1.0 libc++.so; fi
42-
- if [ "$CXX" == "clang++" ]; then sudo ln -sf libc++.so.1.0 libc++.so.1 && cd $cwd; fi
43-
44-
- if [ "$CXX" == "clang++" -a "$CPP14" == "0" ]; then CXX=clang++-3.3; fi
21+
# g++4.8.1
22+
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
23+
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
24+
- if [ "$CXX" = "g++" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90; fi
25+
- if [ "$CXX" = "g++" ]; then sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90; fi
26+
- if [ "$CXX" = "g++" ]; then sudo apt-get install libstdc++-4.8-dev; fi
27+
28+
# clang 3.4
29+
- if [ "$CXX" == "clang++" ]; then sudo apt-get install --allow-unauthenticated -qq clang-3.4; fi
30+
- if [ "$CXX" == "clang++" ]; then export CXX="clang++-3.4"; fi
4531

4632
# command to run tests
4733
script:
@@ -51,7 +37,7 @@ script:
5137
- pwd
5238
- cd build
5339
- pwd
54-
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-std=${STD}"
40+
- cmake ..
5541
- ls
5642
- make
5743

CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# How to contribute
2+
3+
Adding great features and ensuring the widest possible platform compatibility requires community participation. Anyone wishing to contribute should review these guidelines before submitting pull requests.
4+
5+
## Celero Core vs Example Experiments
6+
7+
New functionality would reside inside the core project for Celero. Here it is most important that guidelines are followed to include code formatting, ISO C++ compliance, etc. The requirements on example experiments are less strict to allow individuals to share their projects the way they wrote them, though adherence to coding standards would be greatly appreciated.
8+
9+
## Getting Started
10+
11+
* Make sure you have a [GitHub account](https://github.com/signup/free)
12+
* Submit a ticket for your issue, assuming one does not already exist.
13+
* Clearly describe the issue including steps to reproduce when it is a bug.
14+
* Make sure you fill in the earliest version that you know has the issue.
15+
* Fork the repository on GitHub
16+
17+
## Making Changes
18+
19+
Change should generally follow the [Git Flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model.
20+
21+
22+
* Create a topic branch from where you want to base your work.
23+
* This is usually the master branch.
24+
* Only target release branches if you are certain your fix must be on that branch.
25+
* To quickly create a topic branch based on master; `git checkout -b fix/master/my_contribution master`. Please avoid working directly on the `master` branch.
26+
* Make commits of logical units.
27+
* Check for unnecessary whitespace with `git diff --check` before committing.
28+
* Make sure your commit messages are in the proper format.
29+
30+
For details, see ["Writing good commit messages.""](https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
31+
32+
* Make sure you have added the necessary Google tests for your changes.
33+
* Run _all_ the tests to assure nothing else was accidentally broken.
34+
35+
## Making Trivial Changes
36+
37+
### Documentation
38+
39+
For changes to how a user would run Celero from a command line or how a user might build Celero benchmarks, please provide the appropriate updates to README.md documenting the changes. In-line code documentaiton following the Doxygen markup language should also be accomplished within the code.
40+
41+
## Submitting Changes
42+
43+
* Push your changes to a topic branch in your fork of the repository.
44+
* Submit a pull request to the "develop" branch of the Celero repository.
45+
* Update your Jira ticket to mark that you have submitted code and are ready for it to be reviewed (Status: Ready for Merge).
46+
* Include a link to the pull request in the ticket.
47+
* After feedback has been given we expect responses within two weeks. After two weeks we may close the pull request if it isn't showing any activity.
48+
49+
# Additional Resources
50+
51+
* [General GitHub documentation](http://help.github.com/)
52+
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#Celero
22

3+
Develop Branch Status: [![Build Status](https://travis-ci.org/DigitalInBlue/Celero.svg?branch=develop)](https://travis-ci.org/DigitalInBlue/Celero)
4+
35
###C++ Benchmarking Library
46

57
Copyright 2015 John Farrier

include/celero/TestFixture.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,24 @@ namespace celero
6060
///
6161
virtual std::vector<int64_t> getExperimentValues() const { return std::vector<int64_t>(); };
6262

63+
///
64+
/// Allows the text fixture to run code that will be executed once
65+
/// immediately before the benchmark. Unlike setUp, the evaluation
66+
/// of this function IS included in the total experiment execution
67+
/// time.
68+
///
69+
/// \param experimentValue The value for the experiment. This can be ignored if the test does not utilize experiment values.
70+
///
71+
virtual void onExperimentStart(int64_t experimentValue);
72+
73+
///
74+
/// Allows the text fixture to run code that will be executed once
75+
/// immediately after the benchmark. Unlike tearDown, the evaluation
76+
/// of this function IS included in the total experiment execution
77+
/// time.
78+
///
79+
virtual void onExperimentEnd();
80+
6381
///
6482
/// Set up the test fixture before benchmark execution.
6583
///

src/Executor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void executor::RunBaseline(std::shared_ptr<Benchmark> bmark)
9797

9898
if(baselineExperiment != nullptr)
9999
{
100-
// Populate the problem space with a fake test fixture instantiation.
100+
// Populate the problem space with a test fixture instantiation.
101101
{
102102
auto testValues = baselineExperiment->getFactory()->Create()->getExperimentValues();
103103
for(auto i : testValues)
@@ -148,7 +148,8 @@ void executor::Run(std::shared_ptr<Experiment> e)
148148
{
149149
auto bmark = e->getBenchmark();
150150

151-
if(bmark->getBaseline()->getResult(0)->getComplete() == false)
151+
auto baseline = bmark->getBaseline();
152+
if(baseline->getResultSize() == 0 || baseline->getResult(0)->getComplete() == false)
152153
{
153154
executor::RunBaseline(bmark);
154155
}
@@ -208,4 +209,4 @@ void executor::Run(const std::string& benchmarkName, const std::string& experime
208209
assert(e != nullptr);
209210
executor::Run(e);
210211
}
211-
}
212+
}

src/Experiment.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -259,22 +259,13 @@ void Experiment::addProblemSpace(int64_t x)
259259

260260
size_t Experiment::getResultSize()
261261
{
262-
if(this->pimpl->results.empty() == true)
263-
{
264-
this->pimpl->results.push_back(std::make_shared<Result>(this));
265-
}
266-
267262
return this->pimpl->results.size();
268263
}
269264

270265
std::shared_ptr<Result> Experiment::getResult(size_t x)
271266
{
272-
if((x == 0) && (this->pimpl->results.empty() == true))
273-
{
274-
this->pimpl->results.push_back(std::make_shared<Result>(this));
275-
}
276-
277-
return this->pimpl->results[x];
267+
// get the result OR thrown an exception if the result list is empty;
268+
return this->pimpl->results.at(x);
278269
}
279270

280271
std::shared_ptr<Result> Experiment::getResultByValue(int64_t x)

src/TestFixture.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ TestFixture::~TestFixture()
3333
{
3434
}
3535

36+
void TestFixture::onExperimentStart(int64_t)
37+
{
38+
}
39+
40+
void TestFixture::onExperimentEnd()
41+
{
42+
}
43+
3644
void TestFixture::setUp(int64_t)
3745
{
3846
}
@@ -51,11 +59,15 @@ uint64_t TestFixture::run(const uint64_t calls, int64_t experimentValue)
5159

5260
// Get the starting time.
5361
const auto startTime = celero::timer::GetSystemTime();
62+
63+
this->onExperimentStart(experimentValue);
5464

5565
while(operation--)
5666
{
5767
this->UserBenchmark();
5868
}
69+
70+
this->onExperimentEnd();
5971

6072
const auto endTime = celero::timer::GetSystemTime();
6173

0 commit comments

Comments
 (0)