initial implementation of request delay balancer
parent
d18d5657a4
commit
b14d26d530
|
@ -0,0 +1,18 @@
|
|||
function request_delay_balancer(refresh_period) {
|
||||
this.balance_to = refresh_period;
|
||||
this.request_t = 0;
|
||||
this.finished_t = 0;
|
||||
}
|
||||
|
||||
request_delay_balancer.prototype.requested = function() {
|
||||
this.request_t = millitime();
|
||||
};
|
||||
|
||||
request_delay_balancer.prototype.finished = function() {
|
||||
this.finished_t = millitime();
|
||||
};
|
||||
|
||||
request_delay_balancer.prototype.estimate = function() {
|
||||
var estimate = this.balance_to - (this.finished_t - this.request_t);
|
||||
return (estimate > 0) ? estimate : 0;
|
||||
};
|
|
@ -26,6 +26,7 @@
|
|||
<script type="text/javascript" src="./js/port_usage.js"></script>
|
||||
<script type="text/javascript" src="./js/serial.js"></script>
|
||||
<script type="text/javascript" src="./js/gui.js"></script>
|
||||
<script type="text/javascript" src="./js/request_balancer.js"></script>
|
||||
<script type="text/javascript" src="./js/serial_backend.js"></script>
|
||||
<script type="text/javascript" src="./js/data_storage.js"></script>
|
||||
<script type="text/javascript" src="./js/msp.js"></script>
|
||||
|
|
Loading…
Reference in New Issue