Bug类型
- 单个任务的长时间执行Bug(执行这个任务耗时很长而引起的bug)
正确版本程序
- apps/benchmark/BlinkRunTask
程序描述
- 在Blink程序的基础上添加computeTask任务并在
Timer0.fired()事件中post出去。 - 每隔0.25s/0.5s/1s的时间间隔切换LED0/LED1/LED2的状态。
Avrora运行程序
- alias avrora=’java -jar avrora-beta-1.7.113.jar -colors=false -banner=false’;
- make mica2;
- mv build/mica2/main.exe brt.elf;
avrora -platform=mica2 -monitors=leds -seconds=10
-simulation=sensor-network brt.elf运行结果分析(正确版本)
LED0,LED1、LED2切换结果正确。
bug版本程序
- /apps/benchmark/bm_BlinkRunTask
程序修改的部分
- 将computeTask修改成一个计算量大的任务。
bug的显现条件
- 当单个computeTask任务的计算量很大时
Bug症状
1. 在指定的模拟时间内,LED灯切换的次数减少且最终不再闪烁变换。
**备注**
- 任务的计算量大大影响了定时器的运行,导致LED的切换不正常;
- 应该把大计算量的任务分解成多个小任务执行。