gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r28914 - in gnunet/src: ats experimentation include


From: gnunet
Subject: [GNUnet-SVN] r28914 - in gnunet/src: ats experimentation include
Date: Fri, 30 Aug 2013 13:41:26 +0200

Author: wachs
Date: 2013-08-30 13:41:26 +0200 (Fri, 30 Aug 2013)
New Revision: 28914

Modified:
   gnunet/src/ats/ats.h
   gnunet/src/ats/ats_api_performance.c
   gnunet/src/ats/gnunet-service-ats-solver_mlp.c
   gnunet/src/ats/gnunet-service-ats-solver_mlp.h
   gnunet/src/ats/gnunet-service-ats-solver_proportional.c
   gnunet/src/ats/gnunet-service-ats-solver_proportional.h
   gnunet/src/ats/gnunet-service-ats_addresses.c
   gnunet/src/ats/gnunet-service-ats_addresses.h
   gnunet/src/ats/gnunet-service-ats_performance.c
   gnunet/src/ats/test_ats_api_performance_feedback.c
   gnunet/src/experimentation/test_experimentation_clique_connect.c
   gnunet/src/experimentation/test_experimentation_clique_run.c
   gnunet/src/include/gnunet_ats_service.h
Log:
updated experimentation tests
added scope time for feedback api 


Modified: gnunet/src/ats/ats.h
===================================================================
--- gnunet/src/ats/ats.h        2013-08-30 09:19:14 UTC (rev 28913)
+++ gnunet/src/ats/ats.h        2013-08-30 11:41:26 UTC (rev 28914)
@@ -262,15 +262,30 @@
    * struct PreferenceInformation values */
 };
 
+
+/**
+ * Message containing application feedback for a peer
+ */
 struct FeedbackPreferenceMessage
 {
   struct GNUNET_MessageHeader header;
 
-  uint32_t num_preferences GNUNET_PACKED;
+  /**
+   * Number of feedback values included
+   */
+  uint32_t num_feedback GNUNET_PACKED;
 
+  /**
+   * Relative time describing for which time interval this feedback is
+   */
+  struct GNUNET_TIME_RelativeNBO scope;
+
+  /**
+   * Peer this feedback is for
+   */
   struct GNUNET_PeerIdentity peer;
 
-  /* followed by 'num_preferences'
+  /* followed by 'num_feedback'
    * struct PreferenceInformation values */
 };
 

Modified: gnunet/src/ats/ats_api_performance.c
===================================================================
--- gnunet/src/ats/ats_api_performance.c        2013-08-30 09:19:14 UTC (rev 
28913)
+++ gnunet/src/ats/ats_api_performance.c        2013-08-30 11:41:26 UTC (rev 
28914)
@@ -943,12 +943,14 @@
  * preference is satisfied by ATS
  *
  * @param ph performance handle
+ * @param scope the time interval this valid for: [now - scope .. now]
  * @param peer identifies the peer
  * @param ... 0-terminated specification of the desired changes
  */
 void
 GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
-                                                                               
                                                                        const 
struct GNUNET_PeerIdentity *peer, ...)
+                                                                               
                                                                        const 
struct GNUNET_PeerIdentity *peer,
+                                                                               
                                                                        const 
struct GNUNET_TIME_Relative scope, ...)
 {
   struct PendingMessage *p;
   struct FeedbackPreferenceMessage *m;
@@ -959,7 +961,7 @@
   enum GNUNET_ATS_PreferenceKind kind;
 
   count = 0;
-  va_start (ap, peer);
+  va_start (ap, scope);
   while (GNUNET_ATS_PREFERENCE_END !=
          (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind)))
   {
@@ -989,11 +991,12 @@
   m = (struct FeedbackPreferenceMessage *) &p[1];
   m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK);
   m->header.size = htons (msize);
-  m->num_preferences = htonl (count);
+  m->scope = GNUNET_TIME_relative_hton (scope);
+  m->num_feedback = htonl (count);
   m->peer = *peer;
   pi = (struct PreferenceInformation *) &m[1];
   count = 0;
-  va_start (ap, peer);
+  va_start (ap, scope);
   while (GNUNET_ATS_PREFERENCE_END !=
          (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind)))
   {

Modified: gnunet/src/ats/gnunet-service-ats-solver_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats-solver_mlp.c      2013-08-30 09:19:14 UTC 
(rev 28913)
+++ gnunet/src/ats/gnunet-service-ats-solver_mlp.c      2013-08-30 11:41:26 UTC 
(rev 28914)
@@ -1657,6 +1657,7 @@
  * @param solver the solver handle
  * @param application the application
  * @param peer the peer to change the preference for
+ * @param scope the time interval for this feedback: [now - scope .. now]
  * @param kind the kind to change the preference
  * @param score the score
  */
@@ -1664,6 +1665,7 @@
 GAS_mlp_address_preference_feedback (void *solver,
                                                                                
        void *application,
                                                                                
        const struct GNUNET_PeerIdentity *peer,
+                                                                               
  const struct GNUNET_TIME_Relative scope,
                                                                                
        enum GNUNET_ATS_PreferenceKind kind,
                                                                                
        double score)
 {

Modified: gnunet/src/ats/gnunet-service-ats-solver_mlp.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats-solver_mlp.h      2013-08-30 09:19:14 UTC 
(rev 28913)
+++ gnunet/src/ats/gnunet-service-ats-solver_mlp.h      2013-08-30 11:41:26 UTC 
(rev 28914)
@@ -506,6 +506,7 @@
  * @param solver the solver handle
  * @param application the application
  * @param peer the peer to change the preference for
+ * @param scope the time interval for this feedback: [now - scope .. now]
  * @param kind the kind to change the preference
  * @param score the score
  */
@@ -513,6 +514,7 @@
 GAS_mlp_address_preference_feedback (void *solver,
                                                                                
        void *application,
                                                                                
        const struct GNUNET_PeerIdentity *peer,
+                                                                               
        const struct GNUNET_TIME_Relative scope,
                                                                                
        enum GNUNET_ATS_PreferenceKind kind,
                                                                                
        double score);
 

Modified: gnunet/src/ats/gnunet-service-ats-solver_proportional.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats-solver_proportional.c     2013-08-30 
09:19:14 UTC (rev 28913)
+++ gnunet/src/ats/gnunet-service-ats-solver_proportional.c     2013-08-30 
11:41:26 UTC (rev 28914)
@@ -892,6 +892,7 @@
  * @param solver the solver handle
  * @param application the application
  * @param peer the peer to change the preference for
+ * @param scope the time interval for this feedback: [now - scope .. now]
  * @param kind the kind to change the preference
  * @param score the score
  */
@@ -899,6 +900,7 @@
 GAS_proportional_address_preference_feedback (void *solver,
                                                                                
        void *application,
                                                                                
        const struct GNUNET_PeerIdentity *peer,
+                                                                               
        const struct GNUNET_TIME_Relative scope,
                                                                                
        enum GNUNET_ATS_PreferenceKind kind,
                                                                                
        double score)
 {

Modified: gnunet/src/ats/gnunet-service-ats-solver_proportional.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats-solver_proportional.h     2013-08-30 
09:19:14 UTC (rev 28913)
+++ gnunet/src/ats/gnunet-service-ats-solver_proportional.h     2013-08-30 
11:41:26 UTC (rev 28914)
@@ -55,6 +55,7 @@
  * @param solver the solver handle
  * @param application the application
  * @param peer the peer to change the preference for
+ * @param scope the time interval for this feedback: [now - scope .. now]
  * @param kind the kind to change the preference
  * @param score the score
  */
@@ -62,6 +63,7 @@
 GAS_proportional_address_preference_feedback (void *solver,
                                                                                
        void *application,
                                                                                
        const struct GNUNET_PeerIdentity *peer,
+                                                                               
  const struct GNUNET_TIME_Relative scope,
                                                                                
        enum GNUNET_ATS_PreferenceKind kind,
                                                                                
        double score);
 

Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c       2013-08-30 09:19:14 UTC 
(rev 28913)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c       2013-08-30 11:41:26 UTC 
(rev 28914)
@@ -1486,12 +1486,14 @@
   handle->s_bulk_stop (handle->solver);
 }
 
+
 /**
  * Change the preference for a peer
  *
  * @param handle the address handle
  * @param application the client sending this request
  * @param peer the peer id
+ * @param scope the time interval for this feedback: [now - scope .. now]
  * @param kind the preference kind to change
  * @param score_abs the new preference score
  */
@@ -1499,6 +1501,7 @@
 GAS_addresses_preference_feedback (struct GAS_Addresses_Handle *handle,
                                                                                
                                                                void 
*application,
                                                                                
                                                                const struct 
GNUNET_PeerIdentity *peer,
+                                                                               
                                                                const struct 
GNUNET_TIME_Relative scope,
                                                                                
                                                                enum 
GNUNET_ATS_PreferenceKind kind,
                                                                                
                                                                float score_abs)
 {
@@ -1520,7 +1523,7 @@
       return;
   }
 
-  handle->s_feedback (handle->solver, application, peer, kind, score_abs);
+  handle->s_feedback (handle->solver, application, peer, scope, kind, 
score_abs);
 }
 
 

Modified: gnunet/src/ats/gnunet-service-ats_addresses.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.h       2013-08-30 09:19:14 UTC 
(rev 28913)
+++ gnunet/src/ats/gnunet-service-ats_addresses.h       2013-08-30 11:41:26 UTC 
(rev 28914)
@@ -455,6 +455,7 @@
  * @param handle the solver handle
  * @param application the application sending this request
  * @param peer the peer id
+ * @param scope the time interval for this feedback: [now - scope .. now]
  * @param kind the preference kind for this feedback
  * @param score the feedback score
  */
@@ -462,6 +463,7 @@
 (*GAS_solver_address_feedback_preference) (void *solver,
                                                                                
                                                                                
 void *application,
                                                                                
                                                                                
 const struct GNUNET_PeerIdentity *peer,
+                                                                               
                                                                                
 const struct GNUNET_TIME_Relative scope,
                                                                                
                                                                                
 enum GNUNET_ATS_PreferenceKind kind,
                                                                                
                                                                                
 double score);
 
@@ -796,15 +798,17 @@
  * Change the preference for a peer
  *
  * @param handle the address handle
- * @param client the client sending this request
+ * @param application the client sending this request
  * @param peer the peer id
+ * @param scope the time interval this valid for: [now - scope .. now]
  * @param kind the preference kind to change
  * @param score_abs the new preference score
  */
 void
 GAS_addresses_preference_feedback (struct GAS_Addresses_Handle *handle,
-                                                                               
                                                                void *client,
+                                                                               
                                                                void 
*application,
                                                                                
                                                                const struct 
GNUNET_PeerIdentity *peer,
+                                                                               
                                                                const struct 
GNUNET_TIME_Relative scope,
                                                                                
                                                                enum 
GNUNET_ATS_PreferenceKind kind,
                                                                                
                                                                float 
score_abs);
 

Modified: gnunet/src/ats/gnunet-service-ats_performance.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.c     2013-08-30 09:19:14 UTC 
(rev 28913)
+++ gnunet/src/ats/gnunet-service-ats_performance.c     2013-08-30 11:41:26 UTC 
(rev 28914)
@@ -676,7 +676,7 @@
     return;
   }
   msg = (const struct FeedbackPreferenceMessage *) message;
