def __init__(self, agent, _connection):
		self.agent = agent
		self._connection = _connection
		self._readsnap = libweb100.web100_snapshot_alloc(agent._read_group, _connection)
		if self._readsnap == None:
			libweb100_err()
		self._tunesnap = libweb100.web100_snapshot_alloc(agent._tune_group, _connection)
		if self._tunesnap == None:
			libweb100_err()
		self.cid = libweb100.web100_get_connection_cid(_connection)
Beispiel #2
0
 def __init__(self, agent, _connection):
     self.agent = agent
     self._connection = _connection
     self._readsnap = libweb100.web100_snapshot_alloc(
         agent._read_group, _connection)
     if self._readsnap == None:
         libweb100_err()
     self._tunesnap = libweb100.web100_snapshot_alloc(
         agent._tune_group, _connection)
     if self._tunesnap == None:
         libweb100_err()
     self.cid = libweb100.web100_get_connection_cid(_connection)
Beispiel #3
0
def read_stats(lbase):
    """
    Read previously saved test results written by write_stats
    """
    global ag, allRuns

# Open the logs with the appropriate tools 
    logf =  open(lbase + ".ctrl", 'r')
    vlog = libweb100.web100_log_open_read(lbase + ".log")
    ag = libweb100.web100_get_log_agent(vlog)
    cvar.gread  = libweb100.web100_get_log_group(vlog)
    cvar.conn = libweb100.web100_get_log_connection(vlog)

# parse test prameters (first line)
    firstline = logf.readline().split(' ')

    # old format always started with a digit
    if firstline[0].isdigit():
	return(old_read_stats(firstline, logf, vlog))

    if firstline[0] != "version":
	raise "malformed ctrl file version"
    fver = firstline[1]
    ev,ar={},[]
    # new format is keyword driven
    for line in logf.readlines():
	w=line.split()
	name = w[0]
	if w[1] == "event_str":
	    ev[name] = " ".join(w[2:])
	elif w[1] == "event_int":
	    ev[name] = int(w[2])
	elif w[1] == "event_long":
	    ev[name] = long(w[2])
	elif w[1] == "event_float":
	    ev[name] = float(w[2])
	elif w[1] == "event_row":
	    ev[name] = ar[int(w[2])]
	elif w[1] == "event_other":
	    ev[name] = None	# XXX - not supported
	elif w[1] == "20050126":
	    c=parse_tctrl_20050126(2, w)
	    s = libweb100.web100_snapshot_alloc( cvar.gread, cvar.conn )
	    libweb100.web100_snap_from_log(s, vlog)
	    d={}
	    d["tctrl"]=c
	    d["rawsnap"]=s
	    ar.append( d )
	else:
	    raise "unknown .ctrl line: "+w[1]
    allRuns=ar
    return ev,ar
Beispiel #4
0
def read_stats(lbase):
    """
    Read previously saved test results written by write_stats
    """
    global ag, allRuns

    # Open the logs with the appropriate tools
    logf = open(lbase + ".ctrl", 'r')
    vlog = libweb100.web100_log_open_read(lbase + ".log")
    ag = libweb100.web100_get_log_agent(vlog)
    cvar.gread = libweb100.web100_get_log_group(vlog)
    cvar.conn = libweb100.web100_get_log_connection(vlog)

    # parse test prameters (first line)
    firstline = logf.readline().split(' ')

    # old format always started with a digit
    if firstline[0].isdigit():
        return (old_read_stats(firstline, logf, vlog))

    if firstline[0] != "version":
        raise "malformed ctrl file version"
    fver = firstline[1]
    ev, ar = {}, []
    # new format is keyword driven
    for line in logf.readlines():
        w = line.split()
        name = w[0]
        if w[1] == "event_str":
            ev[name] = " ".join(w[2:])
        elif w[1] == "event_int":
            ev[name] = int(w[2])
        elif w[1] == "event_long":
            ev[name] = long(w[2])
        elif w[1] == "event_float":
            ev[name] = float(w[2])
        elif w[1] == "event_row":
            ev[name] = ar[int(w[2])]
        elif w[1] == "event_other":
            ev[name] = None  # XXX - not supported
        elif w[1] == "20050126":
            c = parse_tctrl_20050126(2, w)
            s = libweb100.web100_snapshot_alloc(cvar.gread, cvar.conn)
            libweb100.web100_snap_from_log(s, vlog)
            d = {}
            d["tctrl"] = c
            d["rawsnap"] = s
            ar.append(d)
        else:
            raise "unknown .ctrl line: " + w[1]
    allRuns = ar
    return ev, ar
Beispiel #5
0
def old_read_stats(firstline, logf, vlog):
    """
    Read old logfiles,
    note that this is not verbatum old code
    """
    global allRuns
    ev,rr={},[] # return result (deprecated)
    for w in firstline:
	if w.isdigit():
	    rr.append(int(w))
    ev["target_rate"] = rr[0]
    ev["target_rtt"] = rr[1]

