summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/benchmarks/bench_raw.c10
-rw-r--r--tests/benchmarks/benchmarks.c13
-rw-r--r--tests/benchmarks/benchmarks.h1
3 files changed, 21 insertions, 3 deletions
diff --git a/tests/benchmarks/bench_raw.c b/tests/benchmarks/bench_raw.c
index 431659c5..62e1055d 100644
--- a/tests/benchmarks/bench_raw.c
+++ b/tests/benchmarks/bench_raw.c
@@ -107,7 +107,7 @@ error:
int benchmarks_raw_up (ssh_session session, struct argument_s *args,
float *bps){
unsigned long bytes=0x1000000;
- char *script=get_python_eater(bytes);
+ char *script;
char cmd[128];
static char buffer[0x10000];
int err;
@@ -116,6 +116,9 @@ int benchmarks_raw_up (ssh_session session, struct argument_s *args,
float ms=0.0;
unsigned long total=0;
+ if(args->data != 0)
+ bytes = args->data * 1024 * 1024;
+ script =get_python_eater(bytes);
err=upload_script(session,"/tmp/eater.py",script);
free(script);
if(err<0)
@@ -221,7 +224,7 @@ static char *get_python_giver(unsigned long bytes){
int benchmarks_raw_down (ssh_session session, struct argument_s *args,
float *bps){
unsigned long bytes=0x1000000;
- char *script=get_python_giver(bytes);
+ char *script;
char cmd[128];
static char buffer[0x10000];
int err;
@@ -230,6 +233,9 @@ int benchmarks_raw_down (ssh_session session, struct argument_s *args,
float ms=0.0;
unsigned long total=0;
+ if(args->data != 0)
+ bytes = args->data * 1024 * 1024;
+ script =get_python_giver(bytes);
err=upload_script(session,"/tmp/giver.py",script);
free(script);
if(err<0)
diff --git a/tests/benchmarks/benchmarks.c b/tests/benchmarks/benchmarks.c
index 647e5e7e..0dd0d0df 100644
--- a/tests/benchmarks/benchmarks.c
+++ b/tests/benchmarks/benchmarks.c
@@ -78,6 +78,14 @@ static struct argp_option options[] = {
.doc = "Add a host to connect for benchmark (format user@hostname)",
.group = 0
},
+ {
+ .name = "data",
+ .key = 'd',
+ .arg = "MBYTES",
+ .flags = 0,
+ .doc = "MBytes of data to send/receive per test",
+ .group = 0
+ },
{NULL, 0, NULL, 0, NULL, 0}
};
@@ -100,6 +108,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) {
case 'v':
arguments->verbose++;
break;
+ case 'd':
+ arguments->data = atoi(arg);
+ break;
case 'h':
if(arguments->nhosts >= MAX_HOSTS_CONNECT){
fprintf(stderr, "Too much hosts\n");
@@ -222,7 +233,7 @@ int main(int argc, char **argv){
return EXIT_FAILURE;
}
if (arguments.ntests==0){
- for(i=1; i < BENCHMARK_NUMBER ; ++i){
+ for(i=0; i < BENCHMARK_NUMBER ; ++i){
arguments.benchmarks[i]=1;
}
arguments.ntests=BENCHMARK_NUMBER;
diff --git a/tests/benchmarks/benchmarks.h b/tests/benchmarks/benchmarks.h
index 3c51a743..ffa1bfae 100644
--- a/tests/benchmarks/benchmarks.h
+++ b/tests/benchmarks/benchmarks.h
@@ -41,6 +41,7 @@ struct argument_s {
int verbose;
int nhosts;
int ntests;
+ int data;
};
/* latency.c */