time_difference = timeval_subtract(now, ident->common.last_update);
- if (time_difference > 1.05 * (estintms / 1000 * ident->mainloop_intervals)) {
+ if (time_difference > .01 + (estintms / 1000 * ident->mainloop_intervals)) {
printlog(LOG_WARN, "Missed interval: Scheduled for %.2f ms, actual %.2fms\n",
estintms * ident->mainloop_intervals, time_difference * 1000);
}
static inline uint32_t close_enough(uint32_t limit) {
uint32_t difference = limit - (limit * CLOSE_ENOUGH);
- if (difference < 2500) {
- return (limit - 2500);
+ if (difference < 10240) {
+ return (limit - 10240);
} else {
return (limit * CLOSE_ENOUGH);
}
}
Old flowstart code.
#endif
+ //printf("rate is %d, close enough is %d, difference is %d\n", table->rate, close_enough(ident->locallimit), close_enough(ident->locallimit) - table->rate);
/* Boost low-limits so that they have room to grow. */
if (table->rate < FLOW_START_THRESHOLD) {
*/
static double allocate_grd(identity_t *ident, double aggdemand) {
double dropprob;
- double global_limit = (double) (ident->limit);
+ double global_limit = ident->limit;
+ double min_dropprob = ident->drop_prob * GRD_BIG_DROP;
+
+ struct timeval tv;
+ double time_now;
+ common_accounting_t *table = &ident->common;
+
+ gettimeofday(&tv, NULL);
+ time_now = (double) tv.tv_sec + (double) ((double) tv.tv_usec / (double) 1000000);
if (aggdemand > global_limit) {
dropprob = (aggdemand-global_limit)/aggdemand;
} else {
dropprob = 0.0;
}
-
+
+ if (dropprob > 0.01 && dropprob < min_dropprob) {
+ dropprob = min_dropprob;
+ }
+
if (system_loglevel == LOG_DEBUG) {
printf("local rate: %d, aggregate demand: %.3f, drop prob: %.3f\n",
ident->common.rate, aggdemand, dropprob);
}
+ if (table->max_flow_rate > 0) {
+ printlog(LOG_WARN, "%.2f %d 0 0 %.2f %d %d %d %d %d %d %d %d %.2f ID:%d %.3f\n",
+ time_now, table->inst_rate, aggdemand,
+ table->num_flows, table->num_flows_5k, table->num_flows_10k,
+ table->num_flows_20k, table->num_flows_50k, table->avg_rate,
+ table->max_flow_rate, table->max_flow_rate_flow_hash, dropprob,
+ ident->id, (double) table->rate / (double) table->max_flow_rate);
+ } else {
+ printlog(LOG_WARN, "%.2f %d 0 0 %.2f %d %d %d %d %d %d %d %d %.2f ID:%d 0\n",
+ time_now, table->inst_rate, aggdemand,
+ table->num_flows, table->num_flows_5k, table->num_flows_10k,
+ table->num_flows_20k, table->num_flows_50k, table->avg_rate,
+ table->max_flow_rate, table->max_flow_rate_flow_hash, dropprob,
+ ident->id);
+ }
+
return dropprob;
}
/* Update other limiters with our weight by writing to comm layer. */
write_local_value(&ident->comm, ident->localweight);
} else {
- ident->locallimit = 0; /* Unused with GRD. */
ident->last_drop_prob = ident->drop_prob;
ident->drop_prob = allocate_grd(ident, comm_val);
}
/* Make the call to tc. */
-#ifdef DELAY40MS
snprintf(cmd, CMD_BUFFER_SIZE,
- "/sbin/tc qdisc change dev eth0 parent 1:1%x handle 1%x netem loss %.4f delay 40ms",
+ "/sbin/tc qdisc change dev eth0 parent 1:1%x handle 1%x netem loss %.4f delay %dms",
ident->leaves[i]->xid, ident->leaves[i]->xid,
- (100 * ident->leaves[i]->drop_prob));
-#else
- snprintf(cmd, CMD_BUFFER_SIZE,
- "/sbin/tc qdisc change dev eth0 parent 1:1%x handle 1%x netem loss %.4f delay 0ms",
- ident->leaves[i]->xid, ident->leaves[i]->xid,
- (100 * ident->leaves[i]->drop_prob));
-#endif
+ (100 * ident->leaves[i]->drop_prob), ident->leaves[i]->delay);
+
if (do_enforcement) {
ret = system(cmd);