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


Python HdrHistogram.record_value方法代码示例

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


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

示例1: test_mean_stddev

# 需要导入模块: from hdrh.histogram import HdrHistogram [as 别名]
# 或者: from hdrh.histogram.HdrHistogram import record_value [as 别名]
def test_mean_stddev():
    # fill up a histogram with the values in the list
    histogram = HdrHistogram(LOWEST, HIGHEST, SIGNIFICANT)
    for value in VALUES_LIST:
        histogram.record_value(value)
    assert(histogram.get_mean_value() == 2000.5)
    assert(histogram.get_stddev() == 1000.5)
开发者ID:joshhobson,项目名称:HdrHistogram_py,代码行数:9,代码来源:test_hdrhistogram.py

示例2: encode_bins

# 需要导入模块: from hdrh.histogram import HdrHistogram [as 别名]
# 或者: from hdrh.histogram.HdrHistogram import record_value [as 别名]
    def encode_bins(self, p_output):
        p_output = json.loads(p_output)
        p_output['jobs'][0].pop('trim')
        test_list = ['read', 'write']

        for test in test_list:
            histogram = HdrHistogram(1, 5 * 3600 * 1000, 3)
            clat = p_output['jobs'][0][test]['clat']['bins']
            total_buckets = clat['FIO_IO_U_PLAT_NR']
            grp_msb_bits = clat['FIO_IO_U_PLAT_BITS']
            buckets_per_grp = clat['FIO_IO_U_PLAT_VAL']

            for bucket in xrange(total_buckets):
                if clat[str(bucket)]:
                    grp = bucket / buckets_per_grp
                    subbucket = bucket % buckets_per_grp
                    if grp == 0:
                        val = subbucket - 1
                    else:
                        base = 2 ** (grp_msb_bits + grp - 1)
                        val = int(base + (base / buckets_per_grp) * (subbucket - 0.5))
                    histogram.record_value(val, clat[str(bucket)])

            p_output['jobs'][0][test]['clat']['hist'] = histogram.encode()
            p_output['jobs'][0][test]['clat'].pop('bins')
            p_output['jobs'][0][test]['clat'].pop('percentile')

        return json.dumps(p_output)
开发者ID:openstack,项目名称:kloudbuster,代码行数:30,代码来源:kb_vm_agent.py

示例3: test_large_numbers

# 需要导入模块: from hdrh.histogram import HdrHistogram [as 别名]
# 或者: from hdrh.histogram.HdrHistogram import record_value [as 别名]
def test_large_numbers():
    histogram = HdrHistogram(20000000, 100000000, 17)
    histogram.record_value(100000000)
    histogram.record_value(20000000)
    histogram.record_value(30000000)
    assert(histogram.values_are_equivalent(20000000, histogram.get_value_at_percentile(50.0)))
    assert(histogram.values_are_equivalent(30000000, histogram.get_value_at_percentile(83.33)))
    assert(histogram.values_are_equivalent(100000000, histogram.get_value_at_percentile(83.34)))
    assert(histogram.values_are_equivalent(100000000, histogram.get_value_at_percentile(99.0)))
开发者ID:joshhobson,项目名称:HdrHistogram_py,代码行数:11,代码来源:test_hdrhistogram.py

示例4: test_record_value

# 需要导入模块: from hdrh.histogram import HdrHistogram [as 别名]
# 或者: from hdrh.histogram.HdrHistogram import record_value [as 别名]
def test_record_value():
    histogram = HdrHistogram(LOWEST, HIGHEST, SIGNIFICANT)
    histogram.record_value(TEST_VALUE_LEVEL)
    assert(histogram.get_count_at_value(TEST_VALUE_LEVEL) == 1)
    assert(histogram.get_total_count() == 1)
开发者ID:joshhobson,项目名称:HdrHistogram_py,代码行数:7,代码来源:test_hdrhistogram.py

示例5: test_out_of_range_values

# 需要导入模块: from hdrh.histogram import HdrHistogram [as 别名]
# 或者: from hdrh.histogram.HdrHistogram import record_value [as 别名]
def test_out_of_range_values():
    histogram = HdrHistogram(1, 1000, 14)
    assert(histogram.record_value(32767))
    assert(histogram.record_value(32768) is False)
开发者ID:joshhobson,项目名称:HdrHistogram_py,代码行数:6,代码来源:test_hdrhistogram.py

示例6: load_histogram

# 需要导入模块: from hdrh.histogram import HdrHistogram [as 别名]
# 或者: from hdrh.histogram.HdrHistogram import record_value [as 别名]
def load_histogram():
    histogram = HdrHistogram(LOWEST, HIGHEST, SIGNIFICANT)
    # record this value with a count of 10,000
    histogram.record_value(1000, 10000)
    histogram.record_value(100000000)
    return histogram
开发者ID:joshhobson,项目名称:HdrHistogram_py,代码行数:8,代码来源:test_hdrhistogram.py


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