-  nump = ntohl (msg->num_preferences);
+  nump = ntohl (msg->num_feedback);
   if (msize !=
       sizeof (struct FeedbackPreferenceMessage) +
       nump * sizeof (struct PreferenceInformation))
@@ -692,6 +692,7 @@
     GAS_addresses_preference_feedback (GSA_addresses,
                                      client,
                                      &msg->peer,
+                                     GNUNET_TIME_relative_ntoh(msg->scope),
                                      (enum GNUNET_ATS_PreferenceKind)
                                      ntohl (pi[i].preference_kind),
                                      pi[i].preference_value);

Modified: gnunet/src/ats/test_ats_api_performance_feedback.c
===================================================================
--- gnunet/src/ats/test_ats_api_performance_feedback.c  2013-08-30 09:19:14 UTC 
(rev 28913)
+++ gnunet/src/ats/test_ats_api_performance_feedback.c  2013-08-30 11:41:26 UTC 
(rev 28914)
@@ -167,11 +167,15 @@
                res_suggest_cb_p0 = GNUNET_YES;
                stage = 1;
                GNUNET_ATS_address_update (sh, &addr[1], NULL, atsi, ATS_COUNT);
-               GNUNET_ATS_performance_give_feedback (ph, &addr[0].peer, 
GNUNET_ATS_PREFERENCE_BANDWIDTH,(double) 1000, GNUNET_ATS_PREFERENCE_END);
+               GNUNET_ATS_performance_give_feedback (ph, &addr[0].peer,
+                               GNUNET_TIME_UNIT_SECONDS, 
GNUNET_ATS_PREFERENCE_BANDWIDTH,
+                               (double) 1000, GNUNET_ATS_PREFERENCE_END);
        }
        if (0 == memcmp (&addr[1].peer, &address->peer, sizeof (address->peer)))
        {
-               GNUNET_ATS_performance_give_feedback (ph, &addr[1].peer, 
GNUNET_ATS_PREFERENCE_BANDWIDTH,(double) 1000, GNUNET_ATS_PREFERENCE_END);
+               GNUNET_ATS_performance_give_feedback (ph, &addr[1].peer,
+                               GNUNET_TIME_UNIT_SECONDS, 
GNUNET_ATS_PREFERENCE_BANDWIDTH,
+                               GNUNET_ATS_PREFERENCE_END);
                res_suggest_cb_p1 = GNUNET_YES;
        }
 }

