aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_ats.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-07-18 15:45:50 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-07-18 15:45:50 +0000
commit03f5899ccc1a4d6fdf2d1eae4be2a7cdd90c3021 (patch)
tree759fa9d5b3b4bcd236cfc1bdd7281fced308f091 /src/transport/gnunet-service-transport_ats.c
parent555ebf304585fb4ae296cdd9388961d9b303f7e2 (diff)
downloadgnunet-03f5899ccc1a4d6fdf2d1eae4be2a7cdd90c3021.tar.gz
gnunet-03f5899ccc1a4d6fdf2d1eae4be2a7cdd90c3021.zip
Diffstat (limited to 'src/transport/gnunet-service-transport_ats.c')
-rw-r--r--src/transport/gnunet-service-transport_ats.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c
index acbc3878c..d8acb534b 100644
--- a/src/transport/gnunet-service-transport_ats.c
+++ b/src/transport/gnunet-service-transport_ats.c
@@ -457,9 +457,12 @@ static void _dummy ()
457 _dummy2(); 457 _dummy2();
458} 458}
459 459
460
461
460static void _dummy2 () 462static void _dummy2 ()
461{ 463{
462 ats_modify_problem_state (NULL, 0); 464 ats_modify_problem_state (NULL, 0);
465 qm[1].atis_index = 0;
463 _dummy(); 466 _dummy();
464 int t = ATS_COST_UPDATED + ATS_MODIFIED + ATS_NEW; 467 int t = ATS_COST_UPDATED + ATS_MODIFIED + ATS_NEW;
465 t = 0; 468 t = 0;
@@ -1303,8 +1306,7 @@ void ats_update_problem_qm (struct ATS_Handle * ats)
1303 1306
1304 1307
1305void 1308void
1306ats_calculate_bandwidth_distribution (struct ATS_Handle * ats, 1309ats_calculate_bandwidth_distribution (struct ATS_Handle * ats)
1307 struct GNUNET_STATISTICS_Handle *stats)
1308{ 1310{
1309 struct GNUNET_TIME_Absolute start; 1311 struct GNUNET_TIME_Absolute start;
1310 struct GNUNET_TIME_Relative creation; 1312 struct GNUNET_TIME_Relative creation;
@@ -1401,50 +1403,50 @@ ats_calculate_bandwidth_distribution (struct ATS_Handle * ats,
1401 (ats->internal.simplex_rerun_required == GNUNET_NO) ? "NO" : "YES", 1403 (ats->internal.simplex_rerun_required == GNUNET_NO) ? "NO" : "YES",
1402 (ats->internal.solution == 5) ? "OPTIMAL" : "INVALID"); 1404 (ats->internal.solution == 5) ? "OPTIMAL" : "INVALID");
1403 ats->successful_executions ++; 1405 ats->successful_executions ++;
1404 GNUNET_STATISTICS_set (stats, "# ATS successful executions", 1406 GNUNET_STATISTICS_set (ats->stats, "# ATS successful executions",
1405 ats->successful_executions, 1407 ats->successful_executions,
1406 GNUNET_NO); 1408 GNUNET_NO);
1407 1409
1408 if ((ats->internal.recreate_problem == GNUNET_YES) || (ats->prob==NULL)) 1410 if ((ats->internal.recreate_problem == GNUNET_YES) || (ats->prob==NULL))
1409 GNUNET_STATISTICS_set (stats, "ATS state",ATS_NEW, GNUNET_NO); 1411 GNUNET_STATISTICS_set (ats->stats, "ATS state",ATS_NEW, GNUNET_NO);
1410 else if ((ats->internal.modified_resources == GNUNET_YES) && 1412 else if ((ats->internal.modified_resources == GNUNET_YES) &&
1411 (ats->internal.modified_quality == GNUNET_NO)) 1413 (ats->internal.modified_quality == GNUNET_NO))
1412 GNUNET_STATISTICS_set (stats, "ATS state", ATS_COST_UPDATED, GNUNET_NO); 1414 GNUNET_STATISTICS_set (ats->stats, "ATS state", ATS_COST_UPDATED, GNUNET_NO);
1413 else if ((ats->internal.modified_resources == GNUNET_NO) && 1415 else if ((ats->internal.modified_resources == GNUNET_NO) &&
1414 (ats->internal.modified_quality == GNUNET_YES) && 1416 (ats->internal.modified_quality == GNUNET_YES) &&
1415 (ats->internal.simplex_rerun_required == GNUNET_NO)) 1417 (ats->internal.simplex_rerun_required == GNUNET_NO))
1416 GNUNET_STATISTICS_set (stats, "ATS state", ATS_QUALITY_UPDATED, GNUNET_NO); 1418 GNUNET_STATISTICS_set (ats->stats, "ATS state", ATS_QUALITY_UPDATED, GNUNET_NO);
1417 else if ((ats->internal.modified_resources == GNUNET_YES) && 1419 else if ((ats->internal.modified_resources == GNUNET_YES) &&
1418 (ats->internal.modified_quality == GNUNET_YES) && 1420 (ats->internal.modified_quality == GNUNET_YES) &&
1419 (ats->internal.simplex_rerun_required == GNUNET_NO)) 1421 (ats->internal.simplex_rerun_required == GNUNET_NO))
1420 GNUNET_STATISTICS_set (stats, "ATS state", ATS_QUALITY_COST_UPDATED, GNUNET_NO); 1422 GNUNET_STATISTICS_set (ats->stats, "ATS state", ATS_QUALITY_COST_UPDATED, GNUNET_NO);
1421 else if (ats->internal.simplex_rerun_required == GNUNET_NO) 1423 else if (ats->internal.simplex_rerun_required == GNUNET_NO)
1422 GNUNET_STATISTICS_set (stats, "ATS state", ATS_UNMODIFIED, GNUNET_NO); 1424 GNUNET_STATISTICS_set (ats->stats, "ATS state", ATS_UNMODIFIED, GNUNET_NO);
1423 } 1425 }
1424 else 1426 else
1425 { 1427 {
1426 if (ats->internal.c_peers != 0) 1428 if (ats->internal.c_peers != 0)
1427 { 1429 {
1428 ats->invalid_executions ++; 1430 ats->invalid_executions ++;
1429 GNUNET_STATISTICS_set (stats, "# ATS invalid executions", 1431 GNUNET_STATISTICS_set (ats->stats, "# ATS invalid executions",
1430 ats->invalid_executions, GNUNET_NO); 1432 ats->invalid_executions, GNUNET_NO);
1431 } 1433 }
1432 else 1434 else
1433 { 1435 {
1434 GNUNET_STATISTICS_set (stats, "# ATS successful executions", 1436 GNUNET_STATISTICS_set (ats->stats, "# ATS successful executions",
1435 ats->successful_executions, GNUNET_NO); 1437 ats->successful_executions, GNUNET_NO);
1436 } 1438 }
1437 } 1439 }
1438 1440
1439 GNUNET_STATISTICS_set (stats, 1441 GNUNET_STATISTICS_set (ats->stats,
1440 "ATS duration", solving.rel_value + creation.rel_value, GNUNET_NO); 1442 "ATS duration", solving.rel_value + creation.rel_value, GNUNET_NO);
1441 GNUNET_STATISTICS_set (stats, 1443 GNUNET_STATISTICS_set (ats->stats,
1442 "ATS mechanisms", ats->internal.c_mechs, GNUNET_NO); 1444 "ATS mechanisms", ats->internal.c_mechs, GNUNET_NO);
1443 GNUNET_STATISTICS_set (stats, 1445 GNUNET_STATISTICS_set (ats->stats,
1444 "ATS peers", ats->internal.c_peers, GNUNET_NO); 1446 "ATS peers", ats->internal.c_peers, GNUNET_NO);
1445 GNUNET_STATISTICS_set (stats, 1447 GNUNET_STATISTICS_set (ats->stats,
1446 "ATS solution", ats->internal.solution, GNUNET_NO); 1448 "ATS solution", ats->internal.solution, GNUNET_NO);
1447 GNUNET_STATISTICS_set (stats, 1449 GNUNET_STATISTICS_set (ats->stats,
1448 "ATS timestamp", start.abs_value, GNUNET_NO); 1450 "ATS timestamp", start.abs_value, GNUNET_NO);
1449 1451
1450 if ((ats->save_mlp == GNUNET_YES) && 1452 if ((ats->save_mlp == GNUNET_YES) &&
@@ -1666,6 +1668,7 @@ void ats_update_problem_cr (struct ATS_Handle * ats)
1666} 1668}
1667 1669
1668void ats_set_logging_options (struct ATS_Handle * ats, 1670void ats_set_logging_options (struct ATS_Handle * ats,
1671 struct GNUNET_STATISTICS_Handle * stats,
1669 int minimum_addresses, 1672 int minimum_addresses,
1670 int minimum_peers, 1673 int minimum_peers,
1671 int overwrite_dump, 1674 int overwrite_dump,
@@ -1674,7 +1677,7 @@ void ats_set_logging_options (struct ATS_Handle * ats,
1674{ 1677{
1675 if (ats == NULL) 1678 if (ats == NULL)
1676 return; 1679 return;
1677 1680 ats->stats = stats;
1678 ats->dump_min_addr = minimum_addresses; 1681 ats->dump_min_addr = minimum_addresses;
1679 ats->dump_min_peers = minimum_peers; 1682 ats->dump_min_peers = minimum_peers;
1680 ats->dump_overwrite = overwrite_dump; 1683 ats->dump_overwrite = overwrite_dump;