linuxsleep函数不准

linuxsleep函数不准,第1张

linuxsleep函数不准解决办法如下:

如下面的一段程序:

应用程序:

#include <syswait.h>

usleep(n) //n微秒

Sleep(n)//n毫秒

sleep(n)//n秒

驱动程序:

#include <linux/delay.h>

mdelay(n) //milliseconds 其实现

#ifdef notdef

#define mdelay(n) (\

{unsigned long msec=(n)while (msec--) udelay(1000)})

#else,linuxsleep函数不准就可以调整为正确的了。

1. 限速/取消限速/测试限速

     限速:   wondershaper eth0 10000 8000      下行10000kb/s   上行8000kb/s

     取消限速:  wondershaper clear eth0

     测试限速:  server端: iperf3 -s     client端: iperf3 -c  serverip -i 1

     查看指定端口速度:   iftop -i eth0

2. 模拟丢包

    tc  qdisc  add  dev  eth0  root  netem  loss  1%

3. 模拟延时

    tc qdisc add dev eth0 root netem delay 100ms

4. 模拟乱序

    tc qdisc add dev eth0 root netem delay 10ms reorder 25%

参考

https://blog.csdn.net/shelldon/article/details/54585742


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/7369898.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-04
下一篇 2023-04-04

发表评论

登录后才能评论

评论列表(0条)

保存