Ejemplo n.º 1
0
	def readall(self):
		"""Take a snapshot of all variables from a connection.
		
		This is much more efficient than reading all variables
		individually.  Currently, for local agents, it also guarantees
		consistency between all read-only variables.
		"""
		
		if libweb100.web100_snap(self._readsnap) != libweb100.WEB100_ERR_SUCCESS:
			libweb100_err()
		if libweb100.web100_snap(self._tunesnap) != libweb100.WEB100_ERR_SUCCESS:
			libweb100_err()
		snap = {}
		for (name, var) in self.agent.read_vars.items():
			if var._group == self.agent._read_group:
				if libweb100.web100_snap_read(var._var, self._readsnap, self.agent.bufp) != \
				   libweb100.WEB100_ERR_SUCCESS:
					libweb100_err()
			else:
				if libweb100.web100_snap_read(var._var, self._tunesnap, self.agent.bufp) != \
				   libweb100.WEB100_ERR_SUCCESS:
					libweb100_err()
			val = var.val(self.agent.bufp)
			snap[name] = val
		return snap
Ejemplo n.º 2
0
    def readall(self):
        """Take a snapshot of all variables from a connection.
		
		This is much more efficient than reading all variables
		individually.  Currently, for local agents, it also guarantees
		consistency between all read-only variables.
		"""

        if libweb100.web100_snap(
                self._readsnap) != libweb100.WEB100_ERR_SUCCESS:
            libweb100_err()
        if libweb100.web100_snap(
                self._tunesnap) != libweb100.WEB100_ERR_SUCCESS:
            libweb100_err()
        snap = {}
        for (name, var) in self.agent.read_vars.items():
            if var._group == self.agent._read_group:
                if libweb100.web100_snap_read(var._var, self._readsnap, self.agent.bufp) != \
                   libweb100.WEB100_ERR_SUCCESS:
                    libweb100_err()
            else:
                if libweb100.web100_snap_read(var._var, self._tunesnap, self.agent.bufp) != \
                   libweb100.WEB100_ERR_SUCCESS:
                    libweb100_err()
            val = var.val(self.agent.bufp)
            snap[name] = val
        return snap
Ejemplo n.º 3
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"]
Ejemplo n.º 4
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"]