打印本文 打印本文 关闭窗口 关闭窗口
Linux嵌入式实时操作系统开发与设计(七)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数5527  更新时间:2009/4/22 20:45:21  文章录入:mintao  责任编辑:mintao
clock_nanosleep (CLOCK_REALTIME, TIMER_ABSTIME, hrt2ts(expected - advance), NULL);

expected += period;

now = clock_gethrtime(CLOCK_MONOTONIC);

last_time = now;

 

do {

      min_diff = 2000000000;

      max_diff = -2000000000;

 

      for (i = 0; i < ntests; i++) {

          ++cnt;

          clock_nanosleep (CLOCK_REALTIME, TIMER_ABSTIME, hrt2ts(expected - advance), NULL);

 

          now = clock_gethrtime(CLOCK_MONOTONIC);

          if (absolute && advance && !mode) {

               if (now < expected) {

                    rtl_delay (expected - now);

               }

               now = clock_gethrtime(CLOCK_MONOTONIC);

          }

          if (absolute) {

               diff = now - expected;

          } else {

               diff = now - last_time - period;

               if (diff < 0) {

                    diff = -diff;

               }

          }

          if (diff < min_diff) {

               min_diff = diff;

          }

           if (diff > max_diff) {

               max_diff = diff;

          }

 

          expected += period;

          last_time = now;

      }

&n

上一页  [1] [2] [3] [4] [5] [6] [7] [8]  下一页

打印本文 打印本文 关闭窗口 关闭窗口