1
RisingV 2013-02-05 10:18:16 +08:00 1
#!/bin/bash
CONCURRENCY=8 TIME_START=`date` for ((idx = 0; idx < $CONCURRENCY; idx++)) do time echo "scale=5000; a(1)*4" | bc -l > /dev/null & done echo "$TIME_START Start" RUNNING_PROCESS_NUM=1 while [ $RUNNING_PROCESS_NUM -gt 0 ] do printf "."; sleep 1 RUNNING_PROCESS_NUM=$(ps ax | grep ' bc -l' | grep -v 'grep' | wc -l) done TIME_STOP=`date` echo "$TIME_STOP Stop" |
2
RisingV 2013-02-05 10:18:38 +08:00 1
本地输出:
2013年02月05日星期二 10:15:58 Start ................................................................................................................................................. real 2m43.940s user 0m37.825s sys 0m0.241s real 2m44.163s user 0m37.903s sys 0m0.229s real 2m44.282s user 0m37.896s sys 0m0.209s real 2m44.291s user 0m37.831s sys 0m0.241s real 2m44.291s user 0m37.919s sys 0m0.212s real 2m44.303s user 0m37.895s sys 0m0.216s real 2m44.325s user 0m37.946s sys 0m0.188s real 2m44.386s user 0m37.901s sys 0m0.240s 2013年02月05日星期二 10:18:42 Stop |
3
RisingV 2013-02-05 10:19:55 +08:00
CONCURRENCY=8 是并发进程数,最好有个基准作测试,两台机子比较一下才能从数据上看出意义
|
4
zeruns 2020-06-09 12:52:59 +08:00
看这篇文章,整理了一些测试 VPS 性能的脚本: https://blog.zeruns.tech/archives/533.html
|