コード例 #1
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_visibility(self, label, values):
        """
        Expects a time series in the form of:

            (writer, version, percent visible, created, updated)

        Returns the average visibility of all the writes as well as the
        number of partially visible writes.
        """
        accesses = defaultdict(float)
        delays   = defaultdict(int)
        for val in values:
            if val[2] > accesses[val[1]]:
                accesses[val[1]] = val[2]

            if val[4] > delays[(val[1], val[3])]:
                delays[(val[1], val[3])] = val[4]

        return {
            'mean visibility': mean(accesses.values()),
            'partially visible writes': sum(1 for pcent in accesses.values() if pcent < 1.0),
            'mean partial visibility latency (ms)': mean(
                val - key[1] for key, val in delays.items()
            )
        }
コード例 #2
0
    def handle_visibility(self, label, values):
        """
        Expects a time series in the form of:

            (writer, version, percent visible, created, updated)

        Returns the average visibility of all the writes as well as the
        number of partially visible writes.
        """
        accesses = defaultdict(float)
        delays = defaultdict(int)
        for val in values:
            if val[2] > accesses[val[1]]:
                accesses[val[1]] = val[2]

            if val[4] > delays[(val[1], val[3])]:
                delays[(val[1], val[3])] = val[4]

        return {
            'mean visibility':
            mean(accesses.values()),
            'partially visible writes':
            sum(1 for pcent in accesses.values() if pcent < 1.0),
            'mean partial visibility latency (ms)':
            mean(val - key[1] for key, val in delays.items())
        }
コード例 #3
0
ファイル: traces.py プロジェクト: bbengfort/cloudscope
    def write(self, fobj):
        """
        Writes out a complete trace to the passed in file-like object.
        Returns the number of rows written the the file.
        """
        # Counts for the trace being written.
        counts = Counter()
        replicas = defaultdict(Counter)
        max_time_step = 0

        for idx, access in enumerate(self):
            # Count the number of rows
            counts['rows'] += 1

            # Count the number of access types
            if access.method == READ: counts['reads'] += 1
            if access.method == WRITE: counts['writes'] += 1

            # Count the number of objects and replicas
            replicas[access.replica][access.object] += 1

            # Determine the maximum timestep
            if int(access.timestep) > max_time_step:
                max_time_step = int(access.timestep)

            # Write the objec to disk
            fobj.write("\t".join(access) + "\n")

        # Update the counts with globals
        counts["objects"] = len(set([
            key
            for replica in replicas.keys()
            for key in
            replicas[replica].keys()
        ]))
        counts["devices"] = len(replicas.keys())
        counts["timesteps"] = max_time_step
        counts["realtime"] = humanizedelta(milliseconds=max_time_step)
        counts["mean_objects_per_device"] = int(mean([
            len(objects.keys()) for objects in replicas.values()
        ]))
        counts["mean_accesses_per_device"] = int(mean([
            sum(objects.values()) for objects in replicas.values()
        ]))
        counts["mean_accesses_per_object"] = int(mean([
            count
            for objects in replicas.values()
            for count in objects.values()
        ]))
        counts["mean_devices_per_object"] = int(mean([
            sum(1 if name in objects.keys() else 0 for objects in replicas.values())
            for name in set([
                key
                for values in replicas.values()
                for key in values.keys()
            ])
        ]))

        return counts
コード例 #4
0
ファイル: traces.py プロジェクト: bbengfort/cloudscope
    def write(self, fobj):
        """
        Writes out a complete trace to the passed in file-like object.
        Returns the number of rows written the the file.
        """
        # Counts for the trace being written.
        counts = Counter()
        replicas = defaultdict(Counter)
        max_time_step = 0

        for idx, access in enumerate(self):
            # Count the number of rows
            counts['rows'] += 1

            # Count the number of access types
            if access.method == READ: counts['reads'] += 1
            if access.method == WRITE: counts['writes'] += 1

            # Count the number of objects and replicas
            replicas[access.replica][access.object] += 1

            # Determine the maximum timestep
            if int(access.timestep) > max_time_step:
                max_time_step = int(access.timestep)

            # Write the objec to disk
            fobj.write("\t".join(access) + "\n")

        # Update the counts with globals
        counts["objects"] = len(
            set([
                key for replica in replicas.keys()
                for key in replicas[replica].keys()
            ]))
        counts["devices"] = len(replicas.keys())
        counts["timesteps"] = max_time_step
        counts["realtime"] = humanizedelta(milliseconds=max_time_step)
        counts["mean_objects_per_device"] = int(
            mean([len(objects.keys()) for objects in replicas.values()]))
        counts["mean_accesses_per_device"] = int(
            mean([sum(objects.values()) for objects in replicas.values()]))
        counts["mean_accesses_per_object"] = int(
            mean([
                count for objects in replicas.values()
                for count in objects.values()
            ]))
        counts["mean_devices_per_object"] = int(
            mean([
                sum(1 if name in objects.keys() else 0
                    for objects in replicas.values()) for name in set([
                        key for values in replicas.values()
                        for key in values.keys()
                    ])
            ]))

        return counts
コード例 #5
0
    def handle_stale_writes(self, label, values):
        """
        Expects a time series in the form of:

            (owner, timestamp, created, latest version, read version)

        Returns the number of stale writes, mean time, and version staleness.
        """
        time_stale = [v[1] - v[2] for v in values]
        vers_stale = [v[3] - v[4] for v in values]

        return {
            label: len(values),
            "cumulative write time staleness (ms)": sum(time_stale),
            "mean write time staleness (ms)": mean(time_stale),
            "mean write version staleness": mean(vers_stale),
        }
