Пример #1
0
    def GenStat(self, fn):
        with Cons.MT(fn, print_time=False):
            lap_times = []
            with open(fn) as fo:
                for line in fo.readlines():
                    line = line.rstrip()
                    if len(line) == 0:
                        continue
                    if line.startswith("#"):
                        continue

                    # 4 KiB from /mnt/local-ssd0/ioping-test-data (ext4 /dev/xvdb): request=1 time=219.1 us
                    # 4 KiB from /mnt/local-ssd0/ioping-test-data (ext4 /dev/xvdb): request=394 time=1.51 ms
                    m = re.match(r"(?P<lap_time>(\d|\.)+ (us|ms))", line)
                    if m:
                        lt = m.group("lap_time")
                        if lt.endswith(" us"):
                            lt = float(lt[:-3])
                        elif lt.endswith(" ms"):
                            lt = (float(lt[:-3]) * 1000)
                        lap_times.append(lt)
                        continue

                    raise RuntimeError("Unexpected [%s]" % line)
            #Cons.P(len(lap_times))
            fn_cdf = "%s/%s-cdf" % (_dn_output, os.path.basename(fn))
            self.fns_cdf.append(fn_cdf)
            Stat.GenStat(lap_times, fn_cdf)
Пример #2
0
    def GenStat(self, fn):
        with Cons.MT(fn, print_time=False):
            lap_times = []
            fn0 = "%s/result/%s" % (os.path.dirname(__file__), fn)
            with open(fn0) as fo:
                for line in fo.readlines():
                    line = line.rstrip()
                    if len(line) == 0:
                        continue

                    # 4 KiB from /mnt/local-ssd0/ioping-test-data (ext4 /dev/xvdb): request=1 time=219.1 us
                    # 4 KiB from /mnt/local-ssd0/ioping-test-data (ext4 /dev/xvdb): request=394 time=1.51 ms
                    m = re.match(
                        r"4 KiB from /mnt/.+/ioping-test-data \(ext4 /dev/xvd.\): request=\d+ time=(?P<lap_time>(\d|\.)+ (us|ms))",
                        line)
                    if m:
                        lt = m.group("lap_time")
                        if lt.endswith(" us"):
                            lt = float(lt[:-3])
                        elif lt.endswith(" ms"):
                            lt = (float(lt[:-3]) * 1000)
                        lap_times.append(lt)
                        continue

                    # --- /mnt/local-ssd0/ioping-test-data (ext4 /dev/xvdb) ioping statistics ---
                    if re.match(
                            r"--- /mnt/.+/ioping-test-data \(ext4 /dev/xvd.\) ioping statistics ---",
                            line):
                        continue

                    # 1 k requests completed in 175.1 ms, 3.91 MiB read, 5.71 k iops, 22.3 MiB/s
                    # 1 k requests completed in 6.06 s, 3.91 MiB read, 164 iops, 659.8 KiB/s
                    if re.match(
                            r"\d+ k requests completed in .+ (min|s|ms|), .+ MiB read, .+ iops, .+ (K|M)iB/s",
                            line):
                        continue

                    # min/avg/max/mdev = 146.9 us / 175.1 us / 1.77 ms / 79.6 us
                    if re.match(
                            r"min/avg/max/mdev = .+ (u|m)s / .+ (u|m)s / .+ (u|m)s / .+ (u|m)s",
                            line):
                        continue

                    raise RuntimeError("Unexpected [%s]" % line)
            #Cons.P(len(lap_times))
            Stat.GenStat(lap_times, "%s/%s-cdf" % (_dn_stat, fn))

            # Throughput in the time order
            fn_time_order = "%s/%s-time-order" % (_dn_stat, fn)
            with open(fn_time_order, "w") as fo:
                for t in lap_times:
                    fo.write("%s\n" % t)
            Cons.P("Created %s %d" %
                   (fn_time_order, os.path.getsize(fn_time_order)))
Пример #3
0
    def GenStat(self, fn):
        with Cons.MT(fn, print_time=False):
            thrp = []
            with open(fn) as fo:
                for line in fo.readlines():
                    line = line.rstrip()
                    if len(line) == 0:
                        continue
                    if line.startswith("#"):
                        continue

                    # 0.348919 s, 192 MB/s
                    m = re.match(r"(?P<lap_time>(\d|\.)+) s, .+", line)
                    if m:
                        thrp.append(64.0 / float(m.group("lap_time")))
                        continue
                    raise RuntimeError("Unexpected %s" % line)
            #Cons.P(len(thrp))
            fn_cdf = "%s/%s-cdf" % (_dn_output, os.path.basename(fn))
            self.fns_cdf.append(fn_cdf)
            Stat.GenStat(thrp, fn_cdf)
Пример #4
0
    def GenStat(self, fn):
        with Cons.MT(fn, print_time=False):
            thrp = []
            fn0 = "%s/result/%s" % (os.path.dirname(__file__), fn)
            with open(fn0) as fo:
                for line in fo.readlines():
                    if line.startswith("1+0 records in"):
                        continue
                    if line.startswith("1+0 records out"):
                        continue
                    if line.startswith("real"):
                        continue
                    if line.startswith("user"):
                        continue
                    if line.startswith("sys"):
                        continue

                    # 134217728 bytes (134 MB) copied, 0.851289 s, 158 MB/s
                    #m = re.match(r"\d+ bytes \(\d+ MB\) copied, (?P<lap_time>(\d|\.)+) s, .+", line)
                    m = re.match(
                        r"134217728 bytes \(134 MB\) copied, (?P<lap_time>(\d|\.)+) s, .+",
                        line)
                    if m:
                        #Cons.P(m.group("lap_time"))
                        thrp.append(128.0 / float(m.group("lap_time")))
                        continue
                    raise RuntimeError("Unexpected %s" % line)
            #Cons.P(len(thrp))
            Stat.GenStat(thrp, "%s/%s-cdf" % (_dn_stat, fn))

            # Throughput in the time order
            fn_time_order = "%s/%s-time-order" % (_dn_stat, fn)
            with open(fn_time_order, "w") as fo:
                for t in thrp:
                    fo.write("%s\n" % t)
            Cons.P("Created %s %d" %
                   (fn_time_order, os.path.getsize(fn_time_order)))