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 22, 2018
1 parent 3703822 commit 5b71fe3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 0 deletions.
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
2 changes: 2 additions & 0 deletions src/pow_avx.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,10 @@ bool PowAVX(void *pow_ctx)

nonce_to_result(tx_tryte, nonce_tryte, ctx->output_trytes);

#if defined(ENABLE_BENCH)
/* PoW-related information */
printf("Hash count: %"PRIu64"\n", ctx->hash_count);
#endif

fail:
/* Free memory */
Expand Down
2 changes: 2 additions & 0 deletions src/pow_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,10 @@ bool PowC(void *pow_ctx)

nonce_to_result(tx_tryte, nonce_tryte, ctx->output_trytes);

#if defined(ENABLE_BENCH)
/* PoW-related information */
printf("Hash count: %"PRIu64"\n", ctx->hash_count);
#endif

fail:
/* Free memory */
Expand Down
2 changes: 2 additions & 0 deletions src/pow_cl.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,10 @@ bool PowCL(void *pow_ctx)

ctx->hash_count = ctx->clctx->hash_count;

#if defined(ENABLE_BENCH)
/* PoW-related information */
printf("Hash count: %"PRIu64"\n", ctx->hash_count);
#endif

fail:
freeTrobject(tx_trit);
Expand Down
2 changes: 2 additions & 0 deletions src/pow_fpga_accel.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ static bool PoWFPGAAccel(void *pow_ctx)
memcpy(ctx->output_trytes + ((NonceTrinaryOffset) / 3), nonce_trytes->data,
((transactionTrinarySize) - (NonceTrinaryOffset)) / 3);

#if defined(ENABLE_BENCH)
/* PoW-related information */
printf("Hash count: %"PRIu64"\n", ctx->hash_count);
#endif

fail:
freeTrobject(object_tryte);
Expand Down
2 changes: 2 additions & 0 deletions src/pow_sse.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,10 @@ bool PowSSE(void *pow_ctx)

nonce_to_result(tx_tryte, nonce_tryte, ctx->output_trytes);

#if defined(ENABLE_BENCH)
/* PoW-related information */
printf("Hash count: %"PRIu64"\n", ctx->hash_count);
#endif

fail:
/* Free memory */
Expand Down

0 comments on commit 5b71fe3

Please sign in to comment.