http_load支持https

关键字
Makefile、http_load、https

使用方法:

http_load -p 并发访问进程数 -s 访问时间 需要访问的URL文件
http_load -r 5 -s 10 urls.txt

参数说明:

-parallel (-p): 并发的用户进程数
-fetches (-f): 总计的访问次数
-rate (-r): 每秒的访问频率
-seconds (-s): 总计的访问时间

结果说明:

1. 49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
    说明在上面的测试中运行了49个请求,最大的并发进程数是2,总计传输的数据是289884bytes,运行的时间是10.0148 秒
2. 5916 mean bytes/connection
    说明每一连接平均传输的数据量289884/49=5916
3. 4.89274 fetches/sec, 28945.5 bytes/sec
    说明每秒的响应请求为4.89274,每秒传递的数据为28945.5 bytes/sec
4. msecs/connect: 28.8932 mean, 44.243 max, 24.488 min
    说明每连接的平均响应时间是28.8932 msecs,最大的响应时间44.243 msecs,最小的响应时间24.488 msecs
5. msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min
6. HTTP response codes: code 200 — 49
    说明打开响应页面的类型

修改Makefile使其支持https

SSL_TREE =  /usr/local/ssl
SSL_DEFS =  -DUSE_SSL
SSL_INC =   -I$(SSL_TREE)/include
SSL_LIBS =  -L$(SSL_TREE)/lib -lssl -lcrypto
LDFLAGS =    -s $(SSL_LIBS) $(SYSV_LIBS) -rdynamic -ldl

完整Makefile

# Makefile for http_load

# CONFIGURE: If you are using a SystemV-based operating system, such as
# Solaris, you will need to uncomment this definition.
#SYSV_LIBS =    -lnsl -lsocket -lresolv

# CONFIGURE: If you want to compile in support for https, uncomment these
# definitions.  You will need to have already built OpenSSL, available at
# http://www.openssl.org/  Make sure the SSL_TREE definition points to the
# tree with your OpenSSL installation - depending on how you installed it,
# it may be in /usr/local instead of /usr/local/ssl.
SSL_TREE =  /usr/local/ssl
SSL_DEFS =  -DUSE_SSL
SSL_INC =   -I$(SSL_TREE)/include
SSL_LIBS =  -L$(SSL_TREE)/lib -lssl -lcrypto


BINDIR =    /usr/local/bin
MANDIR =    /usr/local/man/man1
CC =        gcc -Wall
CFLAGS =    -O $(SRANDOM_DEFS) $(SSL_DEFS) $(SSL_INC)
#CFLAGS =   -g $(SRANDOM_DEFS) $(SSL_DEFS) $(SSL_INC)
# LDFLAGS = -s $(SSL_LIBS) $(SYSV_LIBS)
LDFLAGS =    -s $(SSL_LIBS) $(SYSV_LIBS) -rdynamic -ldl
#LDFLAGS =  -g $(SSL_LIBS) $(SYSV_LIBS)

all:        http_load

http_load:  http_load.o timers.o
    $(CC) $(CFLAGS) http_load.o timers.o $(LDFLAGS) -o http_load

http_load.o:    http_load.c timers.h port.h
    $(CC) $(CFLAGS) -c http_load.c

timers.o:   timers.c timers.h
    $(CC) $(CFLAGS) -c timers.c

install:    all
    rm -f $(BINDIR)/http_load
    cp http_load $(BINDIR)
    rm -f $(MANDIR)/http_load.1
    cp http_load.1 $(MANDIR)

clean:
    rm -f http_load *.o core core.* *.core

tar:
    @name=`sed -n -e '/define VERSION /!d' -e 's,.*http_load ,http_load-,' -e 's,",,p' version.h` ; \
      rm -rf $$name ; \
      mkdir $$name ; \
      tar cf - `cat FILES` | ( cd $$name ; tar xfBp - ) ; \
      chmod 644 $$name/Makefile ; \
      tar cf $$name.tar $$name ; \
      rm -rf $$name ; \
      gzip $$name.tar
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、Python简介和环境搭建以及pip的安装 4课时实验课主要内容 【Python简介】: Python 是一个...
    _小老虎_阅读 5,820评论 0 10
  • Swift1> Swift和OC的区别1.1> Swift没有地址/指针的概念1.2> 泛型1.3> 类型严谨 对...
    cosWriter阅读 11,144评论 1 32
  • 国家电网公司企业标准(Q/GDW)- 面向对象的用电信息数据交换协议 - 报批稿:20170802 前言: 排版 ...
    庭说阅读 11,178评论 6 13
  • 来自陈浩的一片老文,但绝对营养。 示例工程:3 个头文件*.h,和 8 个 C 文件*.c。 初 编译过程,源文件...
    周筱鲁阅读 4,747评论 0 17
  • 湖北荆州公安。宏泰车站。休息时间,司机们聚在一起。刘师傅提醒张师傅,这段时间开车注意哦,看你精神不好。张师傅未置可...
    快乐的山地人阅读 348评论 0 3