aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-01-30 08:29:58 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-01-30 08:29:58 +0000
commit5fcfc5b84691d1abb216ba5d5ab4b6b8a1f807f4 (patch)
treeb76f2ba3dbe5c4495e16b401d92b177bcbd71f0c /src
parent1c45def2ce88a925031cf6fcc24fa3cfce6a7075 (diff)
downloadgnunet-5fcfc5b84691d1abb216ba5d5ab4b6b8a1f807f4.tar.gz
gnunet-5fcfc5b84691d1abb216ba5d5ab4b6b8a1f807f4.zip
documentation
Diffstat (limited to 'src')
-rw-r--r--src/ats-tests/ats-testing-log.c10
-rw-r--r--src/ats-tests/ats-testing.c16
-rw-r--r--src/ats-tests/ats-testing.h125
3 files changed, 136 insertions, 15 deletions
diff --git a/src/ats-tests/ats-testing-log.c b/src/ats-tests/ats-testing-log.c
index ffd55c88e..29408d1f8 100644
--- a/src/ats-tests/ats-testing-log.c
+++ b/src/ats-tests/ats-testing-log.c
@@ -403,7 +403,7 @@ write_bw_gnuplot_script (char * fn, struct LoggingPeer *lp)
403 403
404 404
405void 405void
406GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, char *test) 406GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, char *test_name)
407{ 407{
408 struct GNUNET_DISK_FileHandle *f; 408 struct GNUNET_DISK_FileHandle *f;
409 409
@@ -418,7 +418,7 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, char *test)
418 418
419 for (c_m = 0; c_m < l->num_peers; c_m++) 419 for (c_m = 0; c_m < l->num_peers; c_m++)
420 { 420 {
421 GNUNET_asprintf (&filename, "%s_%llu_master_%u_%s_%s.data", test, GNUNET_TIME_absolute_get().abs_value_us, 421 GNUNET_asprintf (&filename, "%s_%llu_master_%u_%s_%s.data", test_name, GNUNET_TIME_absolute_get().abs_value_us,
422 l->lp[c_m].peer->no, GNUNET_i2s(&l->lp[c_m].peer->id), l->name); 422 l->lp[c_m].peer->no, GNUNET_i2s(&l->lp[c_m].peer->id), l->name);
423 423
424 f = GNUNET_DISK_file_open (filename, 424 f = GNUNET_DISK_file_open (filename,
@@ -496,7 +496,11 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, char *test)
496 } 496 }
497} 497}
498 498
499 499/**
500 * Log all data now
501 *
502 * @param llogging handle to use
503 */
500void 504void
501GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l) 505GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l)
502{ 506{
diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c
index fea04f41b..381dd7bb6 100644
--- a/src/ats-tests/ats-testing.c
+++ b/src/ats-tests/ats-testing.c
@@ -837,6 +837,19 @@ controller_event_cb (void *cls,
837} 837}
838 838
839 839
840/**
841 * Create a topology for ats testing
842 *
843 * @param name test name
844 * @param cfg_file configuration file to use for the peers
845 * @param num_slaves number of slaves
846 * @param num_masters number of masters
847 * @param test_core connect to CORE service (GNUNET_YES) or transport (GNUNET_NO)
848 * @param done_cb function to call when topology is setup
849 * @param done_cb_cls cls for callback
850 * @param recv_cb callback to call when data are received
851 * @param perf_cb callback to call when performance info are received
852 */
840void 853void
841GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, 854GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file,
842 unsigned int num_slaves, 855 unsigned int num_slaves,
@@ -876,6 +889,9 @@ GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file,
876 &main_run, NULL); 889 &main_run, NULL);
877} 890}
878 891
892/**
893 * Shutdown topology
894 */
879void 895void
880GNUNET_ATS_TEST_shutdown_topology (void) 896GNUNET_ATS_TEST_shutdown_topology (void)
881{ 897{
diff --git a/src/ats-tests/ats-testing.h b/src/ats-tests/ats-testing.h
index 8a59fb3f8..91c15d6d1 100644
--- a/src/ats-tests/ats-testing.h
+++ b/src/ats-tests/ats-testing.h
@@ -31,26 +31,62 @@
31 31
32#define TEST_ATS_PREFERENCE_DEFAULT 1.0 32#define TEST_ATS_PREFERENCE_DEFAULT 1.0
33 33
34/**
35 * Message type sent for traffic generation
36 */
34#define TEST_MESSAGE_TYPE_PING 12345 37#define TEST_MESSAGE_TYPE_PING 12345
38
39/**
40 * Message type sent as response during traffic generation
41 */
35#define TEST_MESSAGE_TYPE_PONG 12346 42#define TEST_MESSAGE_TYPE_PONG 12346
43
44/**
45 * Size of test messages
46 */
36#define TEST_MESSAGE_SIZE 100 47#define TEST_MESSAGE_SIZE 100
37 48
38struct BenchmarkPartner; 49struct BenchmarkPartner;
50
39struct BenchmarkPeer; 51struct BenchmarkPeer;
52
40struct GNUNET_ATS_TEST_Topology; 53struct GNUNET_ATS_TEST_Topology;
54
41struct TrafficGenerator; 55struct TrafficGenerator;
56
42struct LoggingHandle; 57struct LoggingHandle;
43 58
59
60/**
61 * Callback to call when topology setup is completed
62 *
63 * @param cls the closure
64 * @param masters array of master peers
65 * @param slaves array of master peers
66 */
44typedef void (*GNUNET_ATS_TEST_TopologySetupDoneCallback) (void *cls, 67typedef void (*GNUNET_ATS_TEST_TopologySetupDoneCallback) (void *cls,
45 struct BenchmarkPeer *masters, 68 struct BenchmarkPeer *masters,
46 struct BenchmarkPeer *slaves); 69 struct BenchmarkPeer *slaves);
47 70
71/**
72 * Callback called when logging is required for the data contained
73 *
74 * @param cls the closure
75 * @param address an address
76 * @param address_active is address active
77 * @param bandwidth_out bandwidth outbound
78 * @param bandwidth_in bandwidth inbound
79 * @param ats ats information
80 * @param ats_count number of ats inforation
81 */
48typedef void 82typedef void
49(*GNUNET_ATS_TEST_LogRequest) (void *cls, 83(*GNUNET_ATS_TEST_LogRequest) (void *cls,
50 const struct GNUNET_HELLO_Address *address, int address_active, 84 const struct GNUNET_HELLO_Address *address,
85 int address_active,
51 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 86 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
52 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 87 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
53 const struct GNUNET_ATS_Information *ats, uint32_t ats_count); 88 const struct GNUNET_ATS_Information *ats,
89 uint32_t ats_count);
54 90
55/** 91/**
56 * Information we track for a peer in the testbed. 92 * Information we track for a peer in the testbed.
@@ -444,21 +480,56 @@ struct Experiment
444 GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb; 480 GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb;
445}; 481};
446 482
483/*
484 * Experiment related functions
485 */
486
487
488/**
489 * Execute the specified experiment
490 *
491 * @param e the Experiment
492 * @param ep_done_cb a episode is completed
493 * @param e_done_cb the experiment is completed
494 */
447void 495void
448GNUNET_ATS_TEST_experimentation_run (struct Experiment *e, 496GNUNET_ATS_TEST_experimentation_run (struct Experiment *e,
449 GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb, 497 GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb,
450 GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb); 498 GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb);
451 499
500/**
501 * Load an experiment from a file
502 *
503 * @param filename the file
504 * @return the Experiment or NULL on failure
505 */
452struct Experiment * 506struct Experiment *
453GNUNET_ATS_TEST_experimentation_load (char *filename); 507GNUNET_ATS_TEST_experimentation_load (char *filename);
454 508
509
510/**
511 * Stop an experiment
512 *
513 * @param e the experiment
514 */
455void 515void
456GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e); 516GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e);
457 517
518/*
519 * Traffic related functions
520 */
521
522void
523GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p);
524
525void
526GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p);
527
458 528
459struct TrafficGenerator * 529struct TrafficGenerator *
460GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, 530GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src,
461 struct BenchmarkPartner *dest, unsigned int rate, 531 struct BenchmarkPartner *dest,
532 unsigned int rate,
462 struct GNUNET_TIME_Relative duration); 533 struct GNUNET_TIME_Relative duration);
463 534
464void 535void
@@ -470,6 +541,11 @@ GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg);
470void 541void
471GNUNET_ATS_TEST_generate_traffic_stop_all (); 542GNUNET_ATS_TEST_generate_traffic_stop_all ();
472 543
544
545/*
546 * Logging related functions
547 */
548
473/** 549/**
474 * Start logging 550 * Start logging
475 * 551 *
@@ -481,7 +557,9 @@ GNUNET_ATS_TEST_generate_traffic_stop_all ();
481 */ 557 */
482struct LoggingHandle * 558struct LoggingHandle *
483GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, 559GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency,
484 char * testname, struct BenchmarkPeer *masters, int num_masters); 560 char * testname,
561 struct BenchmarkPeer *masters,
562 int num_masters);
485 563
486/** 564/**
487 * Stop logging 565 * Stop logging
@@ -493,20 +571,40 @@ GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l);
493 571
494/** 572/**
495 * Log all data now 573 * Log all data now
574 *
575 * @param llogging handle to use
496 */ 576 */
497void 577void
498GNUNET_ATS_TEST_logging_now (struct LoggingHandle *); 578GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l);
499 579
500void
501GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *, char *test);
502
503void
504GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p);
505 580
581/**
582 * Write logging data to file
583 *
584 * @param l logging handle to use
585 * @param test_name name of the current test
586 */
506void 587void
507GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p); 588GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *h,
589 char *test_name);
508 590
591/*
592 * Topology related functions
593 */
509 594
595/**
596 * Create a topology for ats testing
597 *
598 * @param name test name
599 * @param cfg_file configuration file to use for the peers
600 * @param num_slaves number of slaves
601 * @param num_masters number of masters
602 * @param test_core connect to CORE service (GNUNET_YES) or transport (GNUNET_NO)
603 * @param done_cb function to call when topology is setup
604 * @param done_cb_cls cls for callback
605 * @param recv_cb callback to call when data are received
606 * @param perf_cb callback to call when performance info are received
607 */
510void 608void
511GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, 609GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file,
512 unsigned int num_slaves, 610 unsigned int num_slaves,
@@ -514,9 +612,12 @@ GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file,
514 int test_core, 612 int test_core,
515 GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb, 613 GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb,
516 void *done_cb_cls, 614 void *done_cb_cls,
517 GNUNET_TRANSPORT_ReceiveCallback transport_recv_cb, 615 GNUNET_TRANSPORT_ReceiveCallback recv_cb,
518 GNUNET_ATS_TEST_LogRequest ats_perf_cb); 616 GNUNET_ATS_TEST_LogRequest ats_perf_cb);
519 617
618/**
619 * Shutdown topology
620 */
520void 621void
521GNUNET_ATS_TEST_shutdown_topology (void); 622GNUNET_ATS_TEST_shutdown_topology (void);
522 623