aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api_operations.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-06 20:55:28 +0000
commit61c39c60565b386e0e12ea669556b030e8cd7180 (patch)
tree59109aeab8297bdc996faca8c4e38ec7426c36cf /src/testbed/testbed_api_operations.c
parent780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff)
downloadgnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz
gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip
-remove trailing whitespace
Diffstat (limited to 'src/testbed/testbed_api_operations.c')
-rw-r--r--src/testbed/testbed_api_operations.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/testbed/testbed_api_operations.c b/src/testbed/testbed_api_operations.c
index ce715785f..e3e9bb83d 100644
--- a/src/testbed/testbed_api_operations.c
+++ b/src/testbed/testbed_api_operations.c
@@ -115,7 +115,7 @@ struct FeedbackCtx
115 * Head for DLL of time slots which are free to be allocated to operations 115 * Head for DLL of time slots which are free to be allocated to operations
116 */ 116 */
117 struct TimeSlot *alloc_head; 117 struct TimeSlot *alloc_head;
118 118
119 /** 119 /**
120 * Tail for DLL of time slots which are free to be allocated to operations 120 * Tail for DLL of time slots which are free to be allocated to operations
121 */ 121 */
@@ -131,7 +131,7 @@ struct FeedbackCtx
131 * Number of time slots filled so far 131 * Number of time slots filled so far
132 */ 132 */
133 unsigned int tslots_filled; 133 unsigned int tslots_filled;
134 134
135 /** 135 /**
136 * Bound on the maximum number of operations which can be active 136 * Bound on the maximum number of operations which can be active
137 */ 137 */
@@ -267,7 +267,7 @@ struct ReadyQueueEntry
267 * next ptr for DLL 267 * next ptr for DLL
268 */ 268 */
269 struct ReadyQueueEntry *next; 269 struct ReadyQueueEntry *next;
270 270
271 /** 271 /**
272 * prev ptr for DLL 272 * prev ptr for DLL
273 */ 273 */
@@ -407,7 +407,7 @@ remove_queue_entry (struct GNUNET_TESTBED_Operation *op, unsigned int index)
407{ 407{
408 struct OperationQueue *opq; 408 struct OperationQueue *opq;
409 struct QueueEntry *entry; 409 struct QueueEntry *entry;
410 410
411 opq = op->queues[index]; 411 opq = op->queues[index];
412 entry = op->qentries[index]; 412 entry = op->qentries[index];
413 switch (op->state) 413 switch (op->state)
@@ -445,7 +445,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state)
445 struct OperationQueue *opq; 445 struct OperationQueue *opq;
446 unsigned int cnt; 446 unsigned int cnt;
447 unsigned int s; 447 unsigned int s;
448 448
449 GNUNET_assert (OP_STATE_INIT != state); 449 GNUNET_assert (OP_STATE_INIT != state);
450 GNUNET_assert (NULL != op->queues); 450 GNUNET_assert (NULL != op->queues);
451 GNUNET_assert (NULL != op->nres); 451 GNUNET_assert (NULL != op->nres);
@@ -459,7 +459,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state)
459 entry->op = op; 459 entry->op = op;
460 entry->nres = op->nres[cnt]; 460 entry->nres = op->nres[cnt];
461 s = cnt; 461 s = cnt;
462 GNUNET_array_append (op->qentries, s, entry); 462 GNUNET_array_append (op->qentries, s, entry);
463 } 463 }
464 else 464 else
465 { 465 {
@@ -498,7 +498,7 @@ change_state (struct GNUNET_TESTBED_Operation *op, enum OperationState state)
498 */ 498 */
499static void 499static void
500rq_remove (struct GNUNET_TESTBED_Operation *op) 500rq_remove (struct GNUNET_TESTBED_Operation *op)
501{ 501{
502 GNUNET_assert (NULL != op->rq_entry); 502 GNUNET_assert (NULL != op->rq_entry);
503 GNUNET_CONTAINER_DLL_remove (rq_head, rq_tail, op->rq_entry); 503 GNUNET_CONTAINER_DLL_remove (rq_head, rq_tail, op->rq_entry);
504 GNUNET_free (op->rq_entry); 504 GNUNET_free (op->rq_entry);
@@ -650,7 +650,7 @@ decide_capacity (struct OperationQueue *opq,
650 } 650 }
651 651
652 ret: 652 ret:
653 GNUNET_free_non_null (evict_entries); 653 GNUNET_free_non_null (evict_entries);
654 if (NULL != ops_) 654 if (NULL != ops_)
655 *ops_ = ops; 655 *ops_ = ops;
656 else 656 else
@@ -680,12 +680,12 @@ merge_ops (struct GNUNET_TESTBED_Operation ***old,
680 unsigned int i; 680 unsigned int i;
681 unsigned int j; 681 unsigned int j;
682 unsigned int n_cur; 682 unsigned int n_cur;
683 683
684 GNUNET_assert (NULL != old); 684 GNUNET_assert (NULL != old);
685 n_cur = *n_old; 685 n_cur = *n_old;
686 cur = *old; 686 cur = *old;
687 for (i = 0; i < n_new; i++) 687 for (i = 0; i < n_new; i++)
688 { 688 {
689 for (j = 0; j < *n_old; j++) 689 for (j = 0; j < *n_old; j++)
690 { 690 {
691 if (new[i] == cur[j]) 691 if (new[i] == cur[j])
@@ -698,7 +698,7 @@ merge_ops (struct GNUNET_TESTBED_Operation ***old,
698 *old = cur; 698 *old = cur;
699 *n_old = n_cur; 699 *n_old = n_cur;
700} 700}
701 701
702 702
703 703
704/** 704/**
@@ -732,12 +732,12 @@ check_readiness (struct GNUNET_TESTBED_Operation *op)
732 if (NULL == ops) 732 if (NULL == ops)
733 continue; 733 continue;
734 merge_ops (&evict_ops, &n_evict_ops, ops, n_ops); 734 merge_ops (&evict_ops, &n_evict_ops, ops, n_ops);
735 GNUNET_free (ops); 735 GNUNET_free (ops);
736 } 736 }
737 if (NULL != evict_ops) 737 if (NULL != evict_ops)
738 { 738 {
739 for (i = 0; i < n_evict_ops; i++) 739 for (i = 0; i < n_evict_ops; i++)
740 GNUNET_TESTBED_operation_release_ (evict_ops[i]); 740 GNUNET_TESTBED_operation_release_ (evict_ops[i]);
741 GNUNET_free (evict_ops); 741 GNUNET_free (evict_ops);
742 evict_ops = NULL; 742 evict_ops = NULL;
743 /* Evicting the operations should schedule this operation */ 743 /* Evicting the operations should schedule this operation */
@@ -767,7 +767,7 @@ defer (struct GNUNET_TESTBED_Operation *op)
767 for (i = 0; i < op->nqueues; i++) 767 for (i = 0; i < op->nqueues; i++)
768 { 768 {
769 GNUNET_assert (op->queues[i]->active >= op->nres[i]); 769 GNUNET_assert (op->queues[i]->active >= op->nres[i]);
770 op->queues[i]->active -= op->nres[i]; 770 op->queues[i]->active -= op->nres[i];
771 } 771 }
772 change_state (op, OP_STATE_WAITING); 772 change_state (op, OP_STATE_WAITING);
773} 773}
@@ -809,7 +809,7 @@ cleanup_tslots (struct OperationQueue *queue)
809 * Cleansup the existing timing slots and sets new timing slots in the given 809 * Cleansup the existing timing slots and sets new timing slots in the given
810 * queue to accommodate given number of max active operations. 810 * queue to accommodate given number of max active operations.
811 * 811 *
812 * @param queue the queue 812 * @param queue the queue
813 * @param n the number of maximum active operations. If n is greater than the 813 * @param n the number of maximum active operations. If n is greater than the
814 * maximum limit set while creating the queue, then the minimum of these two 814 * maximum limit set while creating the queue, then the minimum of these two
815 * will be selected as n 815 * will be selected as n
@@ -820,7 +820,7 @@ adaptive_queue_set_max_active (struct OperationQueue *queue, unsigned int n)
820 struct FeedbackCtx *fctx = queue->fctx; 820 struct FeedbackCtx *fctx = queue->fctx;
821 struct TimeSlot *tslot; 821 struct TimeSlot *tslot;
822 unsigned int cnt; 822 unsigned int cnt;
823 823
824 cleanup_tslots (queue); 824 cleanup_tslots (queue);
825 n = GNUNET_MIN (n ,fctx->max_active_bound); 825 n = GNUNET_MIN (n ,fctx->max_active_bound);
826 fctx->tslots_freeptr = GNUNET_malloc (n * sizeof (struct TimeSlot)); 826 fctx->tslots_freeptr = GNUNET_malloc (n * sizeof (struct TimeSlot));
@@ -872,7 +872,7 @@ adapt_parallelism (struct OperationQueue *queue)
872 return; 872 return;
873 } 873 }
874 avg = GNUNET_TIME_relative_divide (avg, nvals); 874 avg = GNUNET_TIME_relative_divide (avg, nvals);
875 if (GNUNET_SYSERR == 875 if (GNUNET_SYSERR ==
876 GNUNET_TESTBED_SD_deviation_factor_ (fctx->sd, 876 GNUNET_TESTBED_SD_deviation_factor_ (fctx->sd,
877 (unsigned int) avg.rel_value_us, 877 (unsigned int) avg.rel_value_us,
878 &sd)) 878 &sd))
@@ -923,14 +923,14 @@ update_tslots (struct GNUNET_TESTBED_Operation *op)
923 struct GNUNET_TIME_Relative t; 923 struct GNUNET_TIME_Relative t;
924 struct TimeSlot *tslot; 924 struct TimeSlot *tslot;
925 struct FeedbackCtx *fctx; 925 struct FeedbackCtx *fctx;
926 926
927 t = GNUNET_TIME_absolute_get_duration (op->tstart); 927 t = GNUNET_TIME_absolute_get_duration (op->tstart);
928 while (NULL != (tslot = op->tslots_head)) /* update time slots */ 928 while (NULL != (tslot = op->tslots_head)) /* update time slots */
929 { 929 {
930 queue = tslot->queue; 930 queue = tslot->queue;
931 fctx = queue->fctx; 931 fctx = queue->fctx;
932 GNUNET_CONTAINER_DLL_remove (op->tslots_head, op->tslots_tail, tslot); 932 GNUNET_CONTAINER_DLL_remove (op->tslots_head, op->tslots_tail, tslot);
933 tslot->op = NULL; 933 tslot->op = NULL;
934 GNUNET_CONTAINER_DLL_insert_tail (fctx->alloc_head, fctx->alloc_tail, 934 GNUNET_CONTAINER_DLL_insert_tail (fctx->alloc_head, fctx->alloc_tail,
935 tslot); 935 tslot);
936 if (op->failed) 936 if (op->failed)
@@ -1011,7 +1011,7 @@ void
1011GNUNET_TESTBED_operation_queue_destroy_ (struct OperationQueue *queue) 1011GNUNET_TESTBED_operation_queue_destroy_ (struct OperationQueue *queue)
1012{ 1012{
1013 struct FeedbackCtx *fctx; 1013 struct FeedbackCtx *fctx;
1014 1014
1015 GNUNET_break (GNUNET_YES == is_queue_empty (queue)); 1015 GNUNET_break (GNUNET_YES == is_queue_empty (queue));
1016 if (OPERATION_QUEUE_TYPE_ADAPTIVE == queue->type) 1016 if (OPERATION_QUEUE_TYPE_ADAPTIVE == queue->type)
1017 { 1017 {
@@ -1205,7 +1205,7 @@ GNUNET_TESTBED_operation_activate_ (struct GNUNET_TESTBED_Operation *op)
1205void 1205void
1206GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op) 1206GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op)
1207{ 1207{
1208 struct QueueEntry *entry; 1208 struct QueueEntry *entry;
1209 struct OperationQueue *opq; 1209 struct OperationQueue *opq;
1210 unsigned int i; 1210 unsigned int i;
1211 1211
@@ -1221,19 +1221,19 @@ GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op)
1221 if (OP_STATE_ACTIVE == op->state) 1221 if (OP_STATE_ACTIVE == op->state)
1222 update_tslots (op); 1222 update_tslots (op);
1223 GNUNET_assert (NULL != op->queues); 1223 GNUNET_assert (NULL != op->queues);
1224 GNUNET_assert (NULL != op->qentries); 1224 GNUNET_assert (NULL != op->qentries);
1225 for (i = 0; i < op->nqueues; i++) 1225 for (i = 0; i < op->nqueues; i++)
1226 { 1226 {
1227 entry = op->qentries[i]; 1227 entry = op->qentries[i];
1228 remove_queue_entry (op, i); 1228 remove_queue_entry (op, i);
1229 opq = op->queues[i]; 1229 opq = op->queues[i];
1230 switch (op->state) 1230 switch (op->state)
1231 { 1231 {
1232 case OP_STATE_INIT: 1232 case OP_STATE_INIT:
1233 case OP_STATE_INACTIVE: 1233 case OP_STATE_INACTIVE:
1234 GNUNET_assert (0); 1234 GNUNET_assert (0);
1235 break; 1235 break;
1236 case OP_STATE_WAITING: 1236 case OP_STATE_WAITING:
1237 break; 1237 break;
1238 case OP_STATE_ACTIVE: 1238 case OP_STATE_ACTIVE:
1239 case OP_STATE_READY: 1239 case OP_STATE_READY:
@@ -1242,7 +1242,7 @@ GNUNET_TESTBED_operation_release_ (struct GNUNET_TESTBED_Operation *op)
1242 opq->active -= entry->nres; 1242 opq->active -= entry->nres;
1243 recheck_waiting (opq); 1243 recheck_waiting (opq);
1244 break; 1244 break;
1245 } 1245 }
1246 GNUNET_free (entry); 1246 GNUNET_free (entry);
1247 } 1247 }
1248 GNUNET_free_non_null (op->qentries); 1248 GNUNET_free_non_null (op->qentries);