[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33230 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33230 - gnunet/src/ats |
Date: |
Fri, 9 May 2014 20:03:03 +0200 |
Author: wachs
Date: 2014-05-09 20:03:03 +0200 (Fri, 09 May 2014)
New Revision: 33230
Modified:
gnunet/src/ats/gnunet-service-ats_addresses.c
gnunet/src/ats/perf_ats_solver.c
Log:
clean up for addresses and modification to perf to get values in averaging
Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c 2014-05-09 16:26:55 UTC
(rev 33229)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c 2014-05-09 18:03:03 UTC
(rev 33230)
@@ -1355,313 +1355,7 @@
}
-static int
-eval_count_active_it (void *cls,
- const struct GNUNET_PeerIdentity *id,
- void *obj)
-{
- int *request_fulfilled = cls;
- struct ATS_Address *addr = obj;
-
- if (GNUNET_YES == addr->active)
- (*request_fulfilled) = GNUNET_YES;
-
- if (*request_fulfilled == GNUNET_YES)
- return GNUNET_NO;
- else
- return GNUNET_YES;
-}
-
-
/**
- * Summary context
- */
-struct SummaryContext
-{
- /**
- * Sum of the utilized inbound bandwidth per network
- */
- unsigned long long bandwidth_in_assigned[GNUNET_ATS_NetworkTypeCount];
-
- /**
- * Sum of the utilized outbound bandwidth per network
- */
- unsigned long long bandwidth_out_assigned[GNUNET_ATS_NetworkTypeCount];
-
- /**
- * Sum addresses within a network
- */
- unsigned int addresses_in_network[GNUNET_ATS_NetworkTypeCount];
-};
-
-
-static int
-eval_sum_bw_used (void *cls, const struct GNUNET_PeerIdentity *id, void *obj)
-{
- struct SummaryContext *ctx = cls;
- struct ATS_Address *addr = obj;
- int networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType;
- int net;
- int c;
-
- if (GNUNET_YES == addr->active)
- {
- net = get_performance_info (addr, GNUNET_ATS_NETWORK_TYPE);
- for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++)
- {
- if (net == networks[c])
- {
- ctx->addresses_in_network[c] ++;
- ctx->bandwidth_in_assigned[c] += ntohl (addr->assigned_bw_in.value__);
- ctx->bandwidth_out_assigned[c] += ntohl
(addr->assigned_bw_out.value__);
- }
- }
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Active address in %s with (in/out) %u/%u Bps\n",
- GNUNET_ATS_print_network_type (net),
- (unsigned int) ntohl (addr->assigned_bw_in.value__),
- (unsigned int) ntohl (addr->assigned_bw_out.value__));
- }
- return GNUNET_OK;
-}
-
-
-/**
- * Summary context
- */
-struct RelativityContext
-{
-
- struct GAS_Addresses_Handle *ah;
-};
-
-
-static int
-find_active_address (void *cls, const struct GNUNET_PeerIdentity *id, void
*obj)
-{
- struct ATS_Address **res = cls;
- struct ATS_Address *addr = obj;
-
- if (GNUNET_YES == addr->active)
- (*res) = addr;
-
- if (NULL != (*res))
- return GNUNET_NO;
- else
- return GNUNET_YES;
-}
-
-/**
- * Evaluate current bandwidth assignment
- *
- * @param ah address handle
- */
-void
-GAS_addresses_evaluate_assignment (struct GAS_Addresses_Handle *ah)
-{
-#if 0
- struct GAS_Addresses_Suggestion_Requests *cur;
- struct GAS_Addresses_Preference_Clients *pcur;
- int c;
-
- float quality_requests_fulfilled = 0.0;
- float quality_bandwidth_utilization[GNUNET_ATS_NetworkTypeCount];
- float quality_bandwidth_utilization_total = 0.0;
- float quality_application_requirements = 0.0;
- float guq = 0.0;
-
- int include_requests;
- int include_utilization;
- int include_requirements;
-
- /* Variable related to requests */
- unsigned int requests_pending;
- unsigned int requests_fulfilled;
- unsigned int request_active;
-
- /* Variable related to utilization */
- struct SummaryContext sum;
- struct ATS_Address *active_address;
- int network_count;
-
- /* Variables for preferences */
- int prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceType;
- double pref_val;
- double prop_val;
- const double *norm_values;
- double prefs_fulfill[GNUNET_ATS_PreferenceCount];
- int prefs_clients[GNUNET_ATS_PreferenceCount];
- int rels;
-
- GNUNET_assert (NULL != ah);
- GNUNET_assert (NULL != ah->addresses);
-
- requests_pending = 0;
- requests_fulfilled = 0;
- /* 1) How many requests could be fulfilled? */
- for (cur = ah->pending_requests_head; NULL != cur; cur = cur->next)
- {
- request_active = GNUNET_NO;
- GNUNET_CONTAINER_multipeermap_get_multiple (ah->addresses,
- &cur->id, &eval_count_active_it, &request_active);
- if (GNUNET_YES == request_active)
- requests_fulfilled ++;
- requests_pending ++;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s': %u pending requests,
%s\n",
- GNUNET_i2s (&cur->id),
- requests_pending,
- (GNUNET_YES == request_active) ? "active adress" : "no active
address");
-
- }
- if (requests_pending > 0)
- {
- quality_requests_fulfilled = (float) requests_fulfilled / requests_pending;
- include_requests = GNUNET_YES;
- }
- else
- {
- quality_requests_fulfilled = 0.0;
- include_requests = GNUNET_NO;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u pending requests, %u requests
fullfilled\n",
- requests_pending, requests_fulfilled);
-
- /* 2) How well is bandwidth utilized? */
- network_count = 0;
- for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++)
- {
- quality_bandwidth_utilization[c] = 0.0;
- sum.addresses_in_network[c] = 0;
- sum.bandwidth_in_assigned[c] = 0;
- sum.bandwidth_out_assigned[c] = 0;
- }
- GNUNET_CONTAINER_multipeermap_iterate(ah->addresses,
- &eval_sum_bw_used, &sum);
- for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++)
- {
- quality_bandwidth_utilization[c] = (((float)sum.bandwidth_out_assigned[c]
/ ah->env.out_quota[c]) +
- ((float)sum.bandwidth_in_assigned[c] / ah->env.in_quota[c])) / 2;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Utilization for network `%s': %f\n",
- GNUNET_ATS_print_network_type(ah->env.networks[c]),
- quality_bandwidth_utilization[c]);
- if (sum.addresses_in_network[c] > 0)
- {
- quality_bandwidth_utilization_total += quality_bandwidth_utilization[c];
- network_count ++;
- }
- }
- if (0 < network_count)
- {
- quality_bandwidth_utilization_total /= network_count;
- include_utilization = GNUNET_YES;
- }
- else
- {
- quality_bandwidth_utilization_total = 0.0;
- include_utilization = GNUNET_NO;
- }
-
- /* 3) How well does selection match application requirements */
- if (0 == ah->pref_clients)
- {
- include_requirements = 0;
- }
- else
- {
- for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
- {
- prefs_fulfill[c] = 0.0;
- prefs_clients[c] = 0;
- }
-
- for (cur = ah->pending_requests_head; NULL != cur; cur = cur->next)
- {
- active_address = NULL;
- GNUNET_CONTAINER_multipeermap_get_multiple (ah->addresses,
- &cur->id, &find_active_address, &active_address);
-
- for (pcur = ah->preference_clients_head; NULL != pcur; pcur = pcur->next)
- {
- for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
- {
- if (prefs[c] == GNUNET_ATS_PREFERENCE_END)
- continue;
- pref_val = GAS_normalization_get_preferences_by_client
(pcur->client, &cur->id, prefs[c]);
- if (-1.0 == pref_val)
- {
- GNUNET_break (0);
- continue;
- }
-
- if (DEFAULT_REL_PREFERENCE == pref_val)
- {
- /* Default preference value */
- continue;
- }
-
- if (NULL != active_address)
- {
- norm_values = GAS_normalization_get_properties (active_address);
- prop_val = norm_values[c];
- if ((norm_values[c] <= 1.0) || (norm_values[c] >= 2.0))
- prop_val = DEFAULT_REL_QUALITY;
- }
- else
- {
- prop_val = DEFAULT_REL_QUALITY;
- }
-
- /* We now have preference values [1..2] and properties [1..2] */
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u Client %p, Peer %s Property
%s: pref: %.3f prop %.3f \n",
- c,
- pcur->client,
- GNUNET_i2s (&cur->id),
- GNUNET_ATS_print_preference_type(prefs[c]),
- pref_val,
- prop_val);
-
- prefs_fulfill[c] += (pref_val * prop_val) / 2;
- prefs_clients[c] ++;
- }
- }
- }
- rels = 0;
- for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
- {
- if (0 < prefs_clients[c])
- {
- prefs_fulfill[c] /= prefs_clients[c];
- rels ++;
- quality_application_requirements += prefs_fulfill[c];
- }
- }
- if (rels > 0)
- quality_application_requirements /= rels;
- else
- quality_application_requirements = 0.0;
-
- include_requirements = 1;
- }
- /* GUQ */
-
- if (include_requests + include_utilization + include_requirements > 0)
- guq = (quality_requests_fulfilled + quality_bandwidth_utilization_total +
quality_application_requirements) /
- (include_requests + include_utilization + include_requirements);
- else
- guq = 0.0;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Requests fulfilled %.3f bandwidth utilized %.3f application preferences
met %.3f => %.3f\n",
- quality_requests_fulfilled,
- quality_bandwidth_utilization_total,
- quality_application_requirements,
- guq);
-#endif
-}
-
-/**
* Solver information callback
*
* @param cls the closure
@@ -1753,7 +1447,6 @@
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"Solver notifies `%s' with result `%s'\n",
"GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP",
(GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
- GAS_addresses_evaluate_assignment (cls);
return;
default:
break;
Modified: gnunet/src/ats/perf_ats_solver.c
===================================================================
--- gnunet/src/ats/perf_ats_solver.c 2014-05-09 16:26:55 UTC (rev 33229)
+++ gnunet/src/ats/perf_ats_solver.c 2014-05-09 18:03:03 UTC (rev 33230)
@@ -38,48 +38,7 @@
#define DEFAULT_ADDRESSES 10
#define DEFAULT_ATS_COUNT 2
-#define GNUPLOT_PROP_TEMPLATE "#!/usr/bin/gnuplot \n" \
-"set datafile separator ';' \n" \
-"set title \"Execution time Proportional solver \" \n" \
-"set xlabel \"Number of peers\" \n" \
-"set ylabel \"Execution time in us\" \n" \
-"set grid \n"
-#define GNUPLOT_PROP_UPDATE_TEMPLATE "#!/usr/bin/gnuplot \n" \
-"set datafile separator ';' \n" \
-"set title \"Execution time Proportional solver with updated problem\" \n" \
-"set xlabel \"Number of peers\" \n" \
-"set ylabel \"Execution time in us\" \n" \
-"set grid \n"
-
-#define GNUPLOT_MLP_TEMPLATE "#!/usr/bin/gnuplot \n" \
-"set datafile separator ';' \n" \
-"set title \"Execution time MLP solver \" \n" \
-"set xlabel \"Number of peers\" \n" \
-"set ylabel \"Execution time in us\" \n" \
-"set grid \n"
-
-#define GNUPLOT_MLP_UPDATE_TEMPLATE "#!/usr/bin/gnuplot \n" \
-"set datafile separator ';' \n" \
-"set title \"Execution time MLP solver with updated problem\" \n" \
-"set xlabel \"Number of peers\" \n" \
-"set ylabel \"Execution time in us\" \n" \
-"set grid \n"
-
-#define GNUPLOT_RIL_TEMPLATE "#!/usr/bin/gnuplot \n" \
-"set datafile separator ';' \n" \
-"set title \"Execution time RIL solver \" \n" \
-"set xlabel \"Number of peers\" \n" \
-"set ylabel \"Execution time in us\" \n" \
-"set grid \n"
-
-#define GNUPLOT_RIL_UPDATE_TEMPLATE "#!/usr/bin/gnuplot \n" \
-"set datafile separator ';' \n" \
-"set title \"Execution time RIL solver with updated problem\" \n" \
-"set xlabel \"Number of peers\" \n" \
-"set ylabel \"Execution time in us\" \n" \
-"set grid \n"
-
/**
* Handle for ATS address component
*/
@@ -173,7 +132,7 @@
/**
* Create gnuplot file
*/
- int create_plot;
+ int create_datafile;
/**
* Measure updates
@@ -211,6 +170,7 @@
*/
struct Iteration
{
+ struct Result **results_array;
/**
* Head of the linked list
*/
@@ -630,6 +590,7 @@
/* Create new result */
tmp = GNUNET_new (struct Result);
ph.current_result = tmp;
+
ph.iterations_results[ph.current_iteration-1].results_array[ph.current_p -1] =
tmp;
GNUNET_CONTAINER_DLL_insert_tail(ph.iterations_results[ph.current_iteration-1].result_head,
ph.iterations_results[ph.current_iteration-1].result_tail, tmp);
ph.current_result->addresses = ph.current_a;
@@ -810,122 +771,6 @@
}
}
-static void
-write_gnuplot_script (char * data_fn, int iteration, int full)
-{
- struct GNUNET_DISK_FileHandle *f;
- char * gfn;
- char *data;
- char *iter_text;
- char *template;
-
- /* Write header */
- switch (ph.ats_mode) {
- case MODE_PROPORTIONAL:
- if (GNUNET_YES == full)
- template = GNUPLOT_PROP_TEMPLATE;
- else
- template = GNUPLOT_PROP_UPDATE_TEMPLATE;
- break;
- case MODE_MLP:
- if (GNUNET_YES == full)
- template = GNUPLOT_MLP_TEMPLATE;
- else
- template = GNUPLOT_MLP_UPDATE_TEMPLATE;
- break;
- case MODE_RIL:
- if (GNUNET_YES == full)
- template = GNUPLOT_RIL_TEMPLATE;
- else
- template = GNUPLOT_RIL_UPDATE_TEMPLATE;
- break;
- default:
- GNUNET_break (0);
- return;
- }
- if (-1 == iteration)
- GNUNET_asprintf (&iter_text, "%s_%u", "avg",ph.total_iterations);
- else
- GNUNET_asprintf (&iter_text, "%u", iteration);
- if (GNUNET_YES == full)
- {
- GNUNET_asprintf (&gfn, "perf_%s_full_%s-%u_%u_%u.gnuplot",
- ph.ats_string,
- iter_text,
- ph.N_peers_start,
- ph.N_peers_end,
- ph.N_address);
- }
- else
- {
- GNUNET_asprintf (&gfn, "perf_%s_updat_%s-%u_%u_%u.gnuplot",
- ph.ats_string,
- iter_text,
- ph.N_peers_start,
- ph.N_peers_end,
- ph.N_address);
- }
- GNUNET_free (iter_text);
-
- f = GNUNET_DISK_file_open (gfn,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ |
GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n",
gfn);
- GNUNET_free (gfn);
- return;
- }
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, template, strlen(template)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file
`%s'\n", gfn);
-
- data = NULL;
- if (MODE_PROPORTIONAL == ph.ats_mode)
- {
- GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time
to solve'\n" \
- "pause -1",
- data_fn, 3);
- }
- else if (MODE_MLP == ph.ats_mode)
- {
- GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time
to solve',\\\n" \
- "'%s' using 1:%u with lines title 'Time to
setup',\\\n"
- "'%s' using 1:%u with lines title 'Time to solve
LP',\\\n"
- "'%s' using 1:%u with lines title 'Total time to
solve MLP'\n" \
- "pause -1",
- data_fn, 3,
- data_fn, 4,
- data_fn, 5,
- data_fn, 6);
- }
- else if (MODE_RIL == ph.ats_mode)
- {
- GNUNET_asprintf (&data,
- "plot '%s' using 1:%u with lines title 'Total time to
solve'\n" \
- "pause -1",
- data_fn, 3);
- }
-
- if ((NULL != data) &&
- (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen(data))))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n",
- gfn);
- GNUNET_free_non_null (data);
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_close(f))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot close gnuplot file `%s'\n",
- gfn);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data successfully written to plot file `%s'\n",
- gfn);
- GNUNET_free (gfn);
-
-}
-
/**
* Evaluate results for a specific iteration
*
@@ -953,7 +798,7 @@
data_fn_full = NULL;
- if (ph.create_plot)
+ if (ph.create_datafile)
{
if (-1 == iteration)
GNUNET_asprintf (&iter_text, "%s", "avg");
@@ -983,11 +828,10 @@
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Cannot write data to log file `%s'\n",
data_fn_full);
- write_gnuplot_script (data_fn_full, iteration, GNUNET_YES);
}
data_fn_update = NULL;
- if ((ph.create_plot) && (GNUNET_YES == ph.measure_updates))
+ if ((ph.create_datafile) && (GNUNET_YES == ph.measure_updates))
{
if (-1 == iteration)
GNUNET_asprintf (&iter_text, "%s", "avg");
@@ -1018,7 +862,6 @@
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Cannot write data to log file `%s'\n",
data_fn_update);
- write_gnuplot_script (data_fn_update, iteration, GNUNET_NO);
}
next = ph.iterations_results[ph.current_iteration -1].result_head;
@@ -1123,7 +966,7 @@
GNUNET_asprintf (&str_d_mlp, "-1");
data = NULL;
- if (GNUNET_YES == ph.create_plot)
+ if (GNUNET_YES == ph.create_datafile)
{
GNUNET_asprintf (&data,
@@ -1156,7 +999,7 @@
GNUNET_CONTAINER_DLL_remove
(ph.iterations_results[ph.current_iteration-1].result_head,
ph.iterations_results[ph.current_iteration-1].result_tail, cur);
- GNUNET_free (cur);
+ //GNUNET_free (cur);
}
if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full)))
@@ -1176,8 +1019,8 @@
static void
evaluate_average (void)
{
- int c_o;
- int c_i;
+ int c_iteration;
+ int c_peer;
struct GNUNET_DISK_FileHandle *f_full;
struct GNUNET_DISK_FileHandle *f_update;
@@ -1185,17 +1028,18 @@
char * data_fn_full;
char * data_fn_update;
char * data;
+/*
char * str_d_total;
char * str_d_setup;
char * str_d_lp;
char * str_d_mlp;
-
+*/
f_full = NULL;
f_update = NULL;
data_fn_full = NULL;
- if (ph.create_plot)
+ if (ph.create_datafile)
{
GNUNET_asprintf (&data_fn_full,
"perf_%s_full_avg_%u-%u_%u_%u.data",
@@ -1204,6 +1048,10 @@
ph.N_peers_start,
ph.N_peers_end,
ph.N_address);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Using data file `%s'\n",
+ data_fn_full);
+
f_full = GNUNET_DISK_file_open (data_fn_full,
GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ |
GNUNET_DISK_PERM_USER_WRITE);
@@ -1215,16 +1063,20 @@
GNUNET_free (data_fn_full);
return;
}
+
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Using update data file `%s'\n",
+ data_fn_full);
+
data = "#peers;addresses;time total in us;#time setup in us;#time lp in
us;#time mlp in us;\n";
if (GNUNET_SYSERR == GNUNET_DISK_file_write(f_full, data, strlen(data)))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Cannot write data to log file `%s'\n",
data_fn_full);
- write_gnuplot_script (data_fn_full, -1, GNUNET_YES);
}
data_fn_update = NULL;
- if ((ph.create_plot) && (GNUNET_YES == ph.measure_updates))
+ if ((ph.create_datafile) && (GNUNET_YES == ph.measure_updates))
{
GNUNET_asprintf (&data_fn_update, "perf_%s_update_avg_%u-%u_%u_%u.data",
ph.ats_string,
@@ -1245,14 +1097,59 @@
GNUNET_free (data_fn_full);
return;
}
+
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Using update data file `%s'\n",
+ data_fn_update);
+
data = "#peers;addresses;time total in us;#time setup in us;#time lp in
us;#time mlp in us;\n";
if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen(data)))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Cannot write data to log file `%s'\n",
data_fn_update);
- write_gnuplot_script (data_fn_update, -1, GNUNET_NO);
}
+ /* NEW log */
+ for (c_peer = ph.N_peers_start; c_peer <= ph.N_peers_end; c_peer ++)
+ {
+ char * data_str;
+ char * data_tmp;
+ GNUNET_asprintf(&data_str, "%u;%u",c_peer, ph.N_address);
+ for (c_iteration = 0; c_iteration < ph.total_iterations; c_iteration ++)
+ {
+ struct Result *cur_res;
+
+ cur_res = ph.iterations_results[c_iteration].results_array[c_peer -1];
+ fprintf (stderr, "P: %u I: %u: P %i A %i\n", c_peer, c_iteration,
cur_res->peers, cur_res->addresses);
+ fprintf (stderr, "D total: %llu\n", (long long unsigned int)
cur_res->d_total.rel_value_us);
+
+ data_tmp = GNUNET_strdup (data_str);
+ GNUNET_free (data_str);
+ GNUNET_asprintf (&data_str, "%s;%llu", data_tmp,
cur_res->d_total.rel_value_us);
+ GNUNET_free (data_tmp);
+ }
+ data_tmp = GNUNET_strdup (data_str);
+ GNUNET_free (data_str);
+ GNUNET_asprintf (&data_str, "%s\n", data_tmp);
+ GNUNET_free (data_tmp);
+
+ fprintf (stderr, "Result: %s\n", data_str);
+ GNUNET_DISK_file_write (f_full, data_str, strlen(data_str));
+ GNUNET_free (data_str);
+ }
+ /* NEW log */
+
+ if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full)))
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
+ data_fn_full);
+ GNUNET_free_non_null (data_fn_full);
+
+ if ((NULL != f_update) && (GNUNET_SYSERR == GNUNET_DISK_file_close
(f_update)))
+ GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
+ data_fn_update);
+ GNUNET_free_non_null (data_fn_update);
+
+#if 0
for (c_o = 0; c_o < 2; c_o++)
{
if (0 == c_o)
@@ -1350,7 +1247,7 @@
GNUNET_asprintf (&str_d_mlp, "-1");
data = NULL;
- if (GNUNET_YES == ph.create_plot)
+ if (GNUNET_YES == ph.create_datafile)
{
GNUNET_asprintf (&data,
"%u;%u;%s;%s;%s;%s\n",
@@ -1382,16 +1279,8 @@
GNUNET_free_non_null (str_d_mlp);
}
}
+#endif
- if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full)))
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
- data_fn_full);
- GNUNET_free_non_null (data_fn_full);
-
- if ((NULL != f_update) && (GNUNET_SYSERR == GNUNET_DISK_file_close
(f_update)))
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
- data_fn_update);
- GNUNET_free_non_null (data_fn_update);
}
/**
@@ -1410,6 +1299,7 @@
struct ATS_Address * cur_addr;
+ ph.iterations_results[ph.current_iteration-1].results_array = GNUNET_malloc
((count_p) * sizeof (struct Result *));
ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer));
for (cp = 0; cp < count_p; cp++)
perf_create_peer (cp);
@@ -1527,6 +1417,7 @@
unsigned long long quotas_in[GNUNET_ATS_NetworkTypeCount];
unsigned long long quotas_out[GNUNET_ATS_NetworkTypeCount];
int c;
+ int c2;
/* Extract test name */
if (NULL == (sep = (strstr (src_filename,".c"))))
@@ -1677,6 +1568,15 @@
GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Unloading solver `%s'\n"),
ph.ats_string);
GNUNET_PLUGIN_unload (plugin, ph.solver);
GNUNET_free (plugin);
+ for (c = 0; c < ph.total_iterations; c++ )
+ {
+ for (c2 = ph.N_peers_start; c2 < ph.N_peers_end; c2++ )
+ {
+ GNUNET_free (ph.iterations_results[c].results_array[c2]);
+ }
+ GNUNET_free(ph.iterations_results[c].results_array);
+
+ }
GNUNET_free (ph.iterations_results);
GNUNET_free (ph.averaged_full_result);
GNUNET_free (ph.averaged_update_result);
@@ -1700,7 +1600,7 @@
ph.N_peers_end = 0;
ph.N_address = 0;
ph.ats_string = NULL;
- ph.create_plot = GNUNET_NO;
+ ph.create_datafile = GNUNET_NO;
ph.measure_updates = GNUNET_NO;
ph.total_iterations = 1;
@@ -1720,9 +1620,9 @@
{ 'p', "percentage", NULL,
gettext_noop ("update a fix percentage of addresses"),
1, &GNUNET_GETOPT_set_uint, &ph.opt_update_percent },
- { 'g', "gnuplot", NULL,
- gettext_noop ("create GNUplot file"),
- 0, &GNUNET_GETOPT_set_one, &ph.create_plot},
+ { 'd', "data", NULL,
+ gettext_noop ("create data file"),
+ 0, &GNUNET_GETOPT_set_one, &ph.create_datafile},
{ 'u', "update", NULL,
gettext_noop ("measure updates"),
0, &GNUNET_GETOPT_set_one, &ph.measure_updates},
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33230 - gnunet/src/ats,
gnunet <=