/* This file is part of GNUnet. (C) 2009 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 by the Free Software Foundation; either version 3, or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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. */ /** * @file transport/perf_transport_ats.c * @brief testcase for ats functionality */ #include "platform.h" #include "gnunet_time_lib.h" #include "gauger.h" #include #define VERBOSE GNUNET_NO #define EXECS 5 static int ret = 0; static int executions = EXECS; static uint64_t exec_time[EXECS]; static uint64_t sim_no_opt_avg; static uint64_t sim_with_opt_avg; static uint64_t mlp_no_opt_avg; static uint64_t mlp_with_opt_avg; static glp_prob * prob; static struct GNUNET_TIME_Absolute start; static struct GNUNET_TIME_Absolute end; static void solve_mlp(int presolve) { int result, solution; glp_iocp opt_mlp; glp_init_iocp(&opt_mlp); opt_mlp.msg_lev = GLP_MSG_OFF; opt_mlp.presolve = GLP_OFF; result = glp_intopt (prob, &opt_mlp); solution = glp_mip_status (prob); GNUNET_assert ((solution == 5) && (result==0)); } static void solve_lp(int presolve) { int result; int solution; glp_smcp opt_lp; glp_init_smcp(&opt_lp); opt_lp.msg_lev = GLP_MSG_OFF; if (presolve==GNUNET_YES) opt_lp.presolve = GLP_ON; else opt_lp.presolve = GLP_OFF; result = glp_simplex(prob, &opt_lp); solution = glp_get_status (prob); GNUNET_assert ((solution == 5) && (result==0)); } #if 0 /* Modify quality constraint */ static void modify_qm(int start, int length, int values_to_change) { //int * ind = GNUNET_malloc (length * sizeof (int)); //double *val = GNUNET_malloc (length * sizeof (double)); int ind[1000]; double val[1000]; int res = 0; int c = start, c2=1; while (c<=(start+values_to_change)) { res = glp_get_mat_row(prob, c, ind, val); printf("%i %i \n", c, res); for (c2=0; c2 400 addresses GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Simplex, no optimization, average per address: %f\n", ((double) sim_no_opt_avg / EXECS) / 400); GAUGER ("TRANSPORT","GLPK simplex no optimization", ((double) sim_no_opt_avg / EXECS) / 400, "ms/address"); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Simplex, with optimization, average per address: %f\n", ((double) sim_with_opt_avg / EXECS) / 400); GAUGER ("TRANSPORT", "GLPK simplex, 100 peers 400 addresses with optimization", ((double) sim_with_opt_avg / EXECS) / 400, "ms/address"); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "MLP no optimization average per address: %f\n", ((double) mlp_no_opt_avg / EXECS) / 400); GAUGER ("TRANSPORT","GLPK MLP 100 peers 400 addresses no optimization", ((double) mlp_no_opt_avg / EXECS) / 400, "ms/address"); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "MLP optimization average per address: %f\n", ((double) mlp_with_opt_avg/ EXECS) / 400); GAUGER ("TRANSPORT", "GLPK MLP 100 peers 400 addresses with optimization", ((double) mlp_with_opt_avg / EXECS) / 400, "ms/address"); (void) CLOSE (nullfd); return ret; } /* end of perf_transport_ats.c*/