Skip to content

Commit f0b0a44

Browse files
committed
Update README and fix gcc warnings
Change-Id: Ifb65cbfd5fd5ae8dac2461d8aa48c7908ed4a92e
1 parent 80a7152 commit f0b0a44

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ develop-eggs
1717
.installed.cfg
1818
lib
1919
lib64
20+
.eggs
21+
.cache
2022

2123
# Installer logs
2224
pip-log.txt

README.rst

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ High Dynamic Range Histogram python implementation
77
.. image:: https://badges.gitter.im/Join Chat.svg
88
:target: https://gitter.im/HdrHistogram/HdrHistogram
99

10-
This repository contains a port to python of portions of the HDR Histogram
10+
This repository contains a port to python of most of the original Java HDR Histogram
1111
library:
1212

1313
- Basic histogram value recording
@@ -28,14 +28,14 @@ Python API
2828
----------
2929
Users of this library can generally play 2 roles (often both):
3030

31-
- histogram provisioning (record values)
32-
- histogram query (for display or analysis)
31+
- record values into 1 or more histograms (histogram provisioning)
32+
- analyze and display histogram content and characteristics (histogram query)
3333

34-
In distributed cases, histogram provisioning can be be done remotely then
34+
In distributed cases, histogram provisioning can be be done remotely (and possibly in multiple locations) then
3535
aggregated in a central place for analysis.
3636

3737
A histogram instance can be created using the HdrHistogram class and specifying the
38-
minimum and maximum trackable value and the number of precision digits.
38+
minimum and maximum trackable value and the number of precision digits desired.
3939
For example to create a histogram that can count values in the [1..3600000] range and
4040
1% precision (this could be for example to track latencies in the range [1 msec..1 hour]):
4141

@@ -44,7 +44,7 @@ For example to create a histogram that can count values in the [1..3600000] rang
4444
histogram = HdrHistogram(1, 60 * 60 * 1000, 2)
4545
4646
By default counters are 64-bit while 16 or 32-bit counters can be specified (word_size
47-
option set to 2 or 4).
47+
option set to 2 or 4 bytes).
4848
Note that counter overflow is not tested in this version so be careful when using
4949
smaller counter sizes.
5050

@@ -107,15 +107,6 @@ For additional help on how to use the API:
107107

108108
The test code (https://github.com/HdrHistogram/HdrHistogram_py/blob/master/test/test_hdrhistogram.py) pretty much covers every API.
109109

110-
Acknowledgements
111-
----------------
112-
113-
The python code was directly ported from the original HDR Histogram Java and C libraries:
114-
115-
* https://github.com/HdrHistogram/HdrHistogram.git
116-
* https://github.com/HdrHistogram/HdrHistogram_c.git
117-
118-
119110
Installation
120111
------------
121112
Pre-requisites:
@@ -218,12 +209,12 @@ This format is compatible with the HdrHistogram Java and C implementations.
218209

219210
Performance
220211
-----------
221-
Histogram value recording has the same cost characteristics than the Java version
212+
Histogram value recording has the same cost characteristics than the original Java version
222213
since it is a direct port (fixed cost for CPU and reduced memory usage).
223-
Encoding and decoding in the python version is very fast thanks to the use of:
214+
Encoding and decoding in the python version is very fast and close to native performance thanks to the use of:
224215

225-
- integrated C extensions that have been developed to handle the low-level byte encoding/decoding work at native speed
226-
- native compression library (using zlib)
216+
- integrated C extensions (native C code called from python) that have been developed to handle the low-level byte encoding/decoding/addition work at native speed
217+
- native compression library (zlib and base64)
227218

228219
On a macbook pro (Intel Core i7 @ 2.3GHz) and Linux server (Intel(R) Xeon(R) CPU E5-2665 @ 2.40GHz):
229220

@@ -232,17 +223,19 @@ On a macbook pro (Intel Core i7 @ 2.3GHz) and Linux server (Intel(R) Xeon(R) CPU
232223
+===========================+===========+========+
233224
| record a value | 2 | 1.5 |
234225
+---------------------------+-----------+--------+
235-
| encode typical histogram | 100 | 96 |
226+
| encode typical histogram | 100 | 90 |
236227
+---------------------------+-----------+--------+
237-
| decode typical histogram | 160 | 138 |
228+
| decode and add | 150 | 125 |
238229
+---------------------------+-----------+--------+
239230

240231

241232
The typical histogram is defined as one that has 30% of 64-bit buckets filled with
242233
sequential values starting at 20% of the array, for a range of 1 usec to 24 hours
243234
and 2 digits precision. This represents a total of 3968 buckets, of which
244235
the first 793 are zeros, the next 1190 buckets have a sequential/unique value and all
245-
remaining buckets are zeros, for an encoded length of 3116 bytes.
236+
remaining buckets are zeros, for an encoded length of 3116 bytes. Most real-world histograms
237+
have a much sparser pattern that will yield a lower encoding and decoding time.
238+
Decode and add will decode the encoded histogram and add its content to an existing histogram.
246239

247240
To measure the performance of encoding and decoding and get the profiling, use the
248241
--runperf option. The 2 profiling functions will provide the profiling information
@@ -453,6 +446,15 @@ Changes can be contributed back using preferably GerritHub (https://review.gerri
453446
GitHub pull requests can also be considered.
454447

455448

449+
Acknowledgements
450+
----------------
451+
452+
The python code was directly ported from the original HDR Histogram Java and C libraries:
453+
454+
* https://github.com/HdrHistogram/HdrHistogram.git
455+
* https://github.com/HdrHistogram/HdrHistogram_c.git
456+
457+
456458
Links
457459
-----
458460

src/python-codec.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ static PyObject *py_hdr_encode(PyObject *self, PyObject *args) {
184184
int word_size; /* i: word size in bytes (2,4,8) for each array element */
185185
uint8_t *dest; /* l: where to encode */
186186
int dest_len; /* i: length of the destination buffer, must be >=(word_size+1)*max_index */
187-
int max_size;
188187
get_array_entry get_entry;
189188
int index;
190189
int write_index;
@@ -270,8 +269,6 @@ static PyObject *py_hdr_decode(PyObject *self, PyObject *args) {
270269
int min_nonzero_index = -1;
271270
int max_nonzero_index = 0;
272271

273-
PyObject *res;
274-
275272
if (!PyArg_ParseTuple(args, "t#ilii", &src, &src_len,
276273
&read_index,
277274
&vdst, &max_index,

0 commit comments

Comments
 (0)