blob: 54b013813081327e76c53e26457218455d6e2658 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include "../source/uapi/monitor_user.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define NUM_VARS 2049
int main() {
int i = 0;
int temps[NUM_VARS] = {0};
watch_arg watch_args[NUM_VARS] = {0};
cancel_watch();
for (i = 0; i < NUM_VARS; i++) {
temps[i] = 100;
char name[20];
snprintf(name, sizeof(name), "temp%d", i);
// 拷贝字符串
strncpy(watch_args[i].name, name, (MAX_NAME_LEN + 1));
START_WATCH_INT(name, &temps[i], (110 + i));
}
while (temps[NUM_VARS - 1] < 205) {
for (i = 0; i < NUM_VARS; i++) {
temps[i]++;
}
printf("Value of variable %d: %d", i, temps[0]);
printf("\n");
sleep(1);
}
cancel_watch();
return 0;
}
|