aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-ats-solver-eval.h
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-04-16 09:35:10 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-04-16 09:35:10 +0000
commitf339605b423c496ed28664e0d9ea2c8dec8f83f7 (patch)
treee54d0bdfcff305a81a9186505da17b13cb42219f /src/ats/gnunet-ats-solver-eval.h
parent6355da1d20a93f99645494c2096e695a22c4ad7f (diff)
downloadgnunet-f339605b423c496ed28664e0d9ea2c8dec8f83f7.tar.gz
gnunet-f339605b423c496ed28664e0d9ea2c8dec8f83f7.zip
file logging
Diffstat (limited to 'src/ats/gnunet-ats-solver-eval.h')
-rw-r--r--src/ats/gnunet-ats-solver-eval.h589
1 files changed, 18 insertions, 571 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.h b/src/ats/gnunet-ats-solver-eval.h
index 3d26afcd9..990a0fd88 100644
--- a/src/ats/gnunet-ats-solver-eval.h
+++ b/src/ats/gnunet-ats-solver-eval.h
@@ -25,6 +25,7 @@
25 */ 25 */
26#ifndef GNUNET_ATS_SOLVER_EVAL_H 26#ifndef GNUNET_ATS_SOLVER_EVAL_H
27#define GNUNET_ATS_SOLVER_EVAL_H 27#define GNUNET_ATS_SOLVER_EVAL_H
28
28#include "platform.h" 29#include "platform.h"
29#include "gnunet_util_lib.h" 30#include "gnunet_util_lib.h"
30#include "gnunet_ats_plugin.h" 31#include "gnunet_ats_plugin.h"
@@ -84,6 +85,21 @@ enum GNUNET_ATS_Solvers
84 GNUNET_ATS_SOLVER_RIL, 85 GNUNET_ATS_SOLVER_RIL,
85}; 86};
86 87
88struct LoggingFileHandle
89{
90 /* DLL list for logging time steps */
91 struct LoggingFileHandle *next;
92 struct LoggingFileHandle *prev;
93
94 /* peer id */
95 int pid;
96
97 /* address id */
98 int aid;
99
100 struct GNUNET_DISK_FileHandle *f_hd;
101
102};
87 103
88struct LoggingTimeStep 104struct LoggingTimeStep
89{ 105{
@@ -111,7 +127,6 @@ struct LoggingPeer
111 struct LoggingAddress *addr_tail; 127 struct LoggingAddress *addr_tail;
112}; 128};
113 129
114
115struct LoggingAddress 130struct LoggingAddress
116{ 131{
117 struct LoggingAddress *next; 132 struct LoggingAddress *next;
@@ -209,14 +224,15 @@ struct LoggingHandle
209 GNUNET_SCHEDULER_TaskIdentifier logging_task; 224 GNUNET_SCHEDULER_TaskIdentifier logging_task;
210 struct GNUNET_TIME_Relative log_freq; 225 struct GNUNET_TIME_Relative log_freq;
211 226
227 /* DLL list for logging time steps */
212 struct LoggingTimeStep *head; 228 struct LoggingTimeStep *head;
213
214 struct LoggingTimeStep *tail; 229 struct LoggingTimeStep *tail;
215}; 230};
216 231
217struct Experiment 232struct Experiment
218{ 233{
219 char *name; 234 char *name;
235 char *log_prefix;
220 char *cfg_file; 236 char *cfg_file;
221 struct GNUNET_TIME_Relative log_freq; 237 struct GNUNET_TIME_Relative log_freq;
222 struct GNUNET_TIME_Relative max_duration; 238 struct GNUNET_TIME_Relative max_duration;
@@ -282,574 +298,5 @@ struct PropertyGenerator
282 struct GNUNET_TIME_Absolute time_start; 298 struct GNUNET_TIME_Absolute time_start;
283}; 299};
284 300
285
286/* LEGACY */
287
288#if 0
289#define TEST_ATS_PREFERENCE_DEFAULT 1.0
290
291/**
292 * Message type sent for traffic generation
293 */
294#define TEST_MESSAGE_TYPE_PING 12345
295
296/**
297 * Message type sent as response during traffic generation
298 */
299#define TEST_MESSAGE_TYPE_PONG 12346
300
301/**
302 * Size of test messages
303 */
304#define TEST_MESSAGE_SIZE 100
305
306struct BenchmarkPartner;
307
308struct BenchmarkPeer;
309
310struct GNUNET_ATS_TEST_Topology;
311
312struct TrafficGenerator;
313
314
315
316
317
318/**
319 * Callback to call when topology setup is completed
320 *
321 * @param cls the closure
322 * @param masters array of master peers
323 * @param slaves array of master peers
324 */
325typedef void (*GNUNET_ATS_TEST_TopologySetupDoneCallback) (void *cls,
326 struct BenchmarkPeer *masters,
327 struct BenchmarkPeer *slaves);
328
329/**
330 * Callback called when logging is required for the data contained
331 *
332 * @param cls the closure
333 * @param address an address
334 * @param address_active is address active
335 * @param bandwidth_out bandwidth outbound
336 * @param bandwidth_in bandwidth inbound
337 * @param ats ats information
338 * @param ats_count number of ats inforation
339 */
340typedef void
341(*GNUNET_ATS_TEST_LogRequest) (void *cls,
342 const struct GNUNET_HELLO_Address *address_id,
343 int address_active,
344 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
345 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
346 const struct GNUNET_ATS_Information *ats,
347 uint32_t ats_count);
348
349/**
350 * Information we track for a peer in the testbed.
351 */
352struct BenchmarkPeer
353{
354 /**
355 * Handle with testbed.
356 */
357 struct GNUNET_TESTBED_Peer *peer;
358
359 /**
360 * Unique identifier
361 */
362 int no;
363
364 /**
365 * Is this peer a measter: GNUNET_YES/GNUNET_NO
366 */
367 int master;
368
369 /**
370 * Peer ID
371 */
372 struct GNUNET_PeerIdentity id;
373
374 /**
375 * Testbed operation to get peer information
376 */
377 struct GNUNET_TESTBED_Operation *peer_id_op;
378
379 /**
380 * Testbed operation to connect to ATS performance service
381 */
382 struct GNUNET_TESTBED_Operation *ats_perf_op;
383
384 /**
385 * Testbed operation to connect to core
386 */
387 struct GNUNET_TESTBED_Operation *comm_op;
388
389 /**
390 * ATS performance handle
391 */
392 struct GNUNET_ATS_PerformanceHandle *ats_perf_handle;
393
394 /**
395 * Masters only:
396 * Testbed connect operations to connect masters to slaves
397 */
398 struct TestbedConnectOperation *core_connect_ops;
399
400 /**
401 * Core handle
402 */
403 struct GNUNET_CORE_Handle *ch;
404
405 /**
406 * Core handle
407 */
408 struct GNUNET_TRANSPORT_Handle *th;
409
410 /**
411 * Masters only:
412 * Peer to set ATS preferences for
413 */
414 struct BenchmarkPeer *pref_partner;
415
416 /**
417 * Masters only
418 * Progress task
419 */
420 GNUNET_SCHEDULER_TaskIdentifier ats_task;
421
422 /**
423 * Masters only
424 * Progress task
425 */
426 double pref_value;
427
428 /**
429 * Array of partners with num_slaves entries (if master) or
430 * num_master entries (if slave)
431 */
432 struct BenchmarkPartner *partners;
433
434 /**
435 * Number of partners
436 */
437 int num_partners;
438
439 /**
440 * Number of core connections
441 */
442 int core_connections;
443
444 /**
445 * Masters only:
446 * Number of connections to slave peers
447 */
448 int core_slave_connections;
449
450 /**
451 * Total number of messages this peer has sent
452 */
453 unsigned int total_messages_sent;
454
455 /**
456 * Total number of bytes this peer has sent
457 */
458 unsigned int total_bytes_sent;
459
460 /**
461 * Total number of messages this peer has received
462 */
463 unsigned int total_messages_received;
464
465 /**
466 * Total number of bytes this peer has received
467 */
468 unsigned int total_bytes_received;
469};
470
471struct TrafficGenerator
472{
473 struct TrafficGenerator *prev;
474 struct TrafficGenerator *next;
475
476 enum GeneratorType type;
477
478 struct BenchmarkPeer *src;
479 struct BenchmarkPartner *dest;
480
481 long int base_rate;
482 long int max_rate;
483 struct GNUNET_TIME_Relative duration_period;
484
485 GNUNET_SCHEDULER_TaskIdentifier send_task;
486 struct GNUNET_TIME_Absolute next_ping_transmission;
487 struct GNUNET_TIME_Absolute time_start;
488};
489
490
491struct PreferenceGenerator
492{
493 struct PreferenceGenerator *prev;
494 struct PreferenceGenerator *next;
495
496 enum GeneratorType type;
497
498 struct BenchmarkPeer *src;
499 struct BenchmarkPartner *dest;
500
501 enum GNUNET_ATS_PreferenceKind kind;
502
503 long int base_value;
504 long int max_value;
505 struct GNUNET_TIME_Relative duration_period;
506 struct GNUNET_TIME_Relative frequency;
507
508 GNUNET_SCHEDULER_TaskIdentifier set_task;
509 struct GNUNET_TIME_Absolute next_ping_transmission;
510 struct GNUNET_TIME_Absolute time_start;
511};
512
513/**
514 * Information about a benchmarking partner
515 */
516struct BenchmarkPartner
517{
518 /**
519 * The peer itself this partner belongs to
520 */
521 struct BenchmarkPeer *me;
522
523 /**
524 * The partner peer
525 */
526 struct BenchmarkPeer *dest;
527
528 /**
529 * Core transmit handles
530 */
531 struct GNUNET_CORE_TransmitHandle *cth;
532
533 /**
534 * Transport transmit handles
535 */
536 struct GNUNET_TRANSPORT_TransmitHandle *tth;
537
538 struct TrafficGenerator *tg;
539 struct PreferenceGenerator *pg;
540
541 /**
542 * Timestamp to calculate communication layer delay
543 */
544 struct GNUNET_TIME_Absolute last_message_sent;
545
546 /**
547 * Accumulated RTT for all messages
548 */
549 unsigned int total_app_rtt;
550
551 /**
552 * Number of messages sent to this partner
553 */
554 unsigned int messages_sent;
555
556 /**
557 * Number of bytes sent to this partner
558 */
559 unsigned int bytes_sent;
560
561 /**
562 * Number of messages received from this partner
563 */
564 unsigned int messages_received;
565
566 /**
567 * Number of bytes received from this partner
568 */
569 unsigned int bytes_received;
570
571 /* Current ATS properties */
572
573 uint32_t ats_distance;
574
575 uint32_t ats_delay;
576
577 uint32_t bandwidth_in;
578
579 uint32_t bandwidth_out;
580
581 uint32_t ats_utilization_up;
582
583 uint32_t ats_utilization_down;
584
585 uint32_t ats_network_type;
586
587 uint32_t ats_cost_wan;
588
589 uint32_t ats_cost_lan;
590
591 uint32_t ats_cost_wlan;
592
593 double pref_bandwidth;
594 double pref_delay;
595};
596
597/**
598 * Overall state of the performance benchmark
599 */
600struct BenchmarkState
601{
602 /**
603 * Are we connected to ATS service of all peers: GNUNET_YES/NO
604 */
605 int connected_ATS_service;
606
607 /**
608 * Are we connected to CORE service of all peers: GNUNET_YES/NO
609 */
610 int connected_COMM_service;
611
612 /**
613 * Are we connected to all peers: GNUNET_YES/NO
614 */
615 int connected_PEERS;
616
617 /**
618 * Are we connected to all slave peers on CORE level: GNUNET_YES/NO
619 */
620 int connected_CORE;
621
622 /**
623 * Are we connected to CORE service of all peers: GNUNET_YES/NO
624 */
625 int benchmarking;
626};
627
628
629struct GNUNET_ATS_TEST_Topology
630{
631 /**
632 * Shutdown task
633 */
634 GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
635
636 /**
637 * Progress task
638 */
639 GNUNET_SCHEDULER_TaskIdentifier progress_task;
640
641 /**
642 * Test result
643 */
644 int result;
645
646 /**Test core (GNUNET_YES) or transport (GNUNET_NO)
647 */
648 int test_core;
649
650 /**
651 * Solver string
652 */
653 char *solver;
654
655 /**
656 * Preference string
657 */
658 char *testname;
659
660 /**
661 * Preference string
662 */
663 char *pref_str;
664
665 /**
666 * ATS preference value
667 */
668 int pref_val;
669
670 /**
671 * Number master peers
672 */
673 unsigned int num_masters;
674
675 /**
676 * Array of master peers
677 */
678 struct BenchmarkPeer *mps;
679
680 /**
681 * Number slave peers
682 */
683 unsigned int num_slaves;
684
685 /**
686 * Array of slave peers
687 */
688 struct BenchmarkPeer *sps;
689
690 /**
691 * Benchmark duration
692 */
693 struct GNUNET_TIME_Relative perf_duration;
694
695 /**
696 * Logging frequency
697 */
698 struct GNUNET_TIME_Relative log_frequency;
699
700 /**
701 * Benchmark state
702 */
703 struct BenchmarkState state;
704
705 struct GNUNET_CORE_MessageHandler *handlers;
706
707 GNUNET_TRANSPORT_ReceiveCallback transport_recv_cb;
708
709 GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb;
710 GNUNET_ATS_AddressInformationCallback ats_perf_cb;
711 void *done_cb_cls;
712};
713
714
715
716/*
717 * Experiment related functions
718 */
719
720
721/**
722 * Execute the specified experiment
723 *
724 * @param e the Experiment
725 * @param ep_done_cb a episode is completed
726 * @param e_done_cb the experiment is completed
727 */
728void
729GNUNET_ATS_TEST_experimentation_run (struct Experiment *e,
730 GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb,
731 GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb);
732
733/**
734 * Load an experiment from a file
735 *
736 * @param filename the file
737 * @return the Experiment or NULL on failure
738 */
739struct Experiment *
740GNUNET_ATS_TEST_experimentation_load (char *filename);
741
742
743/**
744 * Stop an experiment
745 *
746 * @param e the experiment
747 */
748void
749GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e);
750
751/*
752 * Traffic related functions
753 */
754
755void
756GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p);
757
758void
759GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p);
760
761
762/**
763 * Generate between the source master and the partner and send traffic with a
764 * maximum rate.
765 *
766 * @param src traffic source
767 * @param dest traffic partner
768 * @param type type of traffic to generate
769 * @param base_rate traffic base rate to send data with
770 * @param max_rate traffic maximum rate to send data with
771 * @param period duration of a period of traffic generation (~ 1/frequency)
772 * @param duration how long to generate traffic
773 * @return the traffic generator
774 */
775struct TrafficGenerator *
776GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src,
777 struct BenchmarkPartner *dest,
778 enum GeneratorType type,
779 long int base_rate,
780 long int max_rate,
781 struct GNUNET_TIME_Relative period,
782 struct GNUNET_TIME_Relative duration);
783
784void
785GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg);
786
787/**
788 * Stop all traffic generators
789 */
790void
791GNUNET_ATS_TEST_generate_traffic_stop_all ();
792
793struct PreferenceGenerator *
794GNUNET_ATS_TEST_generate_preferences_start (struct BenchmarkPeer *src,
795 struct BenchmarkPartner *dest,
796 enum GeneratorType type,
797 long int base_value,
798 long int value_rate,
799 struct GNUNET_TIME_Relative period,
800 struct GNUNET_TIME_Relative frequency,
801 enum GNUNET_ATS_PreferenceKind kind);
802
803void
804GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg);
805
806void
807GNUNET_ATS_TEST_generate_preferences_stop_all ();
808
809/*
810 * Logging related functions
811 */
812
813
814
815/*
816 * Topology related functions
817 */
818
819struct BenchmarkPeer *
820GNUNET_ATS_TEST_get_peer (int src);
821
822struct BenchmarkPartner *
823GNUNET_ATS_TEST_get_partner (int src, int dest);
824
825/**
826 * Create a topology for ats testing
827 *
828 * @param name test name
829 * @param cfg_file configuration file to use for the peers
830 * @param num_slaves number of slaves
831 * @param num_masters number of masters
832 * @param test_core connect to CORE service (GNUNET_YES) or transport (GNUNET_NO)
833 * @param done_cb function to call when topology is setup
834 * @param done_cb_cls cls for callback
835 * @param recv_cb callback to call when data are received
836 * @param perf_cb callback to call when performance info are received
837 */
838void
839GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file,
840 unsigned int num_slaves,
841 unsigned int num_masters,
842 int test_core,
843 GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb,
844 void *done_cb_cls,
845 GNUNET_TRANSPORT_ReceiveCallback recv_cb,
846 GNUNET_ATS_TEST_LogRequest ats_perf_cb);
847
848/**
849 * Shutdown topology
850 */
851void
852GNUNET_ATS_TEST_shutdown_topology (void);
853#endif
854#endif /* #ifndef GNUNET_ATS_SOLVER_EVAL_H */ 301#endif /* #ifndef GNUNET_ATS_SOLVER_EVAL_H */
855/* end of file ats-testing.h */ 302/* end of file ats-testing.h */