def report(app, sumTime):

    header = get_phome()

    worksheet1 = workbook.add_worksheet("性能监控")
    app["maxMen"] = BaseAnalysis.maxMen(BaseMonitor.men)
    app["avgMen"] = BaseAnalysis.avgMen(men=BaseMonitor.men,
                                        total=header["rom"])
    app["maxCpu"] = BaseAnalysis.maxCpu(BaseMonitor.cpu)
    app["avgCpu"] = BaseAnalysis.avgCpu(BaseMonitor.cpu)
    app["maxFps"] = BaseAnalysis.avgFps(BaseMonitor.fps)
    app["avgFps"] = BaseAnalysis.avgFps(BaseMonitor.fps)
    app["afterBattery"] = BaseMonitor.get_battery()
    _maxFlow = BaseAnalysis.maxFlow(BaseMonitor.flow)
    _avgFLow = BaseAnalysis.avgFlow(BaseMonitor.flow)
    app["maxFlowUp"] = _maxFlow[0]
    app["maxFlowDown"] = _maxFlow[1]
    app["avgFlowUp"] = _avgFLow[0]
    app["avgFlowDown"] = _avgFLow[1]
    header["time"] = sumTime
    header["net"] = app["net"]
    bo.monitor(worksheet=worksheet1, header=header, data=app)
    print("---monkey_log------")
    print(app["monkey_log"])
    get_error(log=app["monkey_log"])

    worksheet3 = workbook.add_worksheet("详细信息")
    app = {}
    app["cpu"] = BaseMonitor.cpu
    app["men"] = BaseMonitor.men
    app["flow"] = BaseMonitor.flow
    app["battery"] = BaseMonitor.battery
    app["fps"] = BaseMonitor.fps
    bo.analysis(worksheet3, app)
示例#2
0
    def monitor(self, info):
        worksheet = self.wd.add_worksheet("性能数据详情")
        worksheet.set_column("A:A", 20)
        worksheet.set_column("B:B", 10)
        worksheet.set_column("C:C", 10)
        worksheet.set_column("D:D", 10)
        worksheet.set_column("E:E", 10)
        worksheet.set_column("F:F", 10)
        worksheet.set_column("G:G", 10)
        worksheet.set_column("H:H", 10)
        worksheet.set_column("I:I", 10)
        worksheet.set_column("J:J", 10)
        worksheet.set_column("K:K", 10)
        worksheet.set_column("L:L", 10)
        worksheet.set_column("L:L", 10)
        worksheet.set_column("M:M", 12)
        worksheet.set_column("N:N", 12)
        worksheet.set_column("O:O", 12)
        worksheet.set_column("P:P", 12)
        worksheet.set_column("Q:Q", 12)
        worksheet.set_column("R:R", 12)

        worksheet.set_row(1, 30)
        worksheet.set_row(2, 30)
        worksheet.set_row(3, 30)
        worksheet.set_row(4, 30)
        worksheet.set_row(5, 30)
        worksheet.set_row(6, 30)
        worksheet.set_row(7, 30)
        worksheet.set_row(8, 30)
        worksheet.set_row(9, 30)
        worksheet.set_row(10, 30)
        worksheet.set_row(11, 30)
        worksheet.set_row(12, 30)

        define_format_H1 = get_format(self.wd, {'bold': True, 'font_size': 18})
        define_format_H2 = get_format(self.wd, {'bold': True, 'font_size': 14})
        define_format_H1.set_border(1)

        define_format_H2.set_border(1)
        define_format_H1.set_align("center")
        define_format_H2.set_align("center")
        define_format_H2.set_bg_color("blue")
        define_format_H2.set_color("#ffffff")
        worksheet.merge_range('A1:R1', 'monkey性能监控', define_format_H1)
        _write_center(worksheet, "A2", '设备名', self.wd)
        _write_center(worksheet, "B2", 'CPU', self.wd)
        _write_center(worksheet, "C2", '内存', self.wd)
        _write_center(worksheet, "D2", '分辨率', self.wd)
        _write_center(worksheet, "E2", '网络', self.wd)
        _write_center(worksheet, "F2", "耗时", self.wd)
        _write_center(worksheet, "G2", "CPU峰值", self.wd)
        _write_center(worksheet, "H2", "CPU均值", self.wd)
        _write_center(worksheet, "I2", "内存峰值", self.wd)
        _write_center(worksheet, "J2", "内存均值", self.wd)
        _write_center(worksheet, "K2", "fps峰值", self.wd)
        _write_center(worksheet, "L2", "fps均值", self.wd)
        _write_center(worksheet, "M2", "电量测试之前", self.wd)
        _write_center(worksheet, "N2", "电量测试之后", self.wd)
        _write_center(worksheet, "O2", "上行流量峰值", self.wd)
        _write_center(worksheet, "P2", "上行流量均值", self.wd)
        _write_center(worksheet, "Q2", "下行流量峰值", self.wd)
        _write_center(worksheet, "R2", "下行流量均值", self.wd)

        temp = 3
        for t in info:
            for wrap in t:
                for item in t[wrap]:
                    self.getCrashMsg(t[wrap]["header"]["monkey_log"])
                    _write_center(worksheet, "A" + str(temp),
                                  t[wrap]["header"]["phone_name"], self.wd)
                    _write_center(worksheet, "B" + str(temp),
                                  t[wrap]["header"]["kel"], self.wd)
                    _write_center(
                        worksheet, "C" + str(temp),
                        str(math.ceil(t[wrap]["header"]["rom"] / 1024)) + "M",
                        self.wd)
                    _write_center(worksheet, "D" + str(temp),
                                  t[wrap]["header"]["pix"], self.wd)
                    _write_center(worksheet, "E" + str(temp),
                                  t[wrap]["header"]["net"], self.wd)
                    _write_center(worksheet, "F" + str(temp),
                                  t[wrap]["header"]["time"], self.wd)

                    cpu = readInfo(t[wrap]["cpu"])
                    men = readInfo(t[wrap]["men"])
                    fps = readInfo(t[wrap]["fps"])
                    flow = readInfo(t[wrap]["flow"])
                    print("----wrap-----")
                    print(flow)
                    _write_center(worksheet, "G" + str(temp),
                                  BaseAnalysis.maxCpu(cpu), self.wd)
                    _write_center(worksheet, "H" + str(temp),
                                  BaseAnalysis.avgCpu(cpu), self.wd)
                    _write_center(worksheet, "I" + str(temp),
                                  BaseAnalysis.maxMen(men), self.wd)
                    _write_center(
                        worksheet, "J" + str(temp),
                        BaseAnalysis.avgMen(men, t[wrap]["header"]["rom"]),
                        self.wd)
                    _write_center(worksheet, "K" + str(temp),
                                  BaseAnalysis.maxFps(fps), self.wd)
                    _write_center(worksheet, "L" + str(temp),
                                  BaseAnalysis.avgFps(fps), self.wd)
                    _write_center(worksheet, "M" + str(temp),
                                  t[wrap]["header"]["beforeBattery"], self.wd)
                    _write_center(worksheet, "N" + str(temp),
                                  t[wrap]["header"]["afterBattery"], self.wd)

                    _maxFlow = BaseAnalysis.maxFlow(flow)
                    _avgFLow = BaseAnalysis.avgFlow(flow)
                    print("-----_maxFlow----------")
                    print(_maxFlow)
                    _write_center(worksheet, "O" + str(temp), _maxFlow[0],
                                  self.wd)
                    _write_center(worksheet, "Q" + str(temp), _maxFlow[1],
                                  self.wd)
                    _write_center(worksheet, "P" + str(temp), _avgFLow[0],
                                  self.wd)
                    _write_center(worksheet, "R" + str(temp), _avgFLow[1],
                                  self.wd)

                    break
                temp = temp + 1
