Commit 561b6211 authored by Timothy Stack's avatar Timothy Stack

Have loghole automatically run linktrace captures through tcptrace(1)

so they can be viewed with xplot.  Loghole does this by merging the
capture files for the "pre-shaped" sides of a particular link and then
runs that new file through tcptrace to generate a bunch of graphs.
The merged capture file and the .xpl's are dropped in the experiment's
log directory under separate directories for each lan/link.
parent 52aa74bd
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2004, 2005 University of Utah and the Flux Group. # Copyright (c) 2004, 2005, 2006 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -271,6 +271,8 @@ def sync_usage(): ...@@ -271,6 +271,8 @@ def sync_usage():
print " Flag that indicates that the standard logholes" print " Flag that indicates that the standard logholes"
print " (i.e. '/var/emulab/logs', '/local/logs') should not" print " (i.e. '/var/emulab/logs', '/local/logs') should not"
print " be downloaded." print " be downloaded."
print " -P, --no-post"
print " Do not do any additional post processing."
print " node1 ... The names of the virtual or physical nodes that " print " node1 ... The names of the virtual or physical nodes that "
print " should be synced. The default behavior is to sync " print " should be synced. The default behavior is to sync "
print " all of the nodes in an experiment." print " all of the nodes in an experiment."
...@@ -982,7 +984,16 @@ def rmstar(host, port, *args): ...@@ -982,7 +984,16 @@ def rmstar(host, port, *args):
return retval return retval
def print_status(hosts, jobs, hoststatus, hoststart): def print_status(msg):
if not sys.stdout.isatty() or VERBOSITY < VERBOSITY_HUMAN:
return
sys.stdout.write(msg)
sys.stdout.flush()
return
def print_job_status(hosts, jobs, hoststatus, hoststart):
if not sys.stdout.isatty() or VERBOSITY < VERBOSITY_HUMAN: if not sys.stdout.isatty() or VERBOSITY < VERBOSITY_HUMAN:
return return
...@@ -1012,11 +1023,45 @@ def print_status(hosts, jobs, hoststatus, hoststart): ...@@ -1012,11 +1023,45 @@ def print_status(hosts, jobs, hoststatus, hoststart):
if line_len < 79: if line_len < 79:
lmsg += " " * (79 - line_len) lmsg += " " * (79 - line_len)
pass pass
sys.stdout.write(lmsg + rmsg + "\r") print_status(lmsg + rmsg + "\r")
sys.stdout.flush()
return return
def trace_post(link2trace):
lpc = 1
for linkvname in link2trace.keys():
print_status("linktrace post processing %d/%d " %
(lpc, len(link2trace)))
args = {}
os.chdir(linkvname)
for filename in glob.glob("*.recv*"):
base, ext = os.path.splitext(filename)
if base.startswith("__") or ext == ".recv":
continue
al = args.get(ext, [])
al.append(filename)
args[ext] = al
pass
for ext in args.keys():
if ext == ".recv":
continue
dst = "__all.recv%s" % (ext,)
print_status(".")
os.system("mergecap -w %s %s" % (dst, " ".join(args[ext])))
print_status(".")
os.system("tcptrace -G %s > .tcptrace.out" % (dst,))
print_status("\r")
pass
os.chdir(os.path.pardir)
lpc += 1
pass
if len(link2trace.keys()):
print_status("\n")
pass
return
## ##
# Performs the "sync" action, which synchronizes the logholes for a group of # Performs the "sync" action, which synchronizes the logholes for a group of
# nodes. # nodes.
...@@ -1032,16 +1077,20 @@ def do_sync(args, mode="sync", must_be_active=1): ...@@ -1032,16 +1077,20 @@ def do_sync(args, mode="sync", must_be_active=1):
logdir = os.path.join(EXPDIR_FMT % { "PID" : PID, "EID" : EID }, "logs") logdir = os.path.join(EXPDIR_FMT % { "PID" : PID, "EID" : EID }, "logs")
standard_logholes = True standard_logholes = True
post_process = True
extra_logholes = [] extra_logholes = []
try: try:
opts, node_list = getopt.getopt(args, "nl:r:", [ opts, node_list = getopt.getopt(args, "nl:r:P", [
"no-standard", "local=", "remote=", "no-standard", "local=", "remote=",
]) ])
for opt, val in opts: for opt, val in opts:
if opt in ("-n", "--no-standard"): if opt in ("-n", "--no-standard"):
standard_logholes = False standard_logholes = False
pass pass
elif opt in ("-P", "--no-post"):
post_process = False
pass
elif opt in ("-l", "--local"): elif opt in ("-l", "--local"):
logdir = os.path.abspath(val) logdir = os.path.abspath(val)
if not os.path.isdir(logdir): if not os.path.isdir(logdir):
...@@ -1168,7 +1217,7 @@ def do_sync(args, mode="sync", must_be_active=1): ...@@ -1168,7 +1217,7 @@ def do_sync(args, mode="sync", must_be_active=1):
hoststart = {} hoststart = {}
for phost, vhost in hosts: for phost, vhost in hosts:
if (vhost in node_list) or (phost in node_list): if (vhost in node_list) or (phost in node_list):
print_status(node_list, jobs, hoststatus, hoststart) print_job_status(node_list, jobs, hoststatus, hoststart)
osid = physical[vhost]["osid"] osid = physical[vhost]["osid"]
if osid not in OSIDS: if osid not in OSIDS:
...@@ -1234,7 +1283,10 @@ def do_sync(args, mode="sync", must_be_active=1): ...@@ -1234,7 +1283,10 @@ def do_sync(args, mode="sync", must_be_active=1):
hoststatus[jobs[pid]] = (time.time(), sts) hoststatus[jobs[pid]] = (time.time(), sts)
del jobs[pid] del jobs[pid]
print_status(node_list, jobs, hoststatus, hoststart) print_job_status(node_list,
jobs,
hoststatus,
hoststart)
pass pass
pass pass
pass pass
...@@ -1275,8 +1327,15 @@ def do_sync(args, mode="sync", must_be_active=1): ...@@ -1275,8 +1327,15 @@ def do_sync(args, mode="sync", must_be_active=1):
pass pass
# Add symbolic links to the trace files. # Add symbolic links to the trace files.
linkdirs = {} link2trace = {}
for trace in traces: for trace in traces:
if trace["trace_type"] == "monitor":
continue
tl = link2trace.get(trace["linkvname"], [])
tl.append(trace)
link2trace[trace["linkvname"]] = tl
fullpath = os.path.join(logdir, trace["linkvname"]) fullpath = os.path.join(logdir, trace["linkvname"])
try: try:
os.makedirs(fullpath) os.makedirs(fullpath)
...@@ -1285,7 +1344,8 @@ def do_sync(args, mode="sync", must_be_active=1): ...@@ -1285,7 +1344,8 @@ def do_sync(args, mode="sync", must_be_active=1):
pass pass
for fmt in LINK_DUMP_FMT: for fmt in LINK_DUMP_FMT:
src = os.path.join(trace["delayvname"], src = os.path.join(trace["delayvname"],
"local/logs", "local",
"logs",
fmt % (trace["vnode"], fmt % (trace["vnode"],
trace["linkvname"])) trace["linkvname"]))
for filename in glob.glob(src + "*"): for filename in glob.glob(src + "*"):
...@@ -1304,6 +1364,10 @@ def do_sync(args, mode="sync", must_be_active=1): ...@@ -1304,6 +1364,10 @@ def do_sync(args, mode="sync", must_be_active=1):
pass pass
pass pass
pass pass
if post_process:
trace_post(link2trace)
pass
pass pass
pass pass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment