Skip to content

Commit 386bebb

Browse files
committed
adding support for cmake.
1 parent 3b24ba9 commit 386bebb

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ if( ! pj.isValid() ) {
8787
```
8888

8989

90-
## Usage
90+
## Usage (old-school Makefile)
9191

9292
Requirements: clang or gcc and make. A system like Linux or macOS is expected.
9393

@@ -112,6 +112,16 @@ To run comparative benchmarks (with other parsers):
112112
make benchmark
113113
```
114114

115+
## Usage (CMake)
116+
117+
While in the project repository, do the following:
118+
119+
```
120+
mkdir build
121+
cd build
122+
cmake ..
123+
make test
124+
```
115125

116126
## Tools
117127

benchmark/parse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int main(int argc, char *argv[]) {
108108
evts.push_back(PERF_COUNT_HW_CACHE_REFERENCES);
109109
evts.push_back(PERF_COUNT_HW_CACHE_MISSES);
110110
LinuxEvents<PERF_TYPE_HARDWARE> unified(evts);
111-
vector<uint64_t> results;
111+
vector<unsigned long long> results;
112112
results.resize(evts.size());
113113
unsigned long cy0 = 0, cy1 = 0, cy2 = 0, cy3 = 0;
114114
unsigned long cl0 = 0, cl1 = 0, cl2 = 0, cl3 = 0;

benchmark/statisticalmodel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,16 @@ int main(int argc, char *argv[]) {
166166
std::cerr << "failed to allocate memory" << std::endl;
167167
return EXIT_FAILURE;
168168
}
169-
const u32 iterations = p.size() < 1 * 1000 * 1000 ? 1000 : 50;
169+
const uint32_t iterations = p.size() < 1 * 1000 * 1000 ? 1000 : 50;
170170
vector<int> evts;
171171
evts.push_back(PERF_COUNT_HW_CPU_CYCLES);
172172
evts.push_back(PERF_COUNT_HW_INSTRUCTIONS);
173173
LinuxEvents<PERF_TYPE_HARDWARE> unified(evts);
174174
unsigned long cy1 = 0, cy2 = 0, cy3 = 0;
175175
unsigned long cl1 = 0, cl2 = 0, cl3 = 0;
176-
vector<uint64_t> results;
176+
vector<unsigned long long> results;
177177
results.resize(evts.size());
178-
for (u32 i = 0; i < iterations; i++) {
178+
for (uint32_t i = 0; i < iterations; i++) {
179179
unified.start();
180180
bool isok = find_structural_bits(p.data(), p.size(), pj);
181181
unified.end(results);

src/stage1_find_marks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ WARN_UNUSED
104104
// indicates whether the sense of any edge going to the next iteration
105105
// should be flipped
106106
bool iter_ends_odd_backslash =
107-
__builtin_uaddll_overflow(bs_bits, odd_starts, &odd_carries);
107+
__builtin_uaddll_overflow(bs_bits, odd_starts, (unsigned long long *) &odd_carries);
108108

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

260260
odd_carries |=
261261
prev_iter_ends_odd_backslash; // push in bit zero as a potential end

0 commit comments

Comments
 (0)