test_swap: donot using random to fill memory region to avoid mismatch
Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
This commit is contained in:
parent
15b49dd069
commit
754870f548
|
|
@ -36,15 +36,14 @@ int main()
|
|||
|
||||
/* fill data */
|
||||
for (i = 0; i < SIZE / 8; i += 8)
|
||||
*(p + i) = (unsigned long)rand() << 32 | rand();
|
||||
*(p + i) = 0xffff + i;
|
||||
|
||||
/* trigger pageout and get time of pageout */
|
||||
gettimeofday(&tv_b, NULL);
|
||||
madvise(p, SIZE, MADV_PAGEOUT);
|
||||
gettimeofday(&tv_e, NULL);
|
||||
|
||||
printf("swp out bandwidth: %ld bytes/ms\n",
|
||||
SIZE/(tv_to_ms(tv_e) - tv_to_ms(tv_b)));
|
||||
printf("swp out bandwidth: %ld bytes/ms\n", SIZE/(tv_to_ms(tv_e) - tv_to_ms(tv_b)));
|
||||
|
||||
/* read to trigger swapin and */
|
||||
gettimeofday(&tv_b, NULL);
|
||||
|
|
@ -52,8 +51,7 @@ int main()
|
|||
*(c + i) = i;
|
||||
gettimeofday(&tv_e, NULL);
|
||||
|
||||
printf("swp in bandwidth: %ld bytes/ms\n",
|
||||
SIZE/(tv_to_ms(tv_e) - tv_to_ms(tv_b)));
|
||||
printf("swp in bandwidth: %ld bytes/ms\n", SIZE/(tv_to_ms(tv_e) - tv_to_ms(tv_b)));
|
||||
|
||||
pid = fork();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue