⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conn_rate.c

📁 一个WEB服务器的性能测试工具
💻 C
字号:
/*    httperf -- a tool for measuring web server performance    Copyright (C) 2000  Hewlett-Packard Company    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>    This file is part of httperf, a web server performance measurment    tool.    This program is free software; you can redistribute it and/or    modify it under the terms of the GNU General Public License as    published by the Free Software Foundation; either version 2 of the    License, or (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA    02111-1307 USA*//* Creates connections at the fixed rate PARAM.RATE or sequentially if   PARAM.RATE is zero.  */#include <assert.h>#include <stdio.h>#include <httperf.h>#include <core.h>#include <event.h>#include <rate.h>#include <conn.h>#include <timer.h>static int num_conns_generated;static int num_conns_destroyed;static Rate_Generator rg;static intmake_conn (Any_Type arg){  Conn *s;  if (num_conns_generated++ >= param.num_conns)    return -1;  s = conn_new ();  if (!s)    return -1;  core_connect (s);  return 0;}static voiddestroyed (void){  if (++num_conns_destroyed >= param.num_conns)    core_exit ();}static voidinit (void){  Any_Type arg;  rg.arg.l = 0;  rg.tick = make_conn;  arg.l = 0;  event_register_handler (EV_CONN_DESTROYED, (Event_Handler) destroyed, arg);}static voidstart (void){  rg.rate = &param.rate;  rate_generator_start (&rg, EV_CONN_DESTROYED);}Load_Generator conn_rate =  {    "creates connections at a fixed rate",    init,    start,    no_op  };

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -