Skip to content

Commit

Permalink
Add BUILD_BENCH option for printing the PoW-related info
Browse files Browse the repository at this point in the history
  • Loading branch information
marktwtn committed Sep 23, 2018
1 parent c5dae88 commit 22dc766
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ ifeq ("$(BUILD_JNI)","1")
include mk/java.mk
endif

ifeq ("$(BUILD_BENCH)","1")
CFLAGS += -DENABLE_BENCH
endif

TESTS = \
trinary \
curl \
Expand Down
3 changes: 3 additions & 0 deletions mk/defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ BUILD_COMPAT ?= 0

# Build FPGA backend or not
BUILD_FPGA_ACCEL ?= 0

# Show the PoW-related messages or not
BUILD_BENCH ?= 0
3 changes: 2 additions & 1 deletion tests/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#include "pow_cl.h"
#endif

#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>

#ifdef NDEBUG
#undef NDEBUG
Expand Down
3 changes: 3 additions & 0 deletions tests/test-pow.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ int main()
doThePoW(PoW_Context_ptr, pow_ctx);
int8_t *ret_trytes = getPoWResult(PoW_Context_ptr, pow_ctx);
assert(ret_trytes);
#if defined(ENABLE_BENCH)
printf("Hash count: %"PRIu64"\n", getHashCount(PoW_Context_ptr, pow_ctx));
#endif
freePoWContext(PoW_Context_ptr, pow_ctx);
destroyImplContext(PoW_Context_ptr);

Expand Down

0 comments on commit 22dc766

Please sign in to comment.