Source Analysis shared Address: Https://github.com/fivezh/WebBench
After the source code is compiled, it can be executed after download.
sudo make clean
sudo make & make install
1. How to use
[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 -. -p|--proxy <server:port> Use proxy server forrequest. -c|--clients <n> Run <n>HTTP clients at once. Default one. -9|--http09 Use http/0.9style requests. -1|--HTTP10 Use http/1.0protocol. -2|--HTTP11 Use http/1.1protocol. --get use Get request method. --HeadUse HEAD request method. --Options Use Options request method. --Trace Use trace request method. -?| -h|--Help this information. -v|--version Display program version.
Example:./webbench-t 10-c http://www.baidu.com/
[Email protected]:~/github/openccode/webbench$./webbench-tTen-C -http//www.baidu.com/Webbench-simple Web Benchmark1.5Copyright (c) Radim Kolar1997-2004, GPL Open Source Software.Benchmarking:GET http://www.baidu.com/ -Clients, runningTensec. speed=492Pages/min,918494bytes/sec. Requests: theSusceed,0Failed.
2. Source Code Analysis
Knowledge point 1:
Volatile usage,
Reference:
http://blog.csdn.net/bigloomy/article/details/6645810
Http://www.cnblogs.com/chio/archive/2007/11/24/970632.html
Webbench Source Code Analysis