AnsweredAssumed Answered

imx_3.14.28_1.0.0_ga + preempt-rt patch patch-3.14.28-rt25 on MCIMX6Q-SDP

Question asked by m.c on Sep 29, 2015
Latest reply on Oct 4, 2015 by igorpadykov

Below is test program run on MCIMX6Q-SDP with imx_3.14.28_1.0.0_ga + preempt-rt patch patch-3.14.28-rt25. The red numbers are good, but others seems not good. Is there anything can be improve?

 

root@imx6qsabresd:~# ./testrun

  1. 0.000010333 sec
  2. 0.000020333 sec
  3. 0.000004667 sec
  4. 0.000005666 sec
  5. 0.000021000 sec
  6. 0.000019667 sec
  7. 0.000004666 sec
  8. 0.000020333 sec
  9. 0.000004334 sec
  10. 0.000004666 sec
  11. 0.000004666 sec
  12. 0.000004667 sec
  13. 0.000004333 sec
  14. 0.000005000 sec
  15. 0.000005000 sec
  16. 0.000018666 sec
  17. 0.000004666 sec
  18. 0.000004666 sec
  19. 0.000020666 sec
  20. 0.000005000 sec

 

Board: imx6qsabresd

Linux: imx_3.14.28_1.0.0_ga + preempt-rt patch patch-3.14.28-rt25 

Toolchain: poky 1.7

RootFS: core-image-minimal

 

  1. testrun.c

 

#include <stdio.h>

#include <time.h>

#include <sched.h>

#include <string.h>

#include <unistd.h>

#include <sys/mman.h>

 

struct timespec diff(struct timespec start, struct timespec end)

{

struct timespec temp;

if ((end.tv_nsec-start.tv_nsec)<0) {

temp.tv_sec = end.tv_sec-start.tv_sec-1;

temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;

} else {

temp.tv_sec = end.tv_sec-start.tv_sec;

temp.tv_nsec = end.tv_nsec-start.tv_nsec;

}

return temp;

}

 

int main(){

struct timespec time1, time2;

struct sched_param schedp;

 

if (mlockall(MCL_CURRENT | MCL_FUTURE))

perror("mlockall failed:");

 

memset(&schedp, 0, sizeof(schedp));

schedp.sched_priority = 90;

sched_setscheduler(0, SCHED_FIFO, &schedp);

 

while(1) {

  clock_gettime(CLOCK_REALTIME, &time1);

usleep(1);

  clock_gettime(CLOCK_REALTIME, &time2);

  printf("%ld.%09ld sec\n", diff(time1,time2).tv_sec, diff(time1,time2).tv_nsec);

  sleep(1);   

}

return 0;

}

Outcomes