Modified: gnunet/src/experimentation/test_experimentation_clique_connect.c
===================================================================
--- gnunet/src/experimentation/test_experimentation_clique_connect.c    
2013-08-30 09:19:14 UTC (rev 28913)
+++ gnunet/src/experimentation/test_experimentation_clique_connect.c    
2013-08-30 11:41:26 UTC (rev 28914)
@@ -94,7 +94,7 @@
 };
 
 
-struct ExperimentationPeer ph[NUM_PEERS];
+struct ExperimentationPeer bp_slaves[NUM_PEERS];
 
 /**
  * Shutdown nicely
@@ -110,9 +110,9 @@
 
   for (peer = 0; peer < NUM_PEERS; peer++)
   {
-       if (NULL != ph[peer].stat_op)
-               GNUNET_TESTBED_operation_done (ph[peer].stat_op);
-       ph[peer].stat_op = NULL;
+       if (NULL != bp_slaves[peer].stat_op)
+               GNUNET_TESTBED_operation_done (bp_slaves[peer].stat_op);
+       bp_slaves[peer].stat_op = NULL;
   }
 
   if (NULL != op)
@@ -173,12 +173,12 @@
 
        for (peer = 0; peer < NUM_PEERS; peer++)
        {
-                       total_active += ph[peer].active_nodes;
-                       total_requested += ph[peer].requested_nodes;
-                       total_inactive += ph[peer].inactive_nodes;
-                       if (NUM_ISSUER == ph[peer].issuer)
+                       total_active += bp_slaves[peer].active_nodes;
+                       total_requested += bp_slaves[peer].requested_nodes;
+                       total_inactive += bp_slaves[peer].inactive_nodes;
+                       if (NUM_ISSUER == bp_slaves[peer].issuer)
                                issuer ++;
-                       if (NUM_EXPERIMENTS == ph[peer].experiments)
+                       if (NUM_EXPERIMENTS == bp_slaves[peer].experiments)
                                experiments ++;
        }
        if ((last_issuer_value < issuer) && (issuer == NUM_PEERS))
@@ -367,12 +367,12 @@
   {
     GNUNET_assert (NULL != peers_[peer]);
     /* Connect to peer's statistic service */
