ats service address: management of ATS properties and preferences normalization More...
#include "platform.h"
#include <float.h>
#include "gnunet_ats_service.h"
#include "gnunet-service-ats_addresses.h"
#include "gnunet-service-ats_normalization.h"
#include "gnunet-service-ats_plugins.h"
Go to the source code of this file.
Data Structures | |
struct | PropertyRange |
Range information for normalization of quality properties. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "ats-normalization", __VA_ARGS__) |
Functions | |
static void | update_avg (uint64_t current_val, struct GAS_NormalizationInfo *ni) |
Add the value from atsi to the running average of the given ni quality property. More... | |
static int | find_min_max_it (void *cls, const struct GNUNET_PeerIdentity *h, void *k) |
Function called for all addresses and peers to find the minimum and maximum (averaged) values for a given quality property. More... | |
static void | update_norm (uint64_t min, uint64_t max, struct GAS_NormalizationInfo *ni) |
Compute the normalized value from the given ni range data and the average value. More... | |
static int | normalize_address (void *cls, const struct GNUNET_PeerIdentity *key, void *value) |
Normalize the property value for a given address based on the range we know that property values have globally. More... | |
static int | notify_change (void *cls, const struct GNUNET_PeerIdentity *key, void *value) |
Notify about change in normalized property. More... | |
static void | init_range (struct PropertyRange *pr) |
Initialize property range to the values corresponding to an empty set. More... | |
void | GAS_normalization_update_property (struct ATS_Address *address) |
Update and normalize atsi performance information. More... | |
void | GAS_normalization_start () |
Start the normalization component. More... | |
void | GAS_normalization_stop () |
Stop the normalization component and free all items. More... | |
Variables | |
static struct PropertyRange | property_range |
Range information for all quality properties we see. More... | |
ats service address: management of ATS properties and preferences normalization
Definition in file gnunet-service-ats_normalization.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "ats-normalization", __VA_ARGS__) |
Definition at line 34 of file gnunet-service-ats_normalization.c.
|
static |
Add the value from atsi to the running average of the given ni quality property.
current_val | the updated value |
ni | normalization information to update |
Definition at line 68 of file gnunet-service-ats_normalization.c.
References GAS_NormalizationInfo::atsi_abs, GAS_NormalizationInfo::avg, GAS_NormalizationInfo::avg_queue_index, GAS_normalization_queue_length, and consensus-simulation::sum.
Referenced by GAS_normalization_update_property().
|
static |
Function called for all addresses and peers to find the minimum and maximum (averaged) values for a given quality property.
Given those, we can then calculate the normalized score.
cls | the struct PropertyRange |
h | which peer are we looking at (ignored) |
k | the address for that peer |
Definition at line 106 of file gnunet-service-ats_normalization.c.
References GNUNET_ATS_Properties::delay, GNUNET_ATS_Properties::distance, GNUNET_MAX, GNUNET_MIN, GNUNET_OK, GNUNET_TIME_relative_max(), GNUNET_TIME_relative_min(), PropertyRange::max, PropertyRange::min, ATS_Address::properties, GNUNET_ATS_Properties::utilization_in, and GNUNET_ATS_Properties::utilization_out.
Referenced by GAS_normalization_update_property().
|
static |
Compute the normalized value from the given ni range data and the average value.
min | minimum value |
max | maximum value |
ni | normalization information to update |
Definition at line 142 of file gnunet-service-ats_normalization.c.
References GAS_NormalizationInfo::avg, DEFAULT_REL_QUALITY, max, min, and GAS_NormalizationInfo::norm.
Referenced by normalize_address().
|
static |
Normalize the property value for a given address based on the range we know that property values have globally.
cls | NULL |
key | which peer are we looking at (ignored) |
value | the address for that peer, from where we get the original value and where we write the normalized value |
Definition at line 166 of file gnunet-service-ats_normalization.c.
References address, GNUNET_ATS_Properties::delay, GNUNET_ATS_Properties::distance, GNUNET_OK, PropertyRange::max, PropertyRange::min, property_range, GNUNET_TIME_Relative::rel_value_us, update_norm(), GNUNET_ATS_Properties::utilization_in, GNUNET_ATS_Properties::utilization_out, and value.
Referenced by GAS_normalization_update_property().
|
static |
Notify about change in normalized property.
cls | NULL |
key | which peer are we looking at (ignored) |
value | the address for that peer |
Definition at line 197 of file gnunet-service-ats_normalization.c.
References address, GAS_plugin_notify_property_changed(), GNUNET_OK, and value.
Referenced by GAS_normalization_update_property().
|
static |
Initialize property range to the values corresponding to an empty set.
pr | range to initialize |
Definition at line 215 of file gnunet-service-ats_normalization.c.
References GNUNET_ATS_Properties::delay, GNUNET_ATS_Properties::distance, GNUNET_TIME_UNIT_FOREVER_REL, PropertyRange::min, GNUNET_ATS_Properties::utilization_in, and GNUNET_ATS_Properties::utilization_out.
Referenced by GAS_normalization_start(), and GAS_normalization_update_property().
void GAS_normalization_update_property | ( | struct ATS_Address * | address | ) |
Update and normalize atsi performance information.
Update and normalize a prop performance information.
address | the address to update |
Definition at line 231 of file gnunet-service-ats_normalization.c.
References address, GNUNET_ATS_Properties::delay, GNUNET_ATS_Properties::distance, find_min_max_it(), GAS_plugin_solver_lock(), GAS_plugin_solver_unlock(), GNUNET_CONTAINER_multipeermap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_i2s(), GNUNET_memcmp, GSA_addresses, init_range(), LOG, normalize_address(), notify_change(), property_range, GNUNET_TIME_Relative::rel_value_us, update_avg(), and GNUNET_ATS_Properties::utilization_in.
Referenced by GAS_addresses_add(), GAS_addresses_update(), and set_prop_task().
void GAS_normalization_start | ( | void | ) |
Start the normalization component.
Definition at line 283 of file gnunet-service-ats_normalization.c.
References init_range(), and property_range.
Referenced by GNUNET_ATS_solvers_solver_start(), and run().
void GAS_normalization_stop | ( | void | ) |
Stop the normalization component and free all items.
Definition at line 293 of file gnunet-service-ats_normalization.c.
Referenced by cleanup_task(), GNUNET_ATS_solvers_solver_stop(), and run().
|
static |
Range information for all quality properties we see.
Definition at line 1 of file gnunet-service-ats_normalization.c.
Referenced by GAS_normalization_start(), GAS_normalization_update_property(), and normalize_address().