コード例 #6
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_stale_writes(self, label, values):
        """
        Expects a time series in the form of:

            (owner, timestamp, created, latest version, read version)

        Returns the number of stale writes, mean time, and version staleness.
        """
        time_stale = [v[1] - v[2] for v in values]
        vers_stale = [v[3] - v[4] for v in values]

        return {
            label: len(values),
            "cumulative write time staleness (ms)": sum(time_stale),
            "mean write time staleness (ms)": mean(time_stale),
            "mean write version staleness": mean(vers_stale),
        }
コード例 #7
0
    def handle_tag_size(self, label, values):
        """
        Expects a time series in the form of:

            (replica, timestamp, tag size)

        Returns the mean tag size
        """
        return {
            "average tag size": mean(v[2] for v in values),
        }
コード例 #8
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_tag_size(self, label, values):
        """
        Expects a time series in the form of:

            (replica, timestamp, tag size)

        Returns the mean tag size
        """
        return {
            "average tag size": mean(v[2] for v in values),
        }
コード例 #9
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_missed_read_latency(self, label, values):
        """
        Expects a time series in the form of:

            (owner, version, started, finished)

        Returns the mean read missed latency
        """
        return {
            "mean missed read latency (ms)": mean(v[3] - v[2] for v in values),
        }
コード例 #10
0
    def handle_missed_read_latency(self, label, values):
        """
        Expects a time series in the form of:

            (owner, version, started, finished)

        Returns the mean read missed latency
        """
        return {
            "mean missed read latency (ms)": mean(v[3] - v[2] for v in values),
        }
コード例 #11
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_dropped_write_latency(self, label, values):
        """
        Expects a time series in the form of:

            (owner, version, started, finished)

        Returns the mean dropped write latency
        """
        return {
            "mean dropped write latency (ms)": mean(v[3] - v[2] for v in values),
        }
コード例 #12
0
    def handle_read_latency(self, label, values):
        """
        Expects a time series in the form of:

            (owner, version, started, finished)

        Returns the mean read latency and the number of completed reads
        """
        return {
            "completed reads": len(values),
            "mean read latency (ms)": mean(v[3] - v[2] for v in values),
        }
コード例 #13
0
    def handle_recv(self, label, values):
        """
        Expects a time series in the form of:

            (target, source, recv at, message type, delay)

        Returns the number of received messages and the average dleay
        """
        return {
            label: len(values),
            "mean message latency (ms)": mean(v[4] for v in values),
        }
コード例 #14
0
    def handle_session_length(self, label, values):
        """
        Expects a time series in the form of:

            (replica, duration)

        Returns the mean duration and the number of sessions
        """
        return {
            "sessions": len(values),
            "mean session duration (ms)": mean(v[1] for v in values),
        }
コード例 #15
0
    def handle_dropped_write_latency(self, label, values):
        """
        Expects a time series in the form of:

            (owner, version, started, finished)

        Returns the mean dropped write latency
        """
        return {
            "mean dropped write latency (ms)":
            mean(v[3] - v[2] for v in values),
        }
コード例 #16
0
    def handle_write_latency(self, label, values):
        """
        Expects a time series in the form of:

            (replica, version, started, finished)

        Returns the mean write latency and the number of completed writes
        """
        return {
            "completed writes": len(values),
            "mean write latency (ms)": mean(v[3] - v[2] for v in values),
        }
コード例 #17
0
    def handle_commit_latency(self, label, values):
        """
        Expects a time series in the form of:

            (replica, version, created, updated)

        Returns the mean time delta and the number of committed writes
        """
        return {
            "mean commit latency (ms)": mean(v[3] - v[2] for v in values),
            "committed writes": len(set([v[1] for v in values])),
        }
コード例 #18
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_commit_latency(self, label, values):
        """
        Expects a time series in the form of:

            (replica, version, created, updated)

        Returns the mean time delta and the number of committed writes
        """
        return {
            "mean commit latency (ms)": mean(v[3] - v[2] for v in values),
            "committed writes": len(set([v[1] for v in values])),
        }
コード例 #19
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_read_latency(self, label, values):
        """
        Expects a time series in the form of:

            (owner, version, started, finished)

        Returns the mean read latency and the number of completed reads
        """
        return {
            "completed reads": len(values),
            "mean read latency (ms)": mean(v[3] - v[2] for v in values),
        }
コード例 #20
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_recv(self, label, values):
        """
        Expects a time series in the form of:

            (target, source, recv at, message type, delay)

        Returns the number of received messages and the average dleay
        """
        return {
            label: len(values),
            "mean message latency (ms)": mean(v[4] for v in values),
        }
コード例 #21
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_session_length(self, label, values):
        """
        Expects a time series in the form of:

            (replica, duration)

        Returns the mean duration and the number of sessions
        """
        return {
            "sessions": len(values),
            "mean session duration (ms)": mean(v[1] for v in values),
        }
コード例 #22
0
ファイル: analysis.py プロジェクト: bbengfort/cloudscope
    def handle_write_latency(self, label, values):
        """
        Expects a time series in the form of:

            (replica, version, started, finished)

        Returns the mean write latency and the number of completed writes
        """
        return {
            "completed writes": len(values),
            "mean write latency (ms)": mean(v[3] - v[2] for v in values),
        }