-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the hdr histogram log optional if allowed and zlib not found.
- Loading branch information
Showing
5 changed files
with
218 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
add_executable(hdr_decoder | ||
hdr_decoder.c) | ||
target_link_libraries(hdr_decoder | ||
PRIVATE | ||
$<$<BOOL:${WIN32}>:hdr_histogram_static> | ||
$<$<NOT:$<BOOL:${WIN32}>>:hdr_histogram>) | ||
install( | ||
TARGETS hdr_decoder | ||
EXPORT ${PROJECT_NAME}-targets | ||
DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
|
||
if(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
find_package(Threads) | ||
|
||
add_executable(hiccup | ||
hiccup.c) | ||
target_link_libraries(hiccup | ||
if (HDR_LOG_ENABLED) | ||
add_executable(hdr_decoder | ||
hdr_decoder.c) | ||
target_link_libraries(hdr_decoder | ||
PRIVATE | ||
hdr_histogram | ||
Threads::Threads) | ||
$<$<BOOL:${WIN32}>:hdr_histogram_static> | ||
$<$<NOT:$<BOOL:${WIN32}>>:hdr_histogram>) | ||
install( | ||
TARGETS hiccup | ||
TARGETS hdr_decoder | ||
EXPORT ${PROJECT_NAME}-targets | ||
DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
endif() | ||
|
||
if(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
find_package(Threads) | ||
|
||
add_executable(hiccup | ||
hiccup.c) | ||
target_link_libraries(hiccup | ||
PRIVATE | ||
hdr_histogram | ||
Threads::Threads) | ||
install( | ||
TARGETS hiccup | ||
EXPORT ${PROJECT_NAME}-targets | ||
DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
/** | ||
* hdr_histogram_log.c | ||
* Written by Michael Barker and released to the public domain, | ||
* as explained at http://creativecommons.org/publicdomain/zero/1.0/ | ||
*/ | ||
|
||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#include "hdr_histogram.h" | ||
#include "hdr_histogram_log.h" | ||
#include "hdr_tests.h" | ||
|
||
#define UNUSED(x) (void)(x) | ||
|
||
const char* hdr_strerror(int errnum) | ||
{ | ||
switch (errnum) | ||
{ | ||
case HDR_COMPRESSION_COOKIE_MISMATCH: | ||
return "Compression cookie mismatch"; | ||
case HDR_ENCODING_COOKIE_MISMATCH: | ||
return "Encoding cookie mismatch"; | ||
case HDR_DEFLATE_INIT_FAIL: | ||
return "Deflate initialisation failed"; | ||
case HDR_DEFLATE_FAIL: | ||
return "Deflate failed"; | ||
case HDR_INFLATE_INIT_FAIL: | ||
return "Inflate initialisation failed"; | ||
case HDR_INFLATE_FAIL: | ||
return "Inflate failed"; | ||
case HDR_LOG_INVALID_VERSION: | ||
return "Log - invalid version in log header"; | ||
case HDR_TRAILING_ZEROS_INVALID: | ||
return "Invalid number of trailing zeros"; | ||
case HDR_VALUE_TRUNCATED: | ||
return "Truncated value found when decoding"; | ||
case HDR_ENCODED_INPUT_TOO_LONG: | ||
return "The encoded input exceeds the size of the histogram"; | ||
default: | ||
return strerror(errnum); | ||
} | ||
} | ||
|
||
int hdr_encode_compressed( | ||
struct hdr_histogram* h, | ||
uint8_t** compressed_histogram, | ||
size_t* compressed_len) | ||
{ | ||
UNUSED(h); | ||
UNUSED(compressed_histogram); | ||
UNUSED(compressed_len); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_decode_compressed( | ||
uint8_t* buffer, size_t length, struct hdr_histogram** histogram) | ||
{ | ||
UNUSED(buffer); | ||
UNUSED(length); | ||
UNUSED(histogram); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_writer_init(struct hdr_log_writer* writer) | ||
{ | ||
UNUSED(writer); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_write_header( | ||
struct hdr_log_writer* writer, FILE* file, | ||
const char* user_prefix, hdr_timespec* timestamp) | ||
{ | ||
UNUSED(writer); | ||
UNUSED(file); | ||
UNUSED(user_prefix); | ||
UNUSED(timestamp); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_write( | ||
struct hdr_log_writer* writer, | ||
FILE* file, | ||
const hdr_timespec* start_timestamp, | ||
const hdr_timespec* end_timestamp, | ||
struct hdr_histogram* histogram) | ||
{ | ||
UNUSED(writer); | ||
UNUSED(file); | ||
UNUSED(start_timestamp); | ||
UNUSED(end_timestamp); | ||
UNUSED(histogram); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_write_entry( | ||
struct hdr_log_writer* writer, | ||
FILE* file, | ||
struct hdr_log_entry* entry, | ||
struct hdr_histogram* histogram) | ||
{ | ||
UNUSED(writer); | ||
UNUSED(file); | ||
UNUSED(entry); | ||
UNUSED(histogram); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_reader_init(struct hdr_log_reader* reader) | ||
{ | ||
UNUSED(reader); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_read_header(struct hdr_log_reader* reader, FILE* file) | ||
{ | ||
UNUSED(reader); | ||
UNUSED(file); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_read( | ||
struct hdr_log_reader* reader, FILE* file, struct hdr_histogram** histogram, | ||
hdr_timespec* timestamp, hdr_timespec* interval) | ||
{ | ||
UNUSED(reader); | ||
UNUSED(file); | ||
UNUSED(histogram); | ||
UNUSED(timestamp); | ||
UNUSED(interval); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_read_entry( | ||
struct hdr_log_reader* reader, FILE* file, struct hdr_log_entry *entry, struct hdr_histogram** histogram) | ||
{ | ||
UNUSED(reader); | ||
UNUSED(file); | ||
UNUSED(entry); | ||
UNUSED(histogram); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_encode(struct hdr_histogram* histogram, char** encoded_histogram) | ||
{ | ||
UNUSED(histogram); | ||
UNUSED(encoded_histogram); | ||
|
||
return -1; | ||
} | ||
|
||
int hdr_log_decode(struct hdr_histogram** histogram, char* base64_histogram, size_t base64_len) | ||
{ | ||
UNUSED(histogram); | ||
UNUSED(base64_histogram); | ||
UNUSED(base64_len); | ||
|
||
return -1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters