00001
00018 #ifndef RRES_PROTECTED_KPI_H_
00019 #define RRES_PROTECTED_KPI_H_
00020
00021 #include <linux/aquosa/qos_debug.h>
00022 #include <linux/aquosa/rres_server.h>
00023
00025 qos_rv _rres_cleanup_server(server_t *srv);
00026
00028 qos_bw_t _rres_get_bandwidth(server_t *srv);
00029
00030 int rres_has_ready_tasks(server_t *srv);
00031
00039 static inline qos_bw_t rres_get_bandwidth(server_t *srv) {
00040 return srv->get_bandwidth(srv);
00041 }
00042
00046 static inline qos_bw_t rres_set_current_bandwidth(server_t *srv, qos_bw_t U_approved) {
00047 qos_bw_t U_max_avail, U_new;
00048
00049 U_max_avail = U_LUB2 - (U_tot - srv->U_current);
00050
00051 U_new = (U_approved < U_max_avail ? U_approved : U_max_avail);
00052 qos_log_debug("U_tot=" QOS_BW_FMT ", U_curr_old=" QOS_BW_FMT ", U_appr=" QOS_BW_FMT
00053 ", U_avail=" QOS_BW_FMT ", U_curr_new=" QOS_BW_FMT,
00054 U_tot, srv->U_current, U_approved, U_max_avail, U_new);
00055 U_tot = U_tot - srv->U_current + U_new;
00056 #ifdef SHRUB
00057 if (rres_has_ready_tasks(srv))
00058 U_active_tot = U_active_tot - srv->U_current + U_new;
00059 #endif
00060 srv->U_current = U_new;
00061 return U_new;
00062 }
00063
00064 static inline qos_bw_t rres_update_current_bandwidth(server_t *srv) {
00065 return rres_set_current_bandwidth(srv, rres_get_bandwidth(srv));
00066 }
00067
00074 static inline qos_bw_t rres_get_current_bandwidth(server_t *srv) {
00075 return srv->U_current;
00076 }
00077
00078 #endif
00079