Skip to content

Commit 76dddce

Browse files
Andre Muezeriedavid-marchand
Andre Muezerie
authored andcommitted
test/hash: use size formatter
Compiling with MSVC logs the warnings below, which result in build error: ../app/test/test_hash_multiwriter.c(71): warning C4476: 'printf' : unknown type field character ''' in format specifier ../app/test/test_hash_multiwriter.c(73): warning C4474: 'printf' : too many arguments passed for format string ../app/test/test_hash_multiwriter.c(73): note: placeholders and their parameters expect 2 variadic arguments, but 4 were provided ../app/test/test_hash_readwrite.c(73): warning C4476: 'printf' : unknown type field character ''' in format specifier ../app/test/test_hash_readwrite.c(75): warning C4474: 'printf' : too many arguments passed for format string ../app/test/test_hash_readwrite.c(75): note: placeholders and their parameters expect 2 variadic arguments, but 4 were provided Use new formatter provided by EAL. Signed-off-by: Andre Muezerie <[email protected]> Acked-by: Bruce Richardson <[email protected]>
1 parent 6655090 commit 76dddce

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

app/test/test_hash_multiwriter.c

+11-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
#define RTE_APP_TEST_HASH_MULTIWRITER_FAILED 0
3434

35+
#define OFFSET_STR_LEN 16
36+
3537
struct {
3638
uint32_t *keys;
3739
uint32_t *found;
@@ -51,11 +53,15 @@ static int use_htm;
5153
static int
5254
test_hash_multiwriter_worker(void *arg)
5355
{
56+
char offset_start[OFFSET_STR_LEN];
57+
char offset_end[OFFSET_STR_LEN];
5458
uint64_t i, offset;
5559
uint16_t pos_core;
5660
uint32_t lcore_id = rte_lcore_id();
5761
uint64_t begin, cycles;
5862
uint16_t *enabled_core_ids = (uint16_t *)arg;
63+
const bool use_iec = true;
64+
const char *unit = NULL;
5965

6066
for (pos_core = 0; pos_core < rte_lcore_count(); pos_core++) {
6167
if (enabled_core_ids[pos_core] == lcore_id)
@@ -68,10 +74,12 @@ test_hash_multiwriter_worker(void *arg)
6874
*/
6975
offset = pos_core * tbl_multiwriter_test_params.nb_tsx_insertion;
7076

71-
printf("Core #%d inserting %d: %'"PRId64" - %'"PRId64"\n",
77+
rte_size_to_str(offset_start, RTE_DIM(offset_start), offset, use_iec, unit);
78+
rte_size_to_str(offset_end, RTE_DIM(offset_end),
79+
offset + tbl_multiwriter_test_params.nb_tsx_insertion - 1, use_iec, unit);
80+
printf("Core #%u inserting %u: %s - %s\n",
7281
lcore_id, tbl_multiwriter_test_params.nb_tsx_insertion,
73-
offset,
74-
offset + tbl_multiwriter_test_params.nb_tsx_insertion - 1);
82+
offset_start, offset_end);
7583

7684
begin = rte_rdtsc_precise();
7785

app/test/test_hash_readwrite.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#define NUM_TEST 3
2626
unsigned int core_cnt[NUM_TEST] = {2, 4, 8};
2727

28+
#define OFFSET_STR_LEN 16
29+
2830
unsigned int worker_core_ids[RTE_MAX_LCORE];
2931
struct perf {
3032
uint32_t single_read;
@@ -57,10 +59,14 @@ static RTE_ATOMIC(uint64_t) gwrites;
5759
static int
5860
test_hash_readwrite_worker(__rte_unused void *arg)
5961
{
62+
char offset_start[OFFSET_STR_LEN];
63+
char offset_end[OFFSET_STR_LEN];
6064
uint64_t i, offset;
6165
uint32_t lcore_id = rte_lcore_id();
6266
uint64_t begin, cycles;
6367
int *ret;
68+
const bool use_iec = true;
69+
const char *unit = NULL;
6470

6571
ret = rte_malloc(NULL, sizeof(int) *
6672
tbl_rw_test_param.num_insert, 0);
@@ -70,9 +76,13 @@ test_hash_readwrite_worker(__rte_unused void *arg)
7076
}
7177
offset = tbl_rw_test_param.num_insert * i;
7278

73-
printf("Core #%d inserting and reading %d: %'"PRId64" - %'"PRId64"\n",
79+
rte_size_to_str(offset_start, RTE_DIM(offset_start), offset, use_iec, unit);
80+
rte_size_to_str(offset_end, RTE_DIM(offset_end),
81+
offset + tbl_rw_test_param.num_insert - 1, use_iec, unit);
82+
83+
printf("Core #%u inserting and reading %u: %s - %s\n",
7484
lcore_id, tbl_rw_test_param.num_insert,
75-
offset, offset + tbl_rw_test_param.num_insert - 1);
85+
offset_start, offset_end);
7686

7787
begin = rte_rdtsc_precise();
7888

0 commit comments

Comments
 (0)