X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fats-tests%2Fperf_ats.c;h=e0affb4f91a059c589c0bf7213a815e3645f1359;hb=4dcb414e2faabc800577c25dec3b63e3ceaaa84b;hp=f57ac19f0b1d0fcf262389a4bfc60e497599cd13;hpb=f1f603c7d0b3f03dca46a4f313472288eb080eb1;p=oweals%2Fgnunet.git diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c index f57ac19f0..e0affb4f9 100644 --- a/src/ats-tests/perf_ats.c +++ b/src/ats-tests/perf_ats.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2010-2013 Christian Grothoff (and other contributing authors) + Copyright (C) 2010-2013 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /** * @file ats/perf_ats.c @@ -320,11 +320,10 @@ static void log_request_cb (void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Information *ats, uint32_t ats_count) + const struct GNUNET_ATS_Properties *ats) { struct BenchmarkPeer *me = cls; struct BenchmarkPartner *p; - int c_a; char *peer_id; p = find_partner (me, &address->peer); @@ -342,15 +341,11 @@ log_request_cb (void *cls, const struct GNUNET_HELLO_Address *address, p->bandwidth_in = ntohl (bandwidth_in.value__); p->bandwidth_out = ntohl (bandwidth_out.value__); - for (c_a = 0; c_a < ats_count; c_a++) - { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s [%u] received ATS information: %s %s %u\n", - (GNUNET_YES == p->me->master) ? "Master" : "Slave", - p->me->no, - GNUNET_i2s (&p->dest->id), - GNUNET_ATS_print_property_type(ntohl(ats[c_a].type)), - ntohl(ats[c_a].value)); - } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s [%u] received ATS information for peers `%s'\n", + (GNUNET_YES == p->me->master) ? "Master" : "Slave", + p->me->no, + GNUNET_i2s (&p->dest->id)); + GNUNET_free(peer_id); if (NULL != l) GNUNET_ATS_TEST_logging_now (l); @@ -369,22 +364,32 @@ main (int argc, char *argv[]) char *conf_name; char *comm_name; char *dotexe; - char *prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceTypeString; + char *prefs[] = GNUNET_ATS_PreferenceTypeString; int c; result = 0; - /* figure out testname */ + /* Determine testname + * perf_ats___[.exe]*/ + + /* Find test prefix, store in temp */ tmp = strstr (argv[0], TESTNAME_PREFIX); if (NULL == tmp) { fprintf (stderr, "Unable to parse test name `%s'\n", argv[0]); return GNUNET_SYSERR; } + + /* Set tmp to end of test name prefix */ tmp += strlen (TESTNAME_PREFIX); + + /* Determine solver name */ solver = GNUNET_strdup (tmp); + /* Remove .exe prefix */ if (NULL != (dotexe = strstr (solver, ".exe")) && dotexe[4] == '\0') dotexe[0] = '\0'; + + /* Determine first '_' after solver */ tmp_sep = strchr (solver, '_'); if (NULL == tmp_sep) { @@ -427,7 +432,7 @@ main (int argc, char *argv[]) if (0 != strcmp (pref_str, "NONE")) { - for (c = 1; c < GNUNET_ATS_PreferenceCount; c++) + for (c = 0; c < GNUNET_ATS_PREFERENCE_END; c++) { if (0 == strcmp (pref_str, prefs[c])) {