|
struct sample samp;
if ((fd0 = open("/dev/rtf0", O_RDONLY)) < 0) {
fprintf(stderr, "Error opening /dev/rtf0\n");
exit(1);
}
while (1) {
n = read(fd0, &samp, sizeof(samp));
printf("min: %8d, max: %8d\n", (int) samp.min, (int) samp.max);
fflush(stdout);
}
return 0;
}
4.3.3 编译和运行程序
在一台Celeron 412MHz,196MB内存,RTLinux3.1的机器上进行如下的Makefile编译:
all: rt_process.o irqsema.o monitor histplot
include ../../rtl.mk
monitor: monitor.c
$(CC) ${USER_CFLAGS} ${INCLUDE} -Wall -O2 -o monitor monitor.c
clean:
rm -f *.o monitor histplot periodic_monitor gnuplot.out
include $(RTL_DIR)/Rules.make
则程序可以测试调度的时间精度,程序的运行结果为:
min: 0, max: 24480
min: 0, max: 10720
min: 0, max: 10912
min: 0, max: 10976
min: 0, max: 11072
min: 0, max: 10656
min: 0, max: 10944
min: 0, max: 11200
min: 0, max: 11200
min: 0, max: 11008
min: 0, max: 10912
.........
上一页 [1] [2] [3] [4] [5] [6] [7] [8] 没有相关教程
|