Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.o
*~
.*.sw*
.deps/
Makefile
Makefile.in
Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ common_incl = include/comp.h \
include/message.hpp \
include/milenage.h \
include/call_generation_task.hpp \
include/ratetask.hpp \
include/reporttask.hpp \
include/rijndael.h \
include/scenario.hpp \
Expand Down Expand Up @@ -83,6 +84,7 @@ common_SOURCES = src/actions.cpp \
src/message.cpp \
src/milenage.c \
src/call_generation_task.cpp \
src/ratetask.cpp \
src/reporttask.cpp \
src/rijndael.c \
src/scenario.cpp \
Expand Down
50 changes: 50 additions & 0 deletions include/ratetask.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* 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
*
* Author : Richard GAYRAUD - 04 Nov 2003
* Marc LAMBERTON
* Olivier JACQUES
* Herve PELLAN
* David MANSUTTI
* Francois-Xavier Kowalski
* Gerard Lyonnaz
* From Hewlett Packard Company.
* F. Tarek Rogers
* Peter Higginson
* Vincent Luba
* Shriram Natarajan
* Guillaume Teissier from FTR&D
* Clement Chen
* Wolfgang Beck
* Charles P Wright from IBM Research
*/

#ifndef RATETASK_HPP
#define RATETASK_HPP

#include "task.hpp"

class ratetask : public task
{
public:
unsigned int wake();
static void initialize();
bool run();
void dump();
private:
static class ratetask *instance;
};

#endif
4 changes: 4 additions & 0 deletions include/sipp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
#include "infile.hpp"
#include "call_generation_task.hpp"
#include "reporttask.hpp"
#include "ratetask.hpp"
#include "watchdog.hpp"
/* Open SSL stuff */
#ifdef _USE_OPENSSL
Expand Down Expand Up @@ -162,6 +163,7 @@ cmd messages are received */
#define DEFAULT_SERVICE ((char *)"service")
#define DEFAULT_AUTH_PASSWORD ((char *)"password")
#define DEFAULT_REPORT_FREQ 1000
#define DEFAULT_RATE_INCR_FREQ 0
#define DEFAULT_REPORT_FREQ_DUMP_LOG 60000
#define DEFAULT_TIMER_RESOLUTION 1
#define DEFAULT_FREQ_DUMP_RTT 200
Expand Down Expand Up @@ -190,6 +192,7 @@ extern double rate _DEFVAL(DEFAULT_RATE);
extern double rate_scale _DEFVAL(DEFAULT_RATE_SCALE);
extern int rate_increase _DEFVAL(0);
extern int rate_max _DEFVAL(0);
extern unsigned long rate_increase_freq _DEFVAL(DEFAULT_RATE_INCR_FREQ);
extern bool rate_quit _DEFVAL(true);
extern int users _DEFVAL(-1);
extern int rate_period_ms _DEFVAL(DEFAULT_RATE_PERIOD_MS);
Expand Down Expand Up @@ -391,6 +394,7 @@ extern int last_paused_calls _DEFVAL(0);
extern unsigned int open_calls_allowed _DEFVAL(0);
extern unsigned long last_report_time _DEFVAL(0);
extern unsigned long last_dump_time _DEFVAL(0);
extern unsigned long last_rate_increase_time _DEFVAL(0);

/********************** Clock variables ***********************/

Expand Down
78 changes: 78 additions & 0 deletions src/ratetask.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* 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
*
* Author : Richard GAYRAUD - 04 Nov 2003
* Marc LAMBERTON
* Olivier JACQUES
* Herve PELLAN
* David MANSUTTI
* Francois-Xavier Kowalski
* Gerard Lyonnaz
* From Hewlett Packard Company.
* F. Tarek Rogers
* Peter Higginson
* Vincent Luba
* Shriram Natarajan
* Guillaume Teissier from FTR&D
* Clement Chen
* Wolfgang Beck
* Charles P Wright from IBM Research
*/
#include "sipp.hpp"

class ratetask *ratetask::instance = NULL;

void ratetask::initialize()
{
assert(instance == NULL);
if (rate_increase) {
instance = new ratetask();
}
}

void ratetask::dump()
{
WARNING("Increasing call rate task.");
}

