示例#1
0
def test_jHiccup_v2_log():
    accumulated_histogram = HdrHistogram(LOWEST, HIGHEST, SIGNIFICANT)
    for checklist in JHICCUP_CHECKLISTS:
        accumulated_histogram.reset()
        log_reader = HistogramLogReader(JHICCUP_V2_LOG_NAME,
                                        accumulated_histogram)

        histogram_count = 0
        total_count = 0
        target_numbers = checklist.pop('target')
        while 1:
            decoded_histogram = log_reader.get_next_interval_histogram(
                **checklist)
            if not decoded_histogram:
                break
            histogram_count += 1
            total_count += decoded_histogram.get_total_count()
            accumulated_histogram.add(decoded_histogram)
            # These logs use 8 byte counters
            assert decoded_histogram.get_word_size() == 8
            # These logs use the default 1.0 conversion ratio
            assert decoded_histogram.get_int_to_double_conversion_ratio(
            ) == 1.0
        for statement in target_numbers:
            assert eval(statement) == target_numbers[statement]

        log_reader.close()
示例#2
0
def test_tagged_v2_log():
    histogram_count = 0
    total_count = 0
    accumulated_histogram = HdrHistogram(LOWEST, HIGHEST, SIGNIFICANT)
    accumulated_histogram_tags = HdrHistogram(LOWEST, HIGHEST, SIGNIFICANT)
    log_reader = HistogramLogReader(TAGGED_V2_LOG, accumulated_histogram)
    while 1:
        decoded_histogram = log_reader.get_next_interval_histogram()
        if not decoded_histogram:
            break
        histogram_count += 1
        total_count += decoded_histogram.get_total_count()
        if decoded_histogram.get_tag() == 'A':
            accumulated_histogram_tags.add(decoded_histogram)
        else:
            assert decoded_histogram.get_tag() is None
            accumulated_histogram.add(decoded_histogram)

    assert accumulated_histogram.equals(accumulated_histogram_tags)
    assert total_count == 32290
def test_jHiccup_v2_log():
    accumulated_histogram = HdrHistogram(LOWEST, HIGHEST, SIGNIFICANT)
    for checklist in JHICCUP_CHECKLISTS:
        accumulated_histogram.reset()
        log_reader = HistogramLogReader(JHICCUP_V2_LOG_NAME, accumulated_histogram)

        histogram_count = 0
        total_count = 0
        target_numbers = checklist.pop('target')
        while 1:
            decoded_histogram = log_reader.get_next_interval_histogram(**checklist)
            if not decoded_histogram:
                break
            histogram_count += 1
            total_count += decoded_histogram.get_total_count()
            accumulated_histogram.add(decoded_histogram)
            # These logs use 8 byte counters
            assert(decoded_histogram.get_word_size() == 8)
        for statement in target_numbers:
            assert(eval(statement) == target_numbers[statement])

        log_reader.close()