adding support for cmake.

This commit is contained in:
Daniel Lemire 2018-12-28 13:13:10 -05:00
parent 3b24ba9043
commit 386bebb33b
4 changed files with 17 additions and 7 deletions

View File

@ -87,7 +87,7 @@ if( ! pj.isValid() ) {
```
## Usage
## Usage (old-school Makefile)
Requirements: clang or gcc and make. A system like Linux or macOS is expected.
@ -112,6 +112,16 @@ To run comparative benchmarks (with other parsers):
make benchmark
```
## Usage (CMake)
While in the project repository, do the following:
```
mkdir build
cd build
cmake ..
make test
```
## Tools

View File

@ -108,7 +108,7 @@ int main(int argc, char *argv[]) {
evts.push_back(PERF_COUNT_HW_CACHE_REFERENCES);
evts.push_back(PERF_COUNT_HW_CACHE_MISSES);
LinuxEvents<PERF_TYPE_HARDWARE> unified(evts);
vector<uint64_t> results;
vector<unsigned long long> results;
results.resize(evts.size());
unsigned long cy0 = 0, cy1 = 0, cy2 = 0, cy3 = 0;
unsigned long cl0 = 0, cl1 = 0, cl2 = 0, cl3 = 0;

View File

@ -166,16 +166,16 @@ int main(int argc, char *argv[]) {
std::cerr << "failed to allocate memory" << std::endl;
return EXIT_FAILURE;
}
const u32 iterations = p.size() < 1 * 1000 * 1000 ? 1000 : 50;
const uint32_t iterations = p.size() < 1 * 1000 * 1000 ? 1000 : 50;
vector<int> evts;
evts.push_back(PERF_COUNT_HW_CPU_CYCLES);
evts.push_back(PERF_COUNT_HW_INSTRUCTIONS);
LinuxEvents<PERF_TYPE_HARDWARE> unified(evts);
unsigned long cy1 = 0, cy2 = 0, cy3 = 0;
unsigned long cl1 = 0, cl2 = 0, cl3 = 0;
vector<uint64_t> results;
vector<unsigned long long> results;
results.resize(evts.size());
for (u32 i = 0; i < iterations; i++) {
for (uint32_t i = 0; i < iterations; i++) {
unified.start();
bool isok = find_structural_bits(p.data(), p.size(), pj);
unified.end(results);

View File

@ -104,7 +104,7 @@ WARN_UNUSED
// indicates whether the sense of any edge going to the next iteration
// should be flipped
bool iter_ends_odd_backslash =
__builtin_uaddll_overflow(bs_bits, odd_starts, &odd_carries);
__builtin_uaddll_overflow(bs_bits, odd_starts, (unsigned long long *) &odd_carries);
odd_carries |=
prev_iter_ends_odd_backslash; // push in bit zero as a potential end
@ -255,7 +255,7 @@ WARN_UNUSED
// indicates whether the sense of any edge going to the next iteration
// should be flipped
//bool iter_ends_odd_backslash =
__builtin_uaddll_overflow(bs_bits, odd_starts, &odd_carries);
__builtin_uaddll_overflow(bs_bits, odd_starts, (unsigned long long *) &odd_carries);
odd_carries |=
prev_iter_ends_odd_backslash; // push in bit zero as a potential end