Skip to content

Commit 9dc3690

Browse files
committed
[add] deps/hdr_histogram subtree: simplified project structure with the minimum required files
1 parent 519eee9 commit 9dc3690

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+164
-4444
lines changed

deps/hdr_histogram/.github/workflows/ci.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

deps/hdr_histogram/.gitignore

Lines changed: 0 additions & 55 deletions
This file was deleted.

deps/hdr_histogram/.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

deps/hdr_histogram/CMakeLists.txt

Lines changed: 0 additions & 76 deletions
This file was deleted.

deps/hdr_histogram/README.md

Lines changed: 5 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,10 @@
1-
HdrHistogram_c: 'C' port of High Dynamic Range (HDR) Histogram
1+
HdrHistogram_c v0.11.0
22

3-
HdrHistogram
43
----------------------------------------------
54

6-
[![Gitter chat](https://badges.gitter.im/HdrHistogram/HdrHistogram.png)](https://gitter.im/HdrHistogram/HdrHistogram)
5+
This port contains a subset of the 'C' version of High Dynamic Range (HDR) Histogram available at [github.com/HdrHistogram/HdrHistogram_c](https://github.com/HdrHistogram/HdrHistogram_c).
76

8-
This port contains a subset of the functionality supported by the Java
9-
implementation. The current supported features are:
107

11-
* Standard histogram with 64 bit counts (32/16 bit counts not supported)
12-
* All iterator types (all values, recorded, percentiles, linear, logarithmic)
13-
* Histogram serialisation (encoding version 1.2, decoding 1.0-1.2)
14-
* Reader/writer phaser and interval recorder
15-
16-
Features not supported, but planned
17-
18-
* Auto-resizing of histograms
19-
20-
Features unlikely to be implemented
21-
22-
* Double histograms
23-
* Atomic/Concurrent histograms
24-
* 16/32 bit histograms
25-
26-
# Simple Tutorial
27-
28-
## Recording values
29-
30-
```C
31-
#include <hdr_histogram.h>
32-
33-
struct hdr_histogram* histogram;
34-
35-
// Initialise the histogram
36-
hdr_init(
37-
1, // Minimum value
38-
INT64_C(3600000000), // Maximum value
39-
3, // Number of significant figures
40-
&histogram) // Pointer to initialise
41-
42-
// Record value
43-
hdr_record_value(
44-
histogram, // Histogram to record to
45-
value) // Value to record
46-
47-
// Record value n times
48-
hdr_record_values(
49-
histogram, // Histogram to record to
50-
value, // Value to record
51-
10) // Record value 10 times
52-
53-
// Record value with correction for co-ordinated omission.
54-
hdr_record_corrected_value(
55-
histogram, // Histogram to record to
56-
value, // Value to record
57-
1000) // Record with expected interval of 1000.
58-
59-
// Print out the values of the histogram
60-
hdr_percentiles_print(
61-
histogram,
62-
stdout, // File to write to
63-
5, // Granularity of printed values
64-
1.0, // Multiplier for results
65-
CLASSIC); // Format CLASSIC/CSV supported.
66-
```
67-
68-
## More examples
69-
70-
For more detailed examples of recording and logging results look at the
71-
[hdr_decoder](examples/hdr_decoder.c)
72-
and [hiccup](examples/hiccup.c)
73-
examples. You can run hiccup and decoder
74-
and pipe the results of one into the other.
75-
76-
```
77-
$ ./examples/hiccup | ./examples/hdr_decoder
78-
```
8+
The code present on `hdr_histogram.c`, `hdr_histogram.h`, and `hdr_atomic.c` was Written by Gil Tene, Michael Barker,
9+
and Matt Warren, and released to the public domain, as explained at
10+
http://creativecommons.org/publicdomain/zero/1.0/.

deps/hdr_histogram/byteorder.h

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/**
2+
* Copyright (c) 2012, 2013, 2014 Gil Tene
3+
* Copyright (c) 2014 Michael Barker
4+
* Copyright (c) 2014 Matt Warren
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
*
13+
* 2. Redistributions in binary form must reproduce the above copyright notice,
14+
* this list of conditions and the following disclaimer in the documentation
15+
* and/or other materials provided with the distribution.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27+
* THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
#include <sys/isa_defs.h>
31+
# include <sys/byteorder.h>
32+
33+
# define betoh16(x) BE_16(x)
34+
# define letoh16(x) LE_16(x)
35+
# define betoh32(x) BE_32(x)
36+
# define letoh32(x) LE_32(x)
37+
# define betoh64(x) BE_64(x)
38+
# define letoh64(x) LE_64(x)
39+
#define htobe16(x) BE_16(x)
40+
#define be16toh(x) BE_16(x)
41+
#define htobe32(x) BE_32(x)
42+
#define be32toh(x) BE_32(x)
43+
#define htobe64(x) BE_64(x)
44+
#define be64toh(x) BE_64(x)
45+
// Solaris defines endian by setting _LITTLE_ENDIAN or _BIG_ENDIAN
46+
# ifdef _BIG_ENDIAN
47+
# define IS_BIG_ENDIAN
48+
# endif
49+
# ifdef _LITTLE_ENDIAN
50+
# define IS_LITTLE_ENDIAN
51+
# endif
52+
// Make sure we got some kind of endian (but not both)
53+
#if defined(IS_BIG_ENDIAN) == defined(IS_LITTLE_ENDIAN)
54+
# error "Failed to get endian type for this system"
55+
#endif
56+
57+
// Define bswap functions if we didn't get any from the system headers
58+
#ifndef BSWAP_16
59+
# define BSWAP_16(x) ( \
60+
((uint16_t)(x) & 0x00ffU) << 8 | \
61+
((uint16_t)(x) & 0xff00U) >> 8)
62+
#endif
63+
#ifndef BSWAP_32
64+
# define BSWAP_32(x) ( \
65+
((uint32_t)(x) & 0x000000ffU) << 24 | \
66+
((uint32_t)(x) & 0x0000ff00U) << 8 | \
67+
((uint32_t)(x) & 0x00ff0000U) >> 8 | \
68+
((uint32_t)(x) & 0xff000000U) >> 24)
69+
#endif
70+
#ifndef BSWAP_64
71+
# define BSWAP_64(x) ( \
72+
((uint64_t)(x) & 0x00000000000000ffULL) << 56 | \
73+
((uint64_t)(x) & 0x000000000000ff00ULL) << 40 | \
74+
((uint64_t)(x) & 0x0000000000ff0000ULL) << 24 | \
75+
((uint64_t)(x) & 0x00000000ff000000ULL) << 8 | \
76+
((uint64_t)(x) & 0x000000ff00000000ULL) >> 8 | \
77+
((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24 | \
78+
((uint64_t)(x) & 0x00ff000000000000ULL) >> 40 | \
79+
((uint64_t)(x) & 0xff00000000000000ULL) >> 56)
80+
#endif
81+
82+
// Define conversion functions if we didn't get any from the system headers
83+
#ifndef BE_16
84+
// Big endian system, swap when converting to/from little endian
85+
# if defined IS_BIG_ENDIAN
86+
# define BE_16(x) (x)
87+
# define BE_32(x) (x)
88+
# define BE_64(x) (x)
89+
# define LE_16(x) BSWAP_16(x)
90+
# define LE_32(x) BSWAP_32(x)
91+
# define LE_64(x) BSWAP_64(x)
92+
// Little endian system, swap when converting to/from big endian
93+
# elif defined IS_LITTLE_ENDIAN
94+
# define BE_16(x) BSWAP_16(x)
95+
# define BE_32(x) BSWAP_32(x)
96+
# define BE_64(x) BSWAP_64(x)
97+
# define LE_16(x) (x)
98+
# define LE_32(x) (x)
99+
# define LE_64(x) (x)
100+
#endif
101+
#endif

deps/hdr_histogram/config.cmake.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)