Fix printf formats

This commit is contained in:
Jeremy Lakeman 2013-11-21 17:27:22 +10:30
parent 67a724b29d
commit a13189e554

View File

@ -2774,8 +2774,8 @@ int app_reverse_lookup(const struct cli_parsed *parsed, struct cli_context *cont
void context_switch_test(int);
int app_mem_test(const struct cli_parsed *parsed, struct cli_context *context)
{
int mem_size;
int addr;
size_t mem_size;
size_t addr;
uint64_t count;
@ -2785,7 +2785,7 @@ int app_mem_test(const struct cli_parsed *parsed, struct cli_context *context)
for(mem_size=1024;mem_size<=(128*1024*1024);mem_size*=2) {
uint8_t *mem=malloc(mem_size);
if (!mem) {
fprintf(stderr,"Could not allocate %dKB memory -- stopping test.\n",mem_size/1024);
fprintf(stderr,"Could not allocate %zdKB memory -- stopping test.\n",mem_size/1024);
return -1;
}
@ -2793,15 +2793,16 @@ int app_mem_test(const struct cli_parsed *parsed, struct cli_context *context)
// delays when doing the reads
for(addr=0;addr<mem_size;addr++) mem[addr]=random()&0xff;
uint64_t end_time=gettime_ms()+100;
time_ms_t end_time=gettime_ms()+100;
uint64_t total=0;
uint32_t mem_mask=mem_size-1;
size_t mem_mask=mem_size-1;
for(count=0;gettime_ms()<end_time;count++) {
addr=random()&mem_mask;
total+=mem[addr];
}
printf("Memory size = %8dKB : %lld random reads per second (irrelevant sum is %016llx)\n",mem_size/1024,count*10,
printf("Memory size = %8zdKB : %"PRId64" random reads per second (irrelevant sum is %016"PRIx64")\n",
mem_size/1024,count*10,
/* use total so that compiler doesn't optimise away our memory accesses */
total);
@ -2810,7 +2811,8 @@ int app_mem_test(const struct cli_parsed *parsed, struct cli_context *context)
addr=random()&mem_mask;
mem[addr]=3;
}
printf("Memory size = %8dKB : %lld random writes per second (irrelevant sum is %016llx)\n",mem_size/1024,count*10,
printf("Memory size = %8zdKB : %"PRId64" random writes per second (irrelevant sum is %016"PRIx64")\n",
mem_size/1024,count*10,
/* use total so that compiler doesn't optimise away our memory accesses */
total);