drm/bridge: adv7511: Switch to atomic operations
[drm/drm-misc.git] / tools / testing / selftests / damon / access_memory_even.c
bloba9f4e9aaf3a930b2502eff1d8124f2225ecf5a1d
1 // SPDX-License-Identifier: GPL-2.0
2 /*
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.
7 */
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 #include <time.h>
14 int main(int argc, char *argv[])
16 char **regions;
17 int nr_regions;
18 int sz_region;
19 int i;
21 if (argc != 3) {
22 printf("Usage: %s <number> <size (bytes)>\n", argv[0]);
23 return -1;
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);
33 while (1) {
34 for (i = 0; i < nr_regions; i++) {
35 if (i % 2 == 0)
36 memset(regions[i], i, sz_region);
39 return 0;