Additional stat tracking for data processing.
authorKevin Webb <kcwebb@ucsd.edu>
Tue, 2 Dec 2008 00:10:05 +0000 (00:10 +0000)
committerKevin Webb <kcwebb@ucsd.edu>
Tue, 2 Dec 2008 00:10:05 +0000 (00:10 +0000)
drl/common_accounting.h
drl/estimate.c
drl/standard.c

index 0fbcdbe..fc8e75e 100644 (file)
@@ -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
index 3ed7b3f..bfe22c5 100644 (file)
@@ -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;
index 5c6a6d8..f035215 100644 (file)
@@ -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);
 }