diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2014-09-15 02:13:35 -0400 |
---|---|---|
committer | Namhoon Kim <namhoonk@cs.unc.edu> | 2014-11-03 21:59:17 -0500 |
commit | a56ffe502e0f4edc7be9b59533455fdc3c9f86d3 (patch) | |
tree | 9686b5213a83da12b1621301aa9702a616bcaf93 | |
parent | 4841253863ef57e0b91d169b0080ce079d54fe6f (diff) |
Reservations: keep track of consumed budget
This can be a useful stat for userspace.
-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 | ||