/*
This file is part of GNUnet.
(C) 2010,2011 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 ats/perf_ats_solver.c
* @brief generic performance test for ATS solvers
* @author Christian Grothoff
* @author Matthias Wachs
*/
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet-service-ats_addresses.h"
#include "gnunet-service-ats_normalization.h"
#include "gnunet_ats_service.h"
#include "gnunet_ats_plugin.h"
#include "test_ats_api_common.h"
#define DEFAULT_UPDATE_PERCENTAGE 20
#define DEFAULT_PEERS_START 10
#define DEFAULT_PEERS_END 10
#define DEFAULT_ADDRESSES 10
#define DEFAULT_ATS_COUNT 2
/**
* Handle for ATS address component
*/
struct PerfHandle
{
/**
* Performance peers
*/
struct PerfPeer *peers;
/**
* Solver handle
*/
void *solver;
/**
* Statistics stat;
*/
struct GNUNET_STATISTICS_Handle *stat;
/**
* A multihashmap to store all addresses
*/
struct GNUNET_CONTAINER_MultiPeerMap *addresses;
/**
* Solver functions
* */
struct GNUNET_ATS_PluginEnvironment env;
/**
* Array for results for each iteration with length iterations
*/
struct Iteration *iterations_results;
/**
* The current result
*/
struct Result *current_result;
/**
* Current number of peers benchmarked
*/
int current_p;
/**
* Current number of addresses benchmarked
*/
int current_a;
/**
* Solver description as string
*/
char *ats_string;
/**
* Configured ATS solver
*/
int ats_mode;
/**
* #peers to start benchmarking with
*/
int N_peers_start;
/**
* #peers to end benchmarking with
*/
int N_peers_end;
/**
* #addresses to benchmarking with
*/
int N_address;
/**
* Percentage of peers to update
*/
int opt_update_percent;
/**
* Create gnuplot file
*/
int create_datafile;
/**
* Measure updates
*/
int measure_updates;
/**
* Number of iterations
*/
int total_iterations;
/**
* Current iteration
*/
int current_iteration;
/**
* Is a bulk operation running?
*/
int bulk_running;
/**
* Is a bulk operation running?
*/
int expecting_solution;