1 // SPDX-License-Identifier: GPL-2.0
3 * Artificial memory access program for testing DAMON.
5 * Receives number of regions and size of each region from user. Allocate the
6 * regions and repeatedly access even numbered (starting from zero) regions.
14 int main(int argc
, char *argv
[])
22 printf("Usage: %s <number> <size (bytes)>\n", argv
[0]);
26 nr_regions
= atoi(argv
[1]);
27 sz_region
= atoi(argv
[2]);
29 regions
= malloc(sizeof(*regions
) * nr_regions
);
30 for (i
= 0; i
< nr_regions
; i
++)
31 regions
[i
] = malloc(sz_region
);
34 for (i
= 0; i
< nr_regions
; i
++) {
36 memset(regions
[i
], i
, sz_region
);