crypto_test: get stats in milliseconds#2372
Merged
Merged
Conversation
Author
|
Test output |
kasjer
reviewed
Sep 8, 2020
| e = os_time_get() - t; | ||
| ret = os_time_ticks_to_ms(e, &ms); | ||
| assert(ret == 0); | ||
| printf("done in %lu ticks / %lu ms\n", e, ms); |
Contributor
There was a problem hiding this comment.
When RISCV (unlike ARM) gcc compiler is used, uint32_t is not unsigned long int but just unsigned int.
Usage of "%lu" will lead to warnings there.
I would suggest to use PRIu32 or cast to avoid future warning fixes.
Along with ticks, print in milliseconds as well. Use PRIu32 specifier for compiler compatibility. Signed-off-by: Naveen Kaje <naveen.kaje@juul.com>
f5dc058 to
788ab4d
Compare
Style check summaryOur coding style is here!apps/crypto_test/src/main.cDetails@@ -199,7 +199,7 @@
sz = crypto_encrypt_custom(crypto, algo, mode, key, keylen, ivp,
inbuf, outbuf, asksz);
if (sz == asksz && memcmp(outbuf, vector->cipher, sz) == 0) {
- printf("ok, sz=%"PRIu32"\n", sz);
+ printf("ok, sz=%" PRIu32 "\n", sz);
} else {
printf("fail\n");
}
@@ -224,7 +224,7 @@
sz = crypto_decrypt_custom(crypto, algo, mode, key, keylen, ivp,
inbuf, outbuf, asksz);
if (sz == asksz && memcmp(outbuf, vector->plain, sz) == 0) {
- printf("ok, sz=%"PRIu32"\n", sz);
+ printf("ok, sz=%" PRIu32 "\n", sz);
} else {
printf("fail\n");
}
@@ -291,7 +291,7 @@
e = os_time_get() - t;
ret = os_time_ticks_to_ms(e, &ms);
assert(ret == 0);
- printf("done in %"PRIu32" ticks / %"PRIu32" ms\n", e, ms);
+ printf("done in %" PRIu32 " ticks / %" PRIu32 " ms\n", e, ms);
}
static void
@@ -326,7 +326,7 @@
e = os_time_get() - t;
ret = os_time_ticks_to_ms(e, &ms);
assert(ret == 0);
- printf("done in %"PRIu32" ticks / %"PRIu32" ms\n", e, ms);
+ printf("done in %" PRIu32 " ticks / %" PRIu32 " ms\n", e, ms);
}
static void
@@ -361,7 +361,7 @@
e = os_time_get() - t;
ret = os_time_ticks_to_ms(e, &ms);
assert(ret == 0);
- printf("done in %"PRIu32" ticks / %"PRIu32" ms\n", e, ms);
+ printf("done in %" PRIu32 " ticks / %" PRIu32 " ms\n", e, ms);
}
#endif /* MYNEWT_VAL(CRYPTOTEST_BENCHMARK) */
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Along with ticks, print in milliseconds as well.
Signed-off-by: Naveen Kaje naveen.kaje@juul.com