# parse control parameters and web100 snaps in tandom for individual tests
    ar = [] # scan result
    for l in logf:
        w=l.split(' ')
        if w[0:3] == [ "10", "20050126", ":" ] and len(w) == 15:
	    c = parse_tctrl_20050126(3, w)
        elif w[0:3] == [ "10", "20040330", ":" ] and len(w) == 13:
	    raise "deprecate this format"	# XXX nuke (all of) this
            c = tctrl()
            i=3
            i, c.flag = i+1, int(w[i])
            i, c.basemss = i+1, int(w[i])
            i, c.win = i+1, int(w[i])
            i, c.burstwin = i+1, int(w[i])
            i, c.duration = i+1, int(w[i])
            i, c.obswin = i+1, int(w[i])
            i, c.SSbursts = i+1, int(w[i])
            i, c.SSbully = i+1, int(w[i])
            i, c.SSsumAwnd = i+1, int(w[i])
            i, c.SScntAwnd = i+1, int(w[i])
            i, c.SSpoll = i+1, -1 
            i, c.SSbullyStall = i+1, -1 # reordered
	    if (i != SizeOfTctrl):
		raise "missaligned format error"
	else:
	    print len(w), w
            raise "format error"
        s = libweb100.web100_snapshot_alloc( cvar.gread, cvar.conn )
        libweb100.web100_snap_from_log(s, vlog)
	d={}
	d["tctrl"]=c
	d["rawsnap"]=s
        ar.append( d )
    allRuns=ar
    return ev,ar
Beispiel #6
0
def old_read_stats(firstline, logf, vlog):
    """
    Read old logfiles,
    note that this is not verbatum old code
    """
    global allRuns
    ev, rr = {}, []  # return result (deprecated)
    for w in firstline:
        if w.isdigit():
            rr.append(int(w))
    ev["target_rate"] = rr[0]
    ev["target_rtt"] = rr[1]

    # parse control parameters and web100 snaps in tandom for individual tests
    ar = []  # scan result
    for l in logf:
        w = l.split(' ')
        if w[0:3] == ["10", "20050126", ":"] and len(w) == 15:
            c = parse_tctrl_20050126(3, w)
        elif w[0:3] == ["10", "20040330", ":"] and len(w) == 13:
            raise "deprecate this format"  # XXX nuke (all of) this
            c = tctrl()
            i = 3
            i, c.flag = i + 1, int(w[i])
            i, c.basemss = i + 1, int(w[i])
            i, c.win = i + 1, int(w[i])
            i, c.burstwin = i + 1, int(w[i])
            i, c.duration = i + 1, int(w[i])
            i, c.obswin = i + 1, int(w[i])
            i, c.SSbursts = i + 1, int(w[i])
            i, c.SSbully = i + 1, int(w[i])
            i, c.SSsumAwnd = i + 1, int(w[i])
            i, c.SScntAwnd = i + 1, int(w[i])
            i, c.SSpoll = i + 1, -1
            i, c.SSbullyStall = i + 1, -1  # reordered
            if (i != SizeOfTctrl):
                raise "missaligned format error"
        else:
            print len(w), w
            raise "format error"
        s = libweb100.web100_snapshot_alloc(cvar.gread, cvar.conn)
        libweb100.web100_snap_from_log(s, vlog)
        d = {}
        d["tctrl"] = c
        d["rawsnap"] = s
        ar.append(d)
    allRuns = ar
    return ev, ar
Beispiel #7
0
def init_elapsed_sample(ctl):
    """
    Gather the "zeroth" data sample,
    from the current state of the connection

    All samples (including this one) are archived in cronological order in allRuns.
    """
    global ns, rowcount, allRuns
    ns = libweb100.web100_snapshot_alloc(cvar.gread, cvar.conn)
    libweb100.web100_snap(ns)
    r={}
    r["tctrl"]=ctl
    r["rawsnap"]=ns
    r.update(mkdict(ctl, ns, None))
    r["row"] = rowcount
    rowcount += 1
    allRuns.append(r)
    cvar.baseMSS = r["CurMSS"]
Beispiel #8
0
def init_elapsed_sample(ctl):
    """
    Gather the "zeroth" data sample,
    from the current state of the connection

    All samples (including this one) are archived in cronological order in allRuns.
    """
    global ns, rowcount, allRuns
    ns = libweb100.web100_snapshot_alloc(cvar.gread, cvar.conn)
    libweb100.web100_snap(ns)
    r = {}
    r["tctrl"] = ctl
    r["rawsnap"] = ns
    r.update(mkdict(ctl, ns, None))
    r["row"] = rowcount
    rowcount += 1
    allRuns.append(r)
    cvar.baseMSS = r["CurMSS"]