diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-04-16 15:37:46 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-04-16 15:37:46 +0000 |
commit | d043dd0e4ca407081eaa1b9072b37b1d9e715813 (patch) | |
tree | e07cb8c113d8406745821c495c7fb3c53e74b050 /src/ats | |
parent | 58082a82b9b089de618dfe693e9342e078437451 (diff) | |
download | gnunet-d043dd0e4ca407081eaa1b9072b37b1d9e715813.tar.gz gnunet-d043dd0e4ca407081eaa1b9072b37b1d9e715813.zip |
- changes
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/ats_api_scheduling.c | 6 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 4 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses_mlp.c | 18 | ||||
-rw-r--r-- | src/ats/perf_ats_mlp.c | 63 | ||||
-rw-r--r-- | src/ats/test_ats_api.conf | 4 |
5 files changed, 42 insertions, 53 deletions
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index 123398992..ec14e0e13 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c | |||
@@ -418,9 +418,13 @@ static void | |||
418 | remove_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id, | 418 | remove_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id, |
419 | const struct GNUNET_PeerIdentity *peer) | 419 | const struct GNUNET_PeerIdentity *peer) |
420 | { | 420 | { |
421 | GNUNET_assert (peer != NULL); | ||
422 | GNUNET_assert (sh != NULL); | ||
423 | |||
421 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "ats-scheduling-api", | 424 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "ats-scheduling-api", |
422 | "Remove sessionID %u from peer %s in %p\n", "ats-scheduling-api", | 425 | "Release sessionID %u from peer %s in %p\n", |
423 | (unsigned int) session_id, GNUNET_i2s (peer), sh); | 426 | (unsigned int) session_id, GNUNET_i2s (peer), sh); |
427 | |||
424 | if (0 == session_id) | 428 | if (0 == session_id) |
425 | return; | 429 | return; |
426 | GNUNET_assert (session_id < sh->session_array_size); | 430 | GNUNET_assert (session_id < sh->session_array_size); |
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index fec55b69d..6ed625bf4 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -615,7 +615,7 @@ void request_address_mlp (const struct GNUNET_PeerIdentity *peer) | |||
615 | 615 | ||
616 | if (aa == NULL) | 616 | if (aa == NULL) |
617 | { | 617 | { |
618 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 618 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
619 | "Cannot suggest address for peer `%s'\n", GNUNET_i2s (peer)); | 619 | "Cannot suggest address for peer `%s'\n", GNUNET_i2s (peer)); |
620 | return; | 620 | return; |
621 | } | 621 | } |
@@ -648,7 +648,7 @@ void request_address_simple (const struct GNUNET_PeerIdentity *peer) | |||
648 | &find_address_it, &aa); | 648 | &find_address_it, &aa); |
649 | if (aa == NULL) | 649 | if (aa == NULL) |
650 | { | 650 | { |
651 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 651 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
652 | "Cannot suggest address for peer `%s'\n", GNUNET_i2s (peer)); | 652 | "Cannot suggest address for peer `%s'\n", GNUNET_i2s (peer)); |
653 | return; | 653 | return; |
654 | } | 654 | } |
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c index 175d4f41a..57692440b 100644 --- a/src/ats/gnunet-service-ats_addresses_mlp.c +++ b/src/ats/gnunet-service-ats_addresses_mlp.c | |||
@@ -869,8 +869,8 @@ lp_solv: | |||
869 | mlp->lp_total_duration =+ duration.rel_value; | 869 | mlp->lp_total_duration =+ duration.rel_value; |
870 | 870 | ||
871 | GNUNET_STATISTICS_update (mlp->stats,"# LP problem solved", 1, GNUNET_NO); | 871 | GNUNET_STATISTICS_update (mlp->stats,"# LP problem solved", 1, GNUNET_NO); |
872 | GNUNET_STATISTICS_set (mlp->stats,"# LP execution time", duration.rel_value, GNUNET_NO); | 872 | GNUNET_STATISTICS_set (mlp->stats,"# LP execution time (ms)", duration.rel_value, GNUNET_NO); |
873 | GNUNET_STATISTICS_set (mlp->stats,"# LP execution time average", | 873 | GNUNET_STATISTICS_set (mlp->stats,"# LP execution time average (ms)", |
874 | mlp->lp_total_duration / mlp->lp_solved, GNUNET_NO); | 874 | mlp->lp_total_duration / mlp->lp_solved, GNUNET_NO); |
875 | 875 | ||
876 | 876 | ||
@@ -945,8 +945,8 @@ mlp_solve_mlp_problem (struct GAS_MLP_Handle *mlp) | |||
945 | mlp->mlp_total_duration =+ duration.rel_value; | 945 | mlp->mlp_total_duration =+ duration.rel_value; |
946 | 946 | ||
947 | GNUNET_STATISTICS_update (mlp->stats,"# MLP problem solved", 1, GNUNET_NO); | 947 | GNUNET_STATISTICS_update (mlp->stats,"# MLP problem solved", 1, GNUNET_NO); |
948 | GNUNET_STATISTICS_set (mlp->stats,"# MLP execution time", duration.rel_value, GNUNET_NO); | 948 | GNUNET_STATISTICS_set (mlp->stats,"# MLP execution time (ms)", duration.rel_value, GNUNET_NO); |
949 | GNUNET_STATISTICS_set (mlp->stats,"# MLP execution time average", | 949 | GNUNET_STATISTICS_set (mlp->stats,"# MLP execution time average (ms)", |
950 | mlp->mlp_total_duration / mlp->mlp_solved, GNUNET_NO); | 950 | mlp->mlp_total_duration / mlp->mlp_solved, GNUNET_NO); |
951 | 951 | ||
952 | /* Analyze problem status */ | 952 | /* Analyze problem status */ |
@@ -1244,7 +1244,7 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1244 | } | 1244 | } |
1245 | else if (GNUNET_ATS_NET_UNSPECIFIED == quotas[c]) | 1245 | else if (GNUNET_ATS_NET_UNSPECIFIED == quotas[c]) |
1246 | { | 1246 | { |
1247 | quota_out = 0; | 1247 | quota_out = mlp->BIG_M; |
1248 | } | 1248 | } |
1249 | else | 1249 | else |
1250 | { | 1250 | { |
@@ -1262,7 +1262,7 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1262 | } | 1262 | } |
1263 | else if (GNUNET_ATS_NET_UNSPECIFIED == quotas[c]) | 1263 | else if (GNUNET_ATS_NET_UNSPECIFIED == quotas[c]) |
1264 | { | 1264 | { |
1265 | quota_in = 0; | 1265 | quota_in = mlp->BIG_M; |
1266 | } | 1266 | } |
1267 | else | 1267 | else |
1268 | { | 1268 | { |
@@ -1510,7 +1510,7 @@ GAS_mlp_address_update (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_Mult | |||
1510 | int new; | 1510 | int new; |
1511 | struct MLP_information *mlpi; | 1511 | struct MLP_information *mlpi; |
1512 | 1512 | ||
1513 | GNUNET_STATISTICS_update (mlp->stats,"# LP address updates", 1, GNUNET_NO); | 1513 | GNUNET_STATISTICS_update (mlp->stats, "# MLP address updates", 1, GNUNET_NO); |
1514 | 1514 | ||
1515 | /* We add a new address */ | 1515 | /* We add a new address */ |
1516 | if (address->mlp_information == NULL) | 1516 | if (address->mlp_information == NULL) |
@@ -1536,6 +1536,7 @@ GAS_mlp_address_update (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_Mult | |||
1536 | 1536 | ||
1537 | address->mlp_information = mlpi; | 1537 | address->mlp_information = mlpi; |
1538 | mlp->addr_in_problem ++; | 1538 | mlp->addr_in_problem ++; |
1539 | GNUNET_STATISTICS_update (mlp->stats, "# addresses in MLP", 1, GNUNET_NO); | ||
1539 | 1540 | ||
1540 | /* Check for and add peer */ | 1541 | /* Check for and add peer */ |
1541 | struct ATS_Peer *peer = mlp_find_peer (mlp, &address->peer); | 1542 | struct ATS_Peer *peer = mlp_find_peer (mlp, &address->peer); |
@@ -1562,6 +1563,7 @@ GAS_mlp_address_update (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_Mult | |||
1562 | GNUNET_CONTAINER_DLL_insert (peer->head, peer->tail, address); | 1563 | GNUNET_CONTAINER_DLL_insert (peer->head, peer->tail, address); |
1563 | GNUNET_CONTAINER_DLL_insert (mlp->peer_head, mlp->peer_tail, peer); | 1564 | GNUNET_CONTAINER_DLL_insert (mlp->peer_head, mlp->peer_tail, peer); |
1564 | mlp->c_p ++; | 1565 | mlp->c_p ++; |
1566 | GNUNET_STATISTICS_update (mlp->stats, "# peers in MLP", 1, GNUNET_NO); | ||
1565 | } | 1567 | } |
1566 | else | 1568 | else |
1567 | { | 1569 | { |
@@ -1617,6 +1619,7 @@ GAS_mlp_address_delete (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_Mult | |||
1617 | address->mlp_information = NULL; | 1619 | address->mlp_information = NULL; |
1618 | 1620 | ||
1619 | mlp->addr_in_problem --; | 1621 | mlp->addr_in_problem --; |
1622 | GNUNET_STATISTICS_update (mlp->stats, "# addresses in MLP", -1, GNUNET_NO); | ||
1620 | } | 1623 | } |
1621 | 1624 | ||
1622 | /* Remove from peer list */ | 1625 | /* Remove from peer list */ |
@@ -1635,6 +1638,7 @@ GAS_mlp_address_delete (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_Mult | |||
1635 | GNUNET_CONTAINER_DLL_remove (mlp->peer_head, mlp->peer_tail, head); | 1638 | GNUNET_CONTAINER_DLL_remove (mlp->peer_head, mlp->peer_tail, head); |
1636 | GNUNET_free (head); | 1639 | GNUNET_free (head); |
1637 | mlp->c_p --; | 1640 | mlp->c_p --; |
1641 | GNUNET_STATISTICS_update (mlp->stats, "# peers in MLP", -1, GNUNET_NO); | ||
1638 | } | 1642 | } |
1639 | 1643 | ||
1640 | /* Update problem */ | 1644 | /* Update problem */ |
diff --git a/src/ats/perf_ats_mlp.c b/src/ats/perf_ats_mlp.c index a15e4b4b8..2daac4769 100644 --- a/src/ats/perf_ats_mlp.c +++ b/src/ats/perf_ats_mlp.c | |||
@@ -35,12 +35,17 @@ | |||
35 | #define MLP_MAX_EXEC_DURATION GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3) | 35 | #define MLP_MAX_EXEC_DURATION GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3) |
36 | #define MLP_MAX_ITERATIONS INT_MAX | 36 | #define MLP_MAX_ITERATIONS INT_MAX |
37 | 37 | ||
38 | #define DEF_PEERS 10 | ||
39 | #define DEF_ADDRESSES_PER_PEER 5 | ||
40 | |||
41 | static unsigned int peers; | ||
42 | static unsigned int addresses; | ||
38 | 43 | ||
39 | static int ret; | 44 | static int ret; |
40 | 45 | ||
41 | struct GNUNET_STATISTICS_Handle * stats; | 46 | struct GNUNET_STATISTICS_Handle * stats; |
42 | 47 | ||
43 | struct GNUNET_CONTAINER_MultiHashMap * addresses; | 48 | //struct GNUNET_CONTAINER_MultiHashMap * addresses; |
44 | 49 | ||
45 | struct GAS_MLP_Handle *mlp; | 50 | struct GAS_MLP_Handle *mlp; |
46 | 51 | ||
@@ -53,56 +58,26 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
53 | ret = 1; | 58 | ret = 1; |
54 | return; | 59 | return; |
55 | #endif | 60 | #endif |
56 | struct ATS_Address addr[10]; | ||
57 | |||
58 | stats = GNUNET_STATISTICS_create("ats", cfg); | ||
59 | 61 | ||
60 | addresses = GNUNET_CONTAINER_multihashmap_create (10); | 62 | if (peers == 0) |
63 | peers = DEF_PEERS; | ||
64 | if (addresses == 0) | ||
65 | addresses = DEF_ADDRESSES_PER_PEER; | ||
61 | 66 | ||
62 | GNUNET_CRYPTO_hash_create_random(GNUNET_CRYPTO_QUALITY_WEAK, &addr[0].peer.hashPubKey); | 67 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Setting up %u peers with %u addresses per peer\n", peers, addresses); |
63 | addr[0].mlp_information = NULL; | ||
64 | addr[0].next = NULL; | ||
65 | addr[0].prev = NULL; | ||
66 | addr[0].plugin = strdup ("dummy"); | ||
67 | 68 | ||
68 | addr[1].peer = addr[0].peer; | 69 | GNUNET_HashCode hash; |
69 | addr[1].mlp_information = NULL; | 70 | //memset (&hash, '\0', sizeof (GNUNET_HashCode)); |
70 | addr[1].next = NULL; | 71 | //hash.bits[0] = 1; |
71 | addr[1].prev = NULL; | 72 | //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "peer %s\n", GNUNET_h2s_full (&hash)); |
72 | addr[1].plugin = strdup ("dummy2"); | ||
73 | |||
74 | GNUNET_CONTAINER_multihashmap_put(addresses, &addr[0].peer.hashPubKey, &addr[0], GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
75 | 73 | ||
76 | mlp = GAS_mlp_init (cfg, NULL, MLP_MAX_EXEC_DURATION, MLP_MAX_ITERATIONS); | 74 | mlp = GAS_mlp_init (cfg, NULL, MLP_MAX_EXEC_DURATION, MLP_MAX_ITERATIONS); |
75 | mlp->auto_solve = GNUNET_NO; | ||
77 | 76 | ||
78 | /* Add a new address */ | ||
79 | #if 0 | ||
80 | GAS_mlp_address_update (mlp, addresses, &addr[0]); | ||
81 | |||
82 | GNUNET_assert (mlp != NULL); | ||
83 | GNUNET_assert (mlp->addr_in_problem == 1); | ||
84 | 77 | ||
85 | /* Update an new address */ | ||
86 | GAS_mlp_address_update (mlp, addresses, &addr[0]); | ||
87 | GNUNET_assert (mlp->addr_in_problem == 1); | ||
88 | 78 | ||
89 | /* Add a second address for same peer */ | ||
90 | GNUNET_CONTAINER_multihashmap_put(addresses, &addr[0].peer.hashPubKey, &addr[1], GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
91 | GAS_mlp_address_update (mlp, addresses, &addr[1]); | ||
92 | GNUNET_assert (mlp->addr_in_problem == 2); | ||
93 | |||
94 | /* Delete an address */ | ||
95 | GNUNET_CONTAINER_multihashmap_remove (addresses, &addr[0].peer.hashPubKey, &addr[0]); | ||
96 | GAS_mlp_address_delete (mlp, addresses, &addr[0]); | ||
97 | GAS_mlp_address_delete (mlp, addresses, &addr[1]); | ||
98 | #endif | ||
99 | GAS_mlp_done (mlp); | 79 | GAS_mlp_done (mlp); |
100 | 80 | ||
101 | GNUNET_free (addr[0].plugin); | ||
102 | GNUNET_free (addr[1].plugin); | ||
103 | GNUNET_CONTAINER_multihashmap_destroy (addresses); | ||
104 | GNUNET_STATISTICS_destroy(stats, GNUNET_NO); | ||
105 | |||
106 | ret = 0; | 81 | ret = 0; |
107 | return; | 82 | return; |
108 | } | 83 | } |
@@ -124,6 +99,12 @@ main (int argc, char *argv[]) | |||
124 | }; | 99 | }; |
125 | 100 | ||
126 | static struct GNUNET_GETOPT_CommandLineOption options[] = { | 101 | static struct GNUNET_GETOPT_CommandLineOption options[] = { |
102 | {'a', "addresses", NULL, | ||
103 | gettext_noop ("addresses per peer"), 1, | ||
104 | &GNUNET_GETOPT_set_uint, &addresses}, | ||
105 | {'p', "peers", NULL, | ||
106 | gettext_noop ("peers"), 1, | ||
107 | &GNUNET_GETOPT_set_uint, &peers}, | ||
127 | GNUNET_GETOPT_OPTION_END | 108 | GNUNET_GETOPT_OPTION_END |
128 | }; | 109 | }; |
129 | 110 | ||
diff --git a/src/ats/test_ats_api.conf b/src/ats/test_ats_api.conf index 85aabf37e..efd7fc9c6 100644 --- a/src/ats/test_ats_api.conf +++ b/src/ats/test_ats_api.conf | |||
@@ -8,7 +8,7 @@ UNIXPATH = /tmp/test-ats-scheduling-arm.sock | |||
8 | 8 | ||
9 | [ats] | 9 | [ats] |
10 | #DEBUG = YES | 10 | #DEBUG = YES |
11 | PREFIX = valgrind --leak-check=full | 11 | #PREFIX = valgrind --leak-check=full |
12 | AUTOSTART = YES | 12 | AUTOSTART = YES |
13 | PORT = 12002 | 13 | PORT = 12002 |
14 | HOSTNAME = localhost | 14 | HOSTNAME = localhost |
@@ -22,7 +22,7 @@ UNIX_MATCH_UID = YES | |||
22 | UNIX_MATCH_GID = YES | 22 | UNIX_MATCH_GID = YES |
23 | 23 | ||
24 | # Enable MLP mode (default: NO) | 24 | # Enable MLP mode (default: NO) |
25 | MLP = YES | 25 | MLP = NO |
26 | # Network specific inbound/outbound quotas | 26 | # Network specific inbound/outbound quotas |
27 | # LOOPBACK | 27 | # LOOPBACK |
28 | LOOPBACK_QUOTA_IN = unlimited | 28 | LOOPBACK_QUOTA_IN = unlimited |