-    ph[peer].stat_op = GNUNET_TESTBED_service_connect (NULL,
+    bp_slaves[peer].stat_op = GNUNET_TESTBED_service_connect (NULL,
                                                                                
                                                peers_[peer], "statistics",
-                                                                               
                                                &stat_comp_cb, &ph[peer],
+                                                                               
                                                &stat_comp_cb, &bp_slaves[peer],
                                     &stat_connect_adapter,
                                     &stat_disconnect_adapter,
-                                    &ph[peer]);
+                                    &bp_slaves[peer]);
 
   }
   peers = peers_;

Modified: gnunet/src/experimentation/test_experimentation_clique_run.c
===================================================================
--- gnunet/src/experimentation/test_experimentation_clique_run.c        
2013-08-30 09:19:14 UTC (rev 28913)
+++ gnunet/src/experimentation/test_experimentation_clique_run.c        
2013-08-30 11:41:26 UTC (rev 28914)
@@ -96,7 +96,7 @@
 };
 
 
-struct ExperimentationPeer ph[NUM_PEERS];
+struct ExperimentationPeer bp_slaves[NUM_PEERS];
 
 /**
  * Shutdown nicely
@@ -112,9 +112,9 @@
 
   for (peer = 0; peer < NUM_PEERS; peer++)
   {
-       if (NULL != ph[peer].stat_op)
-               GNUNET_TESTBED_operation_done (ph[peer].stat_op);
-       ph[peer].stat_op = NULL;
+       if (NULL != bp_slaves[peer].stat_op)
+               GNUNET_TESTBED_operation_done (bp_slaves[peer].stat_op);
+       bp_slaves[peer].stat_op = NULL;
   }
 
   if (NULL != op)
@@ -171,8 +171,8 @@
 
        for (peer = 0; peer < NUM_PEERS; peer++)
        {
-               t_running_outbound_experiments += 
ph[peer].experiments_outbound_running;
-               t_running_inbound_experiments += 
ph[peer].experiments_inbound_running;
+               t_running_outbound_experiments += 
bp_slaves[peer].experiments_outbound_running;
+               t_running_inbound_experiments += 
bp_slaves[peer].experiments_inbound_running;
 
        }
 
@@ -340,12 +340,12 @@
   {
     GNUNET_assert (NULL != peers_[peer]);
     /* Connect to peer's statistic service */
-    ph[peer].stat_op = GNUNET_TESTBED_service_connect (NULL,
+    bp_slaves[peer].stat_op = GNUNET_TESTBED_service_connect (NULL,
                                                                                
                                                peers_[peer], "statistics",
-                                                                               
                                                &stat_comp_cb, &ph[peer],
+                                                                               
                                                &stat_comp_cb, &bp_slaves[peer],
                                     &stat_connect_adapter,
                                     &stat_disconnect_adapter,
-                                    &ph[peer]);
+                                    &bp_slaves[peer]);
 
   }
   peers = peers_;

Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h     2013-08-30 09:19:14 UTC (rev 
28913)
+++ gnunet/src/include/gnunet_ats_service.h     2013-08-30 11:41:26 UTC (rev 
28914)
@@ -937,12 +937,14 @@
  * preference is satisfied by ATS
  *
  * @param ph performance handle
+ * @param scope the time interval this valid for: [now - scope .. now]
  * @param peer identifies the peer
  * @param ... 0-terminated specification of the desired changes
  */
 void
 GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
-                                                                               
                                                                        const 
struct GNUNET_PeerIdentity *peer, ...);
+                                                                               
                                                                        const 
struct GNUNET_PeerIdentity *peer,
+                                                                               
                                                                        const 
struct GNUNET_TIME_Relative scope, ...);
 
 #endif
 /* end of file gnunet-service-transport_ats.h */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]