Skip to content

Commit fa16b65

Browse files
committed
c_bench: report time in ms
1 parent b228ea5 commit fa16b65

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

benchmarks/c_bench/c_bench.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#include <cstdlib>
66
#include <iostream>
77

8-
static void bm_lleaves(benchmark::State& state) {
8+
static void bm_lleaves(benchmark::State &state)
9+
{
910
char *model_name = std::getenv("LLEAVES_BENCHMARK_MODEL");
1011

1112
std::ostringstream model_stream;
@@ -17,11 +18,12 @@ static void bm_lleaves(benchmark::State& state) {
1718
ulong n_preds = arr.shape[0];
1819
auto *out = (double *)(malloc(n_preds * sizeof(double)));
1920

20-
for (auto _ : state){
21-
// predict over the whole input array
22-
forest_root(loaded_data, out, (int)0, (int)n_preds);
21+
for (auto _ : state)
22+
{
23+
// predict over the whole input array
24+
forest_root(loaded_data, out, (int)0, (int)n_preds);
2325
}
2426
}
2527

26-
BENCHMARK(bm_lleaves);
28+
BENCHMARK(bm_lleaves)->Unit(benchmark::kMillisecond);
2729
BENCHMARK_MAIN();

benchmarks/c_bench/c_bench.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
#ifndef C_BENCH_LLVM_H
66
#define C_BENCH_LLVM_H
77

8-
extern "C"{
9-
void forest_root(double *, double *, int, int);
8+
extern "C"
9+
{
10+
void forest_root(double *, double *, int, int);
1011
}
1112

12-
#endif //C_BENCH_LLVM_H
13+
#endif // C_BENCH_LLVM_H

benchmarks/data/setup_data.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -euo pipefail
3+
set -euox pipefail
44

55
pushd benchmarks/data/
66
wget -q https://f003.backblazeb2.com/file/lleaves-benchmark/benchmark_data.zip

0 commit comments

Comments
 (0)