Skip to content

Conversation

lijinpei
Copy link

@lijinpei lijinpei commented Jan 7, 2018

a revision of #511 and #505

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 86.939% when pulling 0800b71 on lijinpei:v2-fixture into e1c3a83 on google:master.

@AppVeyorBot
Copy link

Build benchmark 947 completed (commit b122cfb5ec by @lijinpei)

namespace internal {
// Take ownership of the pointer and register the benchmark. Return the
// registered benchmark.
Benchmark* RegisterBenchmarkInternal(Benchmark*);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this now under HAS_CXX11? I don't think it was before.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is only needed if you use lambda benchmarks, function and fixture benchmarks are registered using the non-internal RegisterBenchmark().

return static_cast<int>(args_.front().size());
}

void Benchmark::Init() {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in benchmark.cc, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Benchmakr:: member functions are already in benchmark_register.cc, maybe we shall use a seperate commit to move them to benchmark.cc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh. yeah, probably move benchmark member functions to benchmark.cc and the stuff there to benchmark_main.cc or something.

void FunctionBenchmark::Run(State& st) { func_(st); }
// The class used to hold all Benchmarks created from static function.
// (ie those created using the BENCHMARK(...) macros.
class FunctionBenchmark : public Benchmark {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd be quite happy if these could be move out to their own header/source files (in src/).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, maybe I shall also move benchmark's member function definitions to benchmark.cc?


internal::Benchmark* RegisterBenchmark(const char* name, internal::Function* func) {
auto* p_benchmark = new internal::FunctionBenchmark(name, func);
internal::BenchmarkFamilies::GetInstance()->AddBenchmark(std::unique_ptr<internal::Benchmark>(p_benchmark));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line length should be <= 80

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK


Benchmark* RegisterBenchmark(const char *name, FixtureCreator* creator) {
auto* p_benchmark = new FixtureBenchmark(name, creator);
internal::BenchmarkFamilies::GetInstance()->AddBenchmark(std::unique_ptr<internal::Benchmark>(p_benchmark));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line length

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

}
}

int main(int argc, char **argv) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you can use googletest for this instead of asserts.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will do it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of the existing 35 testcases, only one(statistics_test) uses gtest. I add two testcases which does essentially the same thing, fixture_init_test.cpp doesn't use gtest while fixture_init_gtest.cpp does.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file necessary any more?

gtest is a new addition so we're just starting to move testing over to it. you're ahead of the curve :)

Function* func_;
};

//=============================================================================//
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to mention it, all those comments are 81 characters width(not including the newline)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 86.939% when pulling c02a75a on lijinpei:v2-fixture into e1c3a83 on google:master.

@AppVeyorBot
Copy link

Build benchmark 950 failed (commit ca7b0cccaf by @lijinpei)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 86.916% when pulling 84e24f4 on lijinpei:v2-fixture into e1c3a83 on google:master.

@AppVeyorBot
Copy link

Build benchmark 951 failed (commit 690b2a4035 by @lijinpei)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 86.916% when pulling 8bc7f4a on lijinpei:v2-fixture into e1c3a83 on google:master.

@AppVeyorBot
Copy link

Build benchmark 952 completed (commit 529fc8788c by @lijinpei)

virtual void BenchmarkCase(State&) = 0;
};

namespace internal {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be put inside one of the existing internal namespaces instead of adding another block? at some point i tried to clean these blocks up.. it'd be nice to not make it messier.

@AppVeyorBot
Copy link

Build benchmark 953 failed (commit 7cd3f6b4a0 by @lijinpei)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 86.682% when pulling f0008ff on lijinpei:v2-fixture into e1c3a83 on google:master.

@EricWF
Copy link
Contributor

EricWF commented Jan 11, 2018

@lijinpei When you want to update a PR, please use the same branch and PR on github -- don't create new ones every time.

You can either squash the old commits and force-push yourself, or you can simply push the new commits. When we merge the PR we'll squash the commits into a single one anyway.

#include "benchmark_api_internal.h"

namespace {
using namespace benchmark;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just put the unnamed namespace inside benchmark::internal instead of adding using statements.

int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
benchmark::Initialize(&argc, argv);
return RUN_ALL_TESTS();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test LGTM. Thanks.

@lijinpei lijinpei force-pushed the v2-fixture branch 2 times, most recently from 504356b to df045ff Compare January 12, 2018 02:16
@AppVeyorBot
Copy link

Build benchmark 955 failed (commit d9940082d3 by @lijinpei)

@AppVeyorBot
Copy link

Build benchmark 956 failed (commit a7d37aac99 by @lijinpei)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 86.682% when pulling df045ff on lijinpei:v2-fixture into 9f5694c on google:master.

@lijinpei
Copy link
Author

I can revert to the version which doesn't change the header file very much if you don't want to merge the newest change.

@dmah42
Copy link
Member

dmah42 commented Jan 18, 2018

it would be nice to keep the PR focused. so one PR to handle the issue here, and another to clean up the header would be most appreciated.

@lijinpei lijinpei force-pushed the v2-fixture branch 2 times, most recently from f8ed087 to 05baa30 Compare January 18, 2018 18:33
@AppVeyorBot
Copy link

Build benchmark 962 failed (commit c7e2ac7617 by @lijinpei)

@AppVeyorBot
Copy link

Build benchmark 963 failed (commit d64de82c6f by @lijinpei)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 86.741% when pulling f8ed087 on lijinpei:v2-fixture into 9f5694c on google:master.

@coveralls
Copy link

coveralls commented Jan 20, 2018

Coverage Status

Coverage decreased (-0.01%) to 86.916% when pulling c88f257 on lijinpei:v2-fixture into 4fe0206 on google:master.

@lijinpei lijinpei force-pushed the v2-fixture branch 2 times, most recently from 23836c6 to c88f257 Compare January 21, 2018 15:30
@AppVeyorBot
Copy link

Build benchmark 966 failed (commit 0b6085ebd0 by @lijinpei)

@AppVeyorBot
Copy link

Build benchmark 967 failed (commit 2b1d502e05 by @lijinpei)

@dmah42
Copy link
Member

dmah42 commented May 29, 2018

Are you still looking in to this, @lijinpei ?

@AppVeyorBot
Copy link

Build benchmark 1302 failed (commit bbce1f06c3 by @lijinpei)

@lijinpei
Copy link
Author

I can re-start to work on this.
BTW, on my machine(gcc 8.1.1), state_assembly_test.cc compiles to the following state_assembly_test.s output, I think it is just a reorder of the loop header/body of what FileCheck means to check, but FileCheck won't accept it.

@dmah42
Copy link
Member

dmah42 commented May 5, 2021

I'm going to close this as it appears abandoned. Please feel free to try again.

@dmah42 dmah42 closed this May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants