diff options
| -rw-r--r-- | include/litmus/reservation.h | 4 | ||||
| -rw-r--r-- | litmus/polling_reservations.c | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/litmus/reservation.h b/include/litmus/reservation.h index 9c23e27165b2..4eecd3f088e8 100644 --- a/include/litmus/reservation.h +++ b/include/litmus/reservation.h | |||
| @@ -117,6 +117,10 @@ struct reservation { | |||
| 117 | lt_t cur_budget; | 117 | lt_t cur_budget; |
| 118 | lt_t next_replenishment; | 118 | lt_t next_replenishment; |
| 119 | 119 | ||
| 120 | /* budget stats */ | ||
| 121 | lt_t budget_consumed; /* how much budget consumed in this allocation cycle? */ | ||
| 122 | lt_t budget_consumed_total; | ||
| 123 | |||
| 120 | /* interaction with framework */ | 124 | /* interaction with framework */ |
| 121 | struct reservation_environment *env; | 125 | struct reservation_environment *env; |
| 122 | struct reservation_ops *ops; | 126 | struct reservation_ops *ops; |
diff --git a/litmus/polling_reservations.c b/litmus/polling_reservations.c index 5c9b1832d2d9..2c481b46ba39 100644 --- a/litmus/polling_reservations.c +++ b/litmus/polling_reservations.c | |||
| @@ -84,6 +84,7 @@ static void periodic_polling_on_replenishment( | |||
| 84 | /* replenish budget */ | 84 | /* replenish budget */ |
| 85 | res->cur_budget = pres->max_budget; | 85 | res->cur_budget = pres->max_budget; |
| 86 | res->next_replenishment += pres->period; | 86 | res->next_replenishment += pres->period; |
| 87 | res->budget_consumed = 0; | ||
| 87 | 88 | ||
| 88 | switch (res->state) { | 89 | switch (res->state) { |
| 89 | case RESERVATION_DEPLETED: | 90 | case RESERVATION_DEPLETED: |
| @@ -129,6 +130,9 @@ static void common_drain_budget( | |||
| 129 | else | 130 | else |
| 130 | res->cur_budget -= how_much; | 131 | res->cur_budget -= how_much; |
| 131 | 132 | ||
| 133 | res->budget_consumed += how_much; | ||
| 134 | res->budget_consumed_total += how_much; | ||
| 135 | |||
| 132 | switch (res->state) { | 136 | switch (res->state) { |
| 133 | case RESERVATION_DEPLETED: | 137 | case RESERVATION_DEPLETED: |
| 134 | case RESERVATION_INACTIVE: | 138 | case RESERVATION_INACTIVE: |
| @@ -384,6 +388,7 @@ static void td_replenish( | |||
| 384 | /* replenish budget */ | 388 | /* replenish budget */ |
| 385 | tdres->cur_interval = tdres->intervals + tdres->next_interval; | 389 | tdres->cur_interval = tdres->intervals + tdres->next_interval; |
| 386 | res->cur_budget = td_time_remaining_until_end(tdres); | 390 | res->cur_budget = td_time_remaining_until_end(tdres); |
| 391 | res->budget_consumed = 0; | ||
| 387 | TRACE("td_replenish(%u): %s budget=%llu\n", res->id, | 392 | TRACE("td_replenish(%u): %s budget=%llu\n", res->id, |
| 388 | res->cur_budget ? "" : "WARNING", res->cur_budget); | 393 | res->cur_budget ? "" : "WARNING", res->cur_budget); |
| 389 | 394 | ||
| @@ -422,6 +427,9 @@ static void td_drain_budget( | |||
| 422 | struct table_driven_reservation *tdres = | 427 | struct table_driven_reservation *tdres = |
| 423 | container_of(res, struct table_driven_reservation, res); | 428 | container_of(res, struct table_driven_reservation, res); |
| 424 | 429 | ||
| 430 | res->budget_consumed += how_much; | ||
| 431 | res->budget_consumed_total += how_much; | ||
| 432 | |||
| 425 | /* Table-driven scheduling: instead of tracking the budget, we compute | 433 | /* Table-driven scheduling: instead of tracking the budget, we compute |
| 426 | * how much time is left in this allocation interval. */ | 434 | * how much time is left in this allocation interval. */ |
| 427 | 435 | ||
