我必须测量/ dev/urandom作为分配的效率。我有以下任务:检查,您可以在1分钟内从/ dev/urandom中获取多少个字节的数据。不要在磁盘上写入采集的数据,因为它可能会减慢一切。测量dev /随机效率
我已经试过
timeout 60s cat /dev/urandom | wc -c
但我只收到只是 “终止” 的消息。
我必须测量/ dev/urandom作为分配的效率。我有以下任务:检查,您可以在1分钟内从/ dev/urandom中获取多少个字节的数据。不要在磁盘上写入采集的数据,因为它可能会减慢一切。测量dev /随机效率
我已经试过
timeout 60s cat /dev/urandom | wc -c
但我只收到只是 “终止” 的消息。
添加--foreground
选项:
timeout --foreground 60s cat /dev/urandom | wc -c
--foreground
:当不能直接在shell提示符下运行超时,让命令从TTY读取并获得TTY信号;在这种模式下,COMMAND的孩子不会被超时
命令分组:
$ { timeout 60s cat /dev/urandom; } | wc -c
但到了60秒钟都觉得是偏高对我说:
$ { timeout 1s cat /dev/urandom; } | wc -c
6160384 ### that's 6 Million bytes.
$ { timeout 10s cat /dev/urandom; } | wc -c
63143936 ### that's 63 Million bytes.
$ { timeout 10s cat /dev/urandom; } | wc -c
354844672 ### that's ~355 Million bytes.
但最后的措施受到计算机在那段时间内所做的任何事情的影响。
作品优秀,谢谢! – user3387666