Add frontend support for collecting the time it takes to
install each Flow.
The new REST call is "wm/flow/measurement-get-per-flow-install-time/json"
The result is returned in a multi-line string with the following format
per line:
ThreadAndTimePerFlow <ThreadId> <TotalThreads> <Time(ns)>
diff --git a/web/measurement_get_per_flow_install_time.py b/web/measurement_get_per_flow_install_time.py
new file mode 100755
index 0000000..bf2bcc7
--- /dev/null
+++ b/web/measurement_get_per_flow_install_time.py
@@ -0,0 +1,61 @@
+#! /usr/bin/env python
+# -*- Mode: python; py-indent-offset: 4; tab-width: 8; indent-tabs-mode: t; -*-
+
+import pprint
+import os
+import sys
+import subprocess
+import json
+import argparse
+import io
+import time
+
+from flask import Flask, json, Response, render_template, make_response, request
+
+#
+# TODO: remove this! We don't use JSON argument here!
+# curl http://127.0.0.1:8080/wm/flow/delete/{"value":"0xf"}/json'
+#
+
+## Global Var ##
+ControllerIP="127.0.0.1"
+ControllerPort=8080
+
+DEBUG=0
+pp = pprint.PrettyPrinter(indent=4)
+
+app = Flask(__name__)
+
+## Worker Functions ##
+def log_error(txt):
+ print '%s' % (txt)
+
+def debug(txt):
+ if DEBUG:
+ print '%s' % (txt)
+
+# @app.route("/wm/flow/measurement-get-per-flow-install-time/json")
+def measurement_get_per_flow_install_time():
+ command = "curl -s \"http://%s:%s/wm/flow/measurement-get-per-flow-install-time/json\"" % (ControllerIP, ControllerPort)
+ debug("measurement_get_per_flow_install_time %s" % command)
+ result = os.popen(command).read()
+ print '%s' % (result)
+ # parsedResult = json.loads(result)
+ # debug("parsed %s" % parsedResult)
+
+if __name__ == "__main__":
+ usage_msg = "Get the measured time per flow to install each stored flow path\n"
+ usage_msg = usage_msg + "Usage: %s\n" % (sys.argv[0])
+ usage_msg = usage_msg + "\n"
+
+ # app.debug = False;
+
+ # Usage info
+ if len(sys.argv) > 1 and (sys.argv[1] == "-h" or sys.argv[1] == "--help"):
+ print(usage_msg)
+ exit(0)
+
+ # Check arguments
+
+ # Do the work
+ measurement_get_per_flow_install_time()
diff --git a/web/measurement_run.py b/web/measurement_run.py
index 6a44512..80d0517 100755
--- a/web/measurement_run.py
+++ b/web/measurement_run.py
@@ -6,21 +6,18 @@
import subprocess
import time
-threads_n = [1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 100]
-# threads_n = [1]
-# flows_n = [42, 252, 420, 1008]
-# flow_n = 42
-# flow_n = 1008
-flow_n = 252
-# flow_n = 1
+# flow_n = 252
+# threads_n = [1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 100]
+# iterations_n = 10
+
+flow_n = 1
+threads_n = [1]
iterations_n = 10
# iterations_n = 100
-# threads_n = [1]
-# flowdef_filename = "web/flowdef_8node_1008.txt"
-# flowdef_filename = "web/flowdef_8node_252.txt"
-# flowdef_filename = "web/flowdef_8node_42.txt"
-# flowdef_filename = "web/flowdef_8node_1.txt"
+# flow_n = 42
+# flow_n = 420
+# flow_n = 1008
def run_command(cmd):
"""
@@ -50,10 +47,16 @@
# Get the measurement data and print it
cmd = "web/measurement_get_install_paths_time_nsec.py"
r = run_command(cmd) # Tuple: [<stdout>, <stderr>]
- res = r[0].split() # Tuple: [<num>, nsec]
+ res = r[0].split() # Tuple: [<num>, nsec]
nsec_str = res[0]
msec = float(nsec_str) / (1000 * 1000)
+ # Get the measurement data and print it
+ cmd = "web/measurement_get_per_flow_install_time.py"
+ r = run_command(cmd) # Tuple: [<stdout>, <stderr>]
+ res = r[0]
+ print res
+
# Keep checking until all Flow Paths are installed
while True:
# time.sleep(3)