WebBench源码分析

源码分析共享地址:https://github.com/fivezh/WebBench

下载源码后编译源程序后即可执行:

sudo make clean

sudo make & make install

 

1. 使用方法

five@master:~/github/OpenCCode/WebBench$ ./webbench 
webbench [option]... URL
  -f|--force               Dont 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/

five@master:~/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

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。