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


Python HdrHistogram.get_percentile_to_value_dict方法代码示例

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


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

示例1: consolidate_results

# 需要导入模块: from hdrh.histogram import HdrHistogram [as 别名]
# 或者: from hdrh.histogram.HdrHistogram import get_percentile_to_value_dict [as 别名]
    def consolidate_results(results):
        all_res = {'tool': 'wrk2'}
        total_count = len(results)
        if not total_count:
            return all_res

        for key in ['http_rps', 'http_total_req', 'http_sock_err',
                    'http_sock_timeout', 'http_throughput_kbytes']:
            all_res[key] = 0
            for item in results:
                if (key in item['results']):
                    all_res[key] += item['results'][key]
            all_res[key] = int(all_res[key])

        if 'latency_stats' in results[0]['results']:
            # for item in results:
            #     print item['results']['latency_stats']
            all_res['latency_stats'] = []
            histogram = HdrHistogram(1, 24 * 3600 * 1000 * 1000, 2)
            for item in results:
                histogram.decode_and_add(item['results']['latency_stats'])
            perc_list = [50, 75, 90, 99, 99.9, 99.99, 99.999]
            latency_dict = histogram.get_percentile_to_value_dict(perc_list)
            for key, value in latency_dict.iteritems():
                all_res['latency_stats'].append([key, value])
            all_res['latency_stats'].sort()

        return all_res
开发者ID:cnoffsin,项目名称:kloudbuster,代码行数:30,代码来源:wrk_tool.py

示例2: consolidate_results

# 需要导入模块: from hdrh.histogram import HdrHistogram [as 别名]
# 或者: from hdrh.histogram.HdrHistogram import get_percentile_to_value_dict [as 别名]
    def consolidate_results(results):
        err_flag = False
        all_res = {'tool': 'wrk2'}
        total_count = len(results)
        if not total_count:
            return all_res

        for key in ['http_rps', 'http_total_req', 'http_sock_err',
                    'http_sock_timeout', 'http_throughput_kbytes']:
            all_res[key] = 0
            for item in results:
                all_res[key] += item['results'].get(key, 0)
            all_res[key] = int(all_res[key])

        if 'latency_stats' in results[0]['results']:
            # for item in results:
            #     print item['results']['latency_stats']
            all_res['latency_stats'] = []
            histogram = HdrHistogram(1, 24 * 3600 * 1000 * 1000, 2)
            for item in results:
                if 'latency_stats' in item['results']:
                    histogram.decode_and_add(item['results']['latency_stats'])
                else:
                    err_flag = True
            perc_list = [50, 75, 90, 99, 99.9, 99.99, 99.999]
            latency_dict = histogram.get_percentile_to_value_dict(perc_list)
            for key, value in latency_dict.iteritems():
                all_res['latency_stats'].append([key, value])
            all_res['latency_stats'].sort()

        if err_flag:
            LOG.warning('Unable to find latency_stats from the result dictionary, this '
                        'may indicate that the test application on VM exited abnormally.')

        return all_res
开发者ID:openstack,项目名称:kloudbuster,代码行数:37,代码来源:wrk_tool.py


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