mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-20 05:37:57 +00:00
add memory write speed test.
This commit is contained in:
parent
17d2dda6ae
commit
6ff2ae4871
@ -2509,10 +2509,20 @@ int app_mem_test(const struct cli_parsed *parsed, struct cli_context *context)
|
|||||||
addr=random()&mem_mask;
|
addr=random()&mem_mask;
|
||||||
total+=mem[addr];
|
total+=mem[addr];
|
||||||
}
|
}
|
||||||
printf("Memory size = %8dKB : %lld random reads per second (irrelevant sum is %016llx)\n",mem_size/1024,count,
|
printf("Memory size = %8dKB : %lld random reads per second (irrelevant sum is %016llx)\n",mem_size/1024,count*10,
|
||||||
/* use total so that compiler doesn't optimise away our memory accesses */
|
/* use total so that compiler doesn't optimise away our memory accesses */
|
||||||
total);
|
total);
|
||||||
|
|
||||||
|
end_time=gettime_ms()+100;
|
||||||
|
for(count=0;gettime_ms()<end_time;count++) {
|
||||||
|
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,
|
||||||
|
/* use total so that compiler doesn't optimise away our memory accesses */
|
||||||
|
total);
|
||||||
|
|
||||||
|
|
||||||
free(mem);
|
free(mem);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user