当前位置: 首页>>代码示例>>Python>>正文


Python KPISet.merge_kpis方法代码示例

本文整理汇总了Python中bzt.modules.aggregator.KPISet.merge_kpis方法的典型用法代码示例。如果您正苦于以下问题:Python KPISet.merge_kpis方法的具体用法?Python KPISet.merge_kpis怎么用?Python KPISet.merge_kpis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bzt.modules.aggregator.KPISet的用法示例。


在下文中一共展示了KPISet.merge_kpis方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: point_from_locust

# 需要导入模块: from bzt.modules.aggregator import KPISet [as 别名]
# 或者: from bzt.modules.aggregator.KPISet import merge_kpis [as 别名]
    def point_from_locust(self, ts, sid, data):
        """
        :type sid: str
        :type ts: str
        :type data: dict
        :rtype: DataPoint
        """
        point = DataPoint(int(ts))
        point[DataPoint.SOURCE_ID] = sid
        overall = KPISet()
        for item in data['stats']:
            if ts not in item['num_reqs_per_sec']:
                continue

            kpiset = KPISet()
            kpiset[KPISet.SAMPLE_COUNT] = item['num_reqs_per_sec'][ts]
            kpiset[KPISet.CONCURRENCY] = data['user_count']
            if item['num_requests']:
                avg_rt = (item['total_response_time'] / 1000.0) / item['num_requests']
                kpiset.sum_rt = item['num_reqs_per_sec'][ts] * avg_rt
            point[DataPoint.CURRENT][item['name']] = kpiset
            overall.merge_kpis(kpiset)

        point[DataPoint.CURRENT][''] = overall
        point.recalculate()
        return point
开发者ID:mukteshkrmishra,项目名称:taurus,代码行数:28,代码来源:locustio.py

示例2: point_from_locust

# 需要导入模块: from bzt.modules.aggregator import KPISet [as 别名]
# 或者: from bzt.modules.aggregator.KPISet import merge_kpis [as 别名]
    def point_from_locust(timestamp, sid, data):
        """
        :type timestamp: str
        :type sid: str
        :type data: dict
        :rtype: DataPoint
        """
        point = DataPoint(int(timestamp))
        point[DataPoint.SOURCE_ID] = sid
        overall = KPISet()
        for item in data['stats']:
            if timestamp not in item['num_reqs_per_sec']:
                continue

            kpiset = KPISet()
            kpiset[KPISet.SAMPLE_COUNT] = item['num_reqs_per_sec'][timestamp]
            kpiset[KPISet.CONCURRENCY] = data['user_count']
            kpiset[KPISet.BYTE_COUNT] = item['total_content_length']
            if item['num_requests']:
                avg_rt = (item['total_response_time'] / 1000.0) / item['num_requests']
                kpiset.sum_rt = item['num_reqs_per_sec'][timestamp] * avg_rt

            for err in data['errors'].values():
                if err['name'] == item['name']:
                    new_err = KPISet.error_item_skel(err['error'], None, err['occurences'], KPISet.ERRTYPE_ERROR,
                                                     Counter())
                    KPISet.inc_list(kpiset[KPISet.ERRORS], ("msg", err['error']), new_err)
                    kpiset[KPISet.FAILURES] += err['occurences']

            point[DataPoint.CURRENT][item['name']] = kpiset
            overall.merge_kpis(kpiset)

        point[DataPoint.CURRENT][''] = overall
        point.recalculate()
        return point
开发者ID:keithmork,项目名称:taurus,代码行数:37,代码来源:locustio.py


注:本文中的bzt.modules.aggregator.KPISet.merge_kpis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。