bool ratetask::run()
{
if (quitting >= 10) {
delete this;
return false;
}

/* Statistics Logs. */
if ((getmilliseconds() - last_rate_increase_time) >= rate_increase_freq) {
if (rate_increase) {
rate += rate_increase;
if (rate_max && (rate > rate_max)) {
rate = rate_max;
if (rate_quit) {
quitting += 10;
}
}
CallGenerationTask::set_rate(rate);
last_rate_increase_time = clock_tick;
}
}
setPaused();
return true;
}

unsigned int ratetask::wake()
{
return last_rate_increase_time + rate_increase_freq;
}
13 changes: 2 additions & 11 deletions src/reporttask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class screentask *screentask::instance = NULL;
void stattask::initialize()
{
assert(instance == NULL);
if (dumpInFile || useCountf || useErrorCodesf || rate_increase) {
if (dumpInFile || useCountf || useErrorCodesf) {
instance = new stattask();
}
}
Expand Down Expand Up @@ -109,16 +109,6 @@ bool stattask::run()
{
/* Statistics Logs. */
if((getmilliseconds() - last_dump_time) >= report_freq_dumpLog) {
if (rate_increase) {
rate += rate_increase;
if (rate_max && (rate > rate_max)) {
rate = rate_max;
if (rate_quit) {
quitting += 10;
}
}
CallGenerationTask::set_rate(rate);
}
report();
}
setPaused();
Expand All @@ -129,3 +119,4 @@ unsigned int stattask::wake()
{
return last_dump_time + report_freq_dumpLog;
}

11 changes: 9 additions & 2 deletions src/sipp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,13 @@ struct sipp_option options_table[] = {
"Example: -r 7 -rp 2000 ==> 7 calls every 2 seconds.\n -r 10 -rp 5s => 10 calls every 5 seconds.", SIPP_OPTION_TIME_MS, &rate_period_ms, 1},
{"rate_scale", "Control the units for the '+', '-', '*', and '/' keys.", SIPP_OPTION_FLOAT, &rate_scale, 1},

{"rate_increase", "Specify the rate increase every -fd units (default is seconds). This allows you to increase the load for each independent logging period.\n"
"Example: -rate_increase 10 -fd 10s\n"
{"rate_increase", "Specify the rate increase every -rate_interval units (default is seconds). This allows you to increase the load for each independent logging period.\n"
"Example: -rate_increase 10 -rate_interval 10s\n"
" ==> increase calls by 10 every 10 seconds.", SIPP_OPTION_INT, &rate_increase, 1},
{"rate_max", "If -rate_increase is set, then quit after the rate reaches this value.\n"
"Example: -rate_increase 10 -rate_max 100\n"
" ==> increase calls by 10 until 100 cps is hit.", SIPP_OPTION_INT, &rate_max, 1},
{"rate_interval", "Set the interval by which the call rate is increased. Defaults to the value of -fd.", SIPP_OPTION_TIME_SEC, &rate_increase_freq, 1},
{"no_rate_quit", "If -rate_increase is set, do not quit after the rate reaches -rate_max.", SIPP_OPTION_UNSETFLAG, &rate_quit, 1},

{"l", "Set the maximum number of simultaneous calls. Once this limit is reached, traffic is decreased until the number of open calls goes down. Default:\n"
Expand Down Expand Up @@ -1834,6 +1835,10 @@ int main(int argc, char *argv[])
report_freq_dumpRtt);
}

if (rate_increase_freq == 0) {
rate_increase_freq = report_freq_dumpLog;
}

// Check the soft limit on the number of open files,
// error out if this does not allow us to open the
// required number of signalling channels, and warn
Expand Down Expand Up @@ -1936,6 +1941,8 @@ int main(int argc, char *argv[])
stattask::initialize();
/* Create the screen update task. */
screentask::initialize();
/* Create the rate increase task. */
ratetask::initialize();
/* Create a watchdog task. */
if (watchdog_interval) {
new watchdog(watchdog_interval, watchdog_reset, watchdog_major_threshold, watchdog_major_maxtriggers, watchdog_minor_threshold, watchdog_minor_maxtriggers);
Expand Down