示例#3
0
    def monitor(self, info):
        worksheet = self.wd.add_worksheet("Analysis")
        worksheet.set_column("A:A", 15)
        worksheet.set_column("B:B", 10)
        worksheet.set_column("C:C", 10)
        worksheet.set_column("D:D", 10)
        worksheet.set_column("E:E", 10)
        worksheet.set_column("F:F", 10)
        worksheet.set_column("G:G", 10)
        worksheet.set_column("H:H", 10)
        worksheet.set_column("I:I", 10)
        worksheet.set_column("J:J", 10)
        worksheet.set_column("K:K", 10)
        worksheet.set_column("L:L", 10)
        worksheet.set_column("L:L", 10)
        worksheet.set_column("M:M", 10)
        worksheet.set_column("N:N", 10)
        worksheet.set_column("O:O", 10)
        worksheet.set_column("P:P", 10)
        worksheet.set_column("Q:Q", 10)
        worksheet.set_column("R:R", 10)

        worksheet.set_row(1, 30)
        worksheet.set_row(2, 30)
        worksheet.set_row(3, 30)
        worksheet.set_row(4, 30)
        worksheet.set_row(5, 30)
        worksheet.set_row(6, 30)
        worksheet.set_row(7, 30)
        worksheet.set_row(8, 30)
        worksheet.set_row(9, 30)
        worksheet.set_row(10, 30)
        worksheet.set_row(11, 30)
        worksheet.set_row(12, 30)

        define_format_H1 = get_format(self.wd, {'bold': True, 'font_size': 18})
        define_format_H2 = get_format(self.wd, {'bold': True, 'font_size': 14})
        define_format_H1.set_border(1)

        define_format_H2.set_border(1)
        define_format_H1.set_align("center")
        define_format_H2.set_align("center")
        define_format_H2.set_bg_color("blue")
        define_format_H2.set_color("#ffffff")
        worksheet.merge_range('A1:L1', 'monkey性能监控', define_format_H1)
        _write_center(worksheet, "A2", '设备名', self.wd)
        _write_center(worksheet, "B2", 'CPU', self.wd)
        _write_center(worksheet, "C2", '内存', self.wd)
        _write_center(worksheet, "D2", '分辨率', self.wd)
        _write_center(worksheet, "E2", '网络', self.wd)
        _write_center(worksheet, "F2", "耗时", self.wd)
        _write_center(worksheet, "G2", "CPU峰值", self.wd)
        _write_center(worksheet, "H2", "CPU均值", self.wd)
        _write_center(worksheet, "I2", "内存峰值", self.wd)
        _write_center(worksheet, "J2", "内存均值", self.wd)
        _write_center(worksheet, "K2", "fps峰值", self.wd)
        _write_center(worksheet, "L2", "fps均值", self.wd)
        _write_center(worksheet, "M2", "电量测试之前", self.wd)
        _write_center(worksheet, "N2", "电量测试之后", self.wd)
        _write_center(worksheet, "O2", "上行流量峰值", self.wd)
        _write_center(worksheet, "P2", "上行流量均值", self.wd)
        _write_center(worksheet, "Q2", "下行流量峰值", self.wd)
        _write_center(worksheet, "R2", "下行流量均值", self.wd)


        temp = 3
        for t in info:
            for wrap in t:
                for item in t[wrap]:
                    self.getCrashMsg(t[wrap]["header"]["monkey_log"])
                    _write_center(worksheet, "A" + str(temp), t[wrap]["header"]["phone_name"], self.wd)
                    _write_center(worksheet, "B" + str(temp), t[wrap]["header"]["kel"], self.wd)
                    _write_center(worksheet, "C" + str(temp), str(math.ceil(t[wrap]["header"]["rom"] / 1024)) + "M", self.wd)
                    _write_center(worksheet, "D" + str(temp), t[wrap]["header"]["pix"], self.wd)
                    _write_center(worksheet, "E" + str(temp), t[wrap]["header"]["net"], self.wd)
                    _write_center(worksheet, "F" + str(temp), t[wrap]["header"]["time"], self.wd)

                    cpu = readInfo(t[wrap]["cpu"])
                    men = readInfo(t[wrap]["men"])
                    fps = readInfo(t[wrap]["fps"])
                    flow = readInfo(t[wrap]["flow"])
                    print("----wrap-----")
                    print(flow)
                    _write_center(worksheet, "G" + str(temp), BaseAnalysis.maxCpu(cpu), self.wd)
                    _write_center(worksheet, "H" + str(temp), BaseAnalysis.avgCpu(cpu), self.wd)
                    _write_center(worksheet, "I" + str(temp), BaseAnalysis.maxMen(men), self.wd)
                    _write_center(worksheet, "J" + str(temp), BaseAnalysis.avgMen(men, t[wrap]["header"]["rom"]), self.wd)
                    _write_center(worksheet, "K" + str(temp), BaseAnalysis.maxFps(fps), self.wd)
                    _write_center(worksheet, "L" + str(temp), BaseAnalysis.avgFps(fps), self.wd)
                    _write_center(worksheet, "M" + str(temp), t[wrap]["header"]["beforeBattery"], self.wd)
                    _write_center(worksheet, "N" + str(temp), t[wrap]["header"]["afterBattery"], self.wd)

                    _maxFlow = BaseAnalysis.maxFlow(flow)
                    _avgFLow = BaseAnalysis.avgFlow(flow)
                    print("-----_maxFlow----------")
                    print(_maxFlow)
                    _write_center(worksheet, "O" + str(temp), _maxFlow[0], self.wd)
                    _write_center(worksheet, "Q" + str(temp), _maxFlow[1], self.wd)
                    _write_center(worksheet, "P" + str(temp), _avgFLow[1], self.wd)
                    _write_center(worksheet, "R" + str(temp), _avgFLow[1], self.wd)

                    break
                temp = temp + 1