源码分析共享地址:https://github.com/fivezh/WebBench
下载源码后编译源程序后即可执行:
sudo make clean
sudo make & make install
1. 使用方法
[email protected]:~/github/OpenCCode/WebBench$ ./webbench webbench [option]... URL -f|--force Don‘t wait for reply from server. -r|--reload Send reload request - Pragma: no-cache. -t|--time <sec> Run benchmark for <sec> seconds. Default 30. -p|--proxy <server:port> Use proxy server for request. -c|--clients <n> Run <n> HTTP clients at once. Default one. -9|--http09 Use HTTP/0.9 style requests. -1|--http10 Use HTTP/1.0 protocol. -2|--http11 Use HTTP/1.1 protocol. --get Use GET request method. --head Use HEAD request method. --options Use OPTIONS request method. --trace Use TRACE request method. -?|-h|--help This information. -V|--version Display program version.
实例:./webbench -t 10 -c 50 http://www.baidu.com/
[email protected]:~/github/OpenCCode/WebBench$ ./webbench -t 10 -c 50 http://www.baidu.com/ Webbench - Simple Web Benchmark 1.5 Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software. Benchmarking: GET http://www.baidu.com/ 50 clients, running 10 sec. Speed=492 pages/min, 918494 bytes/sec. Requests: 82 susceed, 0 failed.
2. 源码分析
知识点1:
volatile用法,
参考:
http://blog.csdn.net/bigloomy/article/details/6645810
http://www.cnblogs.com/chio/archive/2007/11/24/970632.html
时间: 2024-10-24 11:31:36