From: Kevin Webb Date: Tue, 2 Dec 2008 00:10:05 +0000 (+0000) Subject: Additional stat tracking for data processing. X-Git-Tag: DistributedRateLimiting-0.1-0~35 X-Git-Url: http://git.onelab.eu/?p=distributedratelimiting.git;a=commitdiff_plain;h=9891ed21bcd3ff9f72a92e867ac7e8e0b9abb533 Additional stat tracking for data processing. --- diff --git a/drl/common_accounting.h b/drl/common_accounting.h index 0fbcdbe..fc8e75e 100644 --- a/drl/common_accounting.h +++ b/drl/common_accounting.h @@ -94,6 +94,9 @@ typedef struct { /** The average flow rate. */ uint32_t avg_rate; + /** The hash of the flow whose rate is the max_flow_rate. */ + uint32_t max_flow_rate_flow_hash; + } common_accounting_t; /** Determines the difference between two timeval structs (in seconds, with diff --git a/drl/estimate.c b/drl/estimate.c index 3ed7b3f..bfe22c5 100644 --- a/drl/estimate.c +++ b/drl/estimate.c @@ -243,9 +243,11 @@ static uint32_t allocate_fps(identity_t *ident, double total_weight) { gettimeofday(&tv, NULL); time_now = (double) tv.tv_sec + (double) ((double) tv.tv_usec / (double) 1000000); - printlog(LOG_WARN, "%.2f %d %.2f %.2f %.2f %d %d %d %d %d %d ", time_now, ftable->inst_rate, idealweight, - ident->localweight, total_weight, ftable->num_flows, ftable->num_flows_5k, ftable->num_flows_10k, - ftable->num_flows_20k, ftable->num_flows_50k, ftable->avg_rate); + printlog(LOG_WARN, "%.2f %d %.2f %.2f %.2f %d %d %d %d %d %d %d %d", time_now, ftable->inst_rate, + idealweight, ident->localweight, total_weight, ftable->num_flows, ftable->num_flows_5k, + ftable->num_flows_10k, ftable->num_flows_20k, ftable->num_flows_50k, ftable->avg_rate, + ftable->max_flow_rate, ftable->max_flow_rate_flow_hash); + printcounter = PRINT_COUNTER_RESET; } else { printcounter -= 1; diff --git a/drl/standard.c b/drl/standard.c index 5c6a6d8..f035215 100644 --- a/drl/standard.c +++ b/drl/standard.c @@ -242,6 +242,7 @@ void standard_table_update_flows(standard_flow_table table, struct timeval now, standard_flow *current; struct in_addr src, dst; char sip[22], dip[22]; + key_flow largest_flow_info; /* Reset statistics. */ table->common->num_flows = 0; @@ -301,6 +302,11 @@ void standard_table_update_flows(standard_flow_table table, struct timeval now, if (current->rate > maxflowrate) { maxflowrate = current->rate; + largest_flow_info.source_ip = current->source_ip; + largest_flow_info.dest_ip = current->dest_ip; + largest_flow_info.source_port = current->source_port; + largest_flow_info.dest_port = current->dest_port; + largest_flow_info.protocol = current->protocol; } if (current->rate > 51200) { @@ -342,4 +348,5 @@ void standard_table_update_flows(standard_flow_table table, struct timeval now, printlog(LOG_DEBUG, "FLOW:--\n--\n"); table->common->max_flow_rate = maxflowrate; + table->common->max_flow_rate_flow_hash = table->hash_function(&largest_flow_info); }