Skip to content

Commit

Permalink
[fix] conversion_ratio_bits type setted to c_double
Browse files Browse the repository at this point in the history
  • Loading branch information
filipecosta90 committed Oct 31, 2019
1 parent d566355 commit 0a8c2fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion hdrh/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from ctypes import c_ushort
from ctypes import c_uint
from ctypes import c_ulonglong
from ctypes import c_double

import zlib

Expand Down Expand Up @@ -98,7 +99,7 @@ class PayloadHeader(BigEndianStructure):
("significant_figures", c_uint),
("lowest_trackable_value", c_ulonglong),
("highest_trackable_value", c_ulonglong),
("conversion_ratio_bits", c_ulonglong)]
("conversion_ratio_bits", c_double)]


payload_header_size = ctypes.sizeof(PayloadHeader)
Expand Down
12 changes: 6 additions & 6 deletions test/test_hdrhistogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,17 +425,17 @@ def check_hist_encode(word_size,
ENCODE_ARG_LIST = (
# word size digits expected_compressed_length, fill_start%, fill_count%
# best case when all counters are zero
(8, 3, 48, 0, 0), # V1=52 385 = size when compressing entire counts array
(8, 2, 48, 0, 0), # 126
(8, 3, 52, 0, 0), # V1=52 385 = size when compressing entire counts array
(8, 2, 52, 0, 0), # 126
# typical case when all counters are aggregated in a small contiguous area
(8, 3, 15560, 30, 20), # V1=16452
(8, 2, 1688, 30, 20), # V1=2096
(8, 3, 15564, 30, 20), # V1=16452
(8, 2, 1692, 30, 20), # V1=2096
# worst case when all counters are different
(8, 3, 76892, 0, 100), # V1=80680
(8, 2, 9340, 0, 100), # V1=10744
(8, 2, 9344, 0, 100), # V1=10744
# worst case 32-bit and 16-bit counters
(2, 3, 76892, 0, 100), # V1=68936
(2, 2, 9340, 0, 100), # V1=9144
(2, 2, 9344, 0, 100), # V1=9144
)

@pytest.mark.codec
Expand Down

0 comments on commit 0a8c2fd

Please sign in to comment.