1 // SPDX-License-Identifier: GPL-2.0
3 * Artificial memory access program for testing DAMON.
11 int main(int argc
, char *argv
[])
21 printf("Usage: %s <number> <size (bytes)> <time (ms)>\n",
26 nr_regions
= atoi(argv
[1]);
27 sz_region
= atoi(argv
[2]);
28 access_time_ms
= atoi(argv
[3]);
30 regions
= malloc(sizeof(*regions
) * nr_regions
);
31 for (i
= 0; i
< nr_regions
; i
++)
32 regions
[i
] = malloc(sz_region
);
34 for (i
= 0; i
< nr_regions
; i
++) {
35 start_clock
= clock();
36 while ((clock() - start_clock
) * 1000 / CLOCKS_PER_SEC
<
38 memset(regions
[i
], i
, sz_region
);