diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2010-11-02 10:48:57 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2010-11-02 10:48:57 +0000 |
commit | a835b3a78f988d45032449012954c8b4a4e8cd40 (patch) | |
tree | a8ef4b5159a0f26b7a6c6cf5c1978a632ae9f3d3 /src/transport/test_quota_compliance.c | |
parent | 5281d9faaa3610b5609da89ee8e7f31379a75434 (diff) | |
download | gnunet-a835b3a78f988d45032449012954c8b4a4e8cd40.tar.gz gnunet-a835b3a78f988d45032449012954c8b4a4e8cd40.zip |
new: stopping test when maximum transmission rate is hit
Diffstat (limited to 'src/transport/test_quota_compliance.c')
-rw-r--r-- | src/transport/test_quota_compliance.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 1e0a1ad42..86357c540 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -43,10 +43,10 @@ | |||
43 | #define DEBUG_CONNECTIONS GNUNET_NO | 43 | #define DEBUG_CONNECTIONS GNUNET_NO |
44 | 44 | ||
45 | #define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) | 45 | #define MEASUREMENT_INTERVALL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3) |
46 | #define MEASUREMENT_MSG_SIZE 10000 | 46 | #define MEASUREMENT_MSG_SIZE 1024 |
47 | #define MEASUREMENT_MSG_SIZE_BIG 32768 | 47 | #define MEASUREMENT_MSG_SIZE_BIG 32768 |
48 | #define MEASUREMENT_MAX_QUOTA 10000 | 48 | #define MEASUREMENT_MAX_QUOTA 1024 * 1024 * 1024 |
49 | #define MEASUREMENT_MIN_QUOTA 1024 | 49 | #define MEASUREMENT_MIN_QUOTA 1024 * 1024 |
50 | #define SEND_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 35) | 50 | #define SEND_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 35) |
51 | /** | 51 | /** |
52 | * Testcase timeout | 52 | * Testcase timeout |
@@ -352,7 +352,8 @@ static void | |||
352 | measurement_end (void *cls, | 352 | measurement_end (void *cls, |
353 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 353 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
354 | { | 354 | { |
355 | int quota_allowed = 0; | 355 | static int strike_counter; |
356 | unsigned long long quota_allowed = 0; | ||
356 | measurement_task = GNUNET_SCHEDULER_NO_TASK; | 357 | measurement_task = GNUNET_SCHEDULER_NO_TASK; |
357 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 358 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
358 | return; | 359 | return; |
@@ -387,9 +388,9 @@ measurement_end (void *cls, | |||
387 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 388 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
388 | "\nQuota compliance failed: \n"\ | 389 | "\nQuota compliance failed: \n"\ |
389 | "Quota allowed: %10llu kB/s\n"\ | 390 | "Quota allowed: %10llu kB/s\n"\ |
390 | "Throughput : %10llu kB/s\n", (quota_allowed / (1024)) , (total_bytes/(duration.rel_value / 1000)/1024)); | 391 | "Throughput : %10llu kB/s\n", (quota_allowed / (1024)), (total_bytes/(duration.rel_value / 1000)/1024)); |
391 | ok = 1; | 392 | ok = 1; |
392 | /* end(); | 393 | /*end(); |
393 | return;*/ | 394 | return;*/ |
394 | } | 395 | } |
395 | else | 396 | else |
@@ -401,11 +402,28 @@ measurement_end (void *cls, | |||
401 | ok = 0; | 402 | ok = 0; |
402 | } | 403 | } |
403 | 404 | ||
405 | if ((quota_allowed) > (2 *(total_bytes/(duration.rel_value / 1000)))) | ||
406 | { | ||
407 | strike_counter++; | ||
408 | if (strike_counter == 2) | ||
409 | { | ||
410 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
411 | "Maximum transmission rate reached, stopping test\n"); | ||
412 | end(); | ||
413 | return; | ||
414 | } | ||
415 | } | ||
416 | else | ||
417 | { | ||
418 | strike_counter = 0; | ||
419 | } | ||
420 | |||
404 | if (quota_allowed == MEASUREMENT_MAX_QUOTA) | 421 | if (quota_allowed == MEASUREMENT_MAX_QUOTA) |
405 | { | 422 | { |
406 | end(); | 423 | end(); |
407 | return; | 424 | return; |
408 | } | 425 | } |
426 | |||
409 | if (is_asymmetric_send_constant == GNUNET_YES) | 427 | if (is_asymmetric_send_constant == GNUNET_YES) |
410 | { | 428 | { |
411 | if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA) | 429 | if ((quota_allowed * 2) < MEASUREMENT_MAX_QUOTA) |