Tool/software: Linux
Hi all
I was using usleep in DM8168 and found something strange. we know DM8168 run in 100HZ(CONFIG_HZ) by default, it means the minimum sleep time is 10 ms(microsecond).we can't sleep for less that 10ms, because that's the resolution of the scheduler.right?
But after testing,i get this:
root@dm816x:~/xxx# ./test_sleep function time(usec) realTime reduce ------------------------------------------------------------------- ---------------------------- usleep 500000 500082 82 select 500000 500513 513 ---------------------------- usleep 100000 100086 86 select 100000 100142 142 ---------------------------- usleep 50000 50072 72 select 50000 50072 72 ---------------------------- usleep 10000 10071 71 select 10000 10072 72 ---------------------------- usleep 1000 1073 73 select 1000 1071 71 ---------------------------- usleep 900 970 70 select 900 972 72 ---------------------------- usleep 500 571 71 select 500 572 72 ---------------------------- usleep 100 181 81 select 100 172 72 ---------------------------- usleep 10 80 70 select 10 81 71 ---------------------------- usleep 1 71 70 select 1 72 71 ---------------------------- usleep 0 70 70 select 0 4 4 ---------------------------- usleep 0 71 71 select 0 4 4
it seems the minimum sleep time is only 70us with usleep,and 4us with select.how usleep can broke up the scheduler?
Can anyone tell me ?
Best Regards