xprof
xprof copied to clipboard
Problematic dependency - hdr_histogram
Currently we're leveraging work done by hdr_histogram
regarding statistics accumulation / storage, which brings set of problems to the table:
- It is a NIF - and that causes a lot of troubles when building
xprof
on various platforms (too old GCC, too new GCC. - Current hex.pm package is too old and it is not in sync with
upstream
- that's why we're using this fork https://github.com/afronski/hdr_histogram_erl and different name on hex.pm (customized_hdr_histogram
).
We need to improve that. Possible solutions:
- Getting rid of NIFs - Erlang / Elixir only library.
- Contributing build process fixes and enforcing updating hex.pm package regularly.
One of the errors that affected people on macOS during the ElixirConf US workshops:
user@hostname ~/.../elixir-fire-brigade-workshop/apps/tracing_4 $ iex -S mix
Erlang/OTP 20 [erts-9.0.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10]
[hipe] [kernel-poll:false] [dtrace]
===> Compiling customized_hdr_histogram
cc ...
Undefined symbols for architecture x86_64:
"_deflate", referenced from:
_hdr_encode_compressed in hdr_histogram_log.o
"_deflateEnd", referenced from:
_hdr_encode_compressed in hdr_histogram_log.o
"_deflateInit_", referenced from:
_hdr_encode_compressed in hdr_histogram_log.o
"_enif_alloc", referenced from:
__hi_init in hdr_histogram_nif.o
_on_load in hdr_histogram_nif.o
"_enif_alloc_binary", referenced from:
__hh_to_binary in hdr_histogram_nif.o
__hh_to_binary_uncompressed in hdr_histogram_nif.o
"_enif_alloc_resource", referenced from:
__hh_open in hdr_histogram_nif.o
__hh_from_binary in hdr_histogram_nif.o
__hi_open in hdr_histogram_nif.o
"_enif_free", referenced from:
__hi_close in hdr_histogram_nif.o
_on_unload in hdr_histogram_nif.o
__hi_ctx_dtor in hdr_histogram_nif.o
"_enif_get_double", referenced from:
__hh_percentile in hdr_histogram_nif.o
_parse_opt in hdr_histogram_nif.o
"_enif_get_int", referenced from:
__hh_open in hdr_histogram_nif.o
"_enif_get_list_cell", referenced from:
_parse_opts in hdr_histogram_nif.o
__hi_init in hdr_histogram_nif.o
"_enif_get_long", referenced from:
__hh_open in hdr_histogram_nif.o
__hh_record in hdr_histogram_nif.o
__hh_record_corrected in hdr_histogram_nif.o
__hh_record_many in hdr_histogram_nif.o
__hh_same in hdr_histogram_nif.o
__hh_lowest_at in hdr_histogram_nif.o
__hh_count_at in hdr_histogram_nif.o
...
"_enif_get_resource", referenced from:
__hh_get_memory_size in hdr_histogram_nif.o
__hh_get_total_count in hdr_histogram_nif.o
__hh_record in hdr_histogram_nif.o
__hh_record_corrected in hdr_histogram_nif.o
__hh_record_many in hdr_histogram_nif.o
__hh_add in hdr_histogram_nif.o
__hh_min in hdr_histogram_nif.o
...
"_enif_get_string", referenced from:
__hh_log_classic in hdr_histogram_nif.o
__hh_log_csv in hdr_histogram_nif.o
"_enif_get_tuple", referenced from:
_parse_opt in hdr_histogram_nif.o
"_enif_get_uint", referenced from:
_parse_opt in hdr_histogram_nif.o
__hi_open in hdr_histogram_nif.o
"_enif_inspect_binary", referenced from:
__hh_from_binary in hdr_histogram_nif.o
"_enif_is_list", referenced from:
__hi_init in hdr_histogram_nif.o
"_enif_make_atom", referenced from:
__hh_open in hdr_histogram_nif.o
__hh_get_memory_size in hdr_histogram_nif.o
__hh_get_total_count in hdr_histogram_nif.o
__hh_record in hdr_histogram_nif.o
__hh_record_corrected in hdr_histogram_nif.o
__hh_record_many in hdr_histogram_nif.o
__hh_add in hdr_histogram_nif.o
...
"_enif_make_badarg", referenced from:
__hh_open in hdr_histogram_nif.o
__hh_get_memory_size in hdr_histogram_nif.o
__hh_get_total_count in hdr_histogram_nif.o
__hh_record in hdr_histogram_nif.o
__hh_record_corrected in hdr_histogram_nif.o
__hh_record_many in hdr_histogram_nif.o
__hh_add in hdr_histogram_nif.o
...
"_enif_make_binary", referenced from:
__hh_to_binary in hdr_histogram_nif.o
__hh_to_binary_uncompressed in hdr_histogram_nif.o
"_enif_make_double", referenced from:
__hh_mean in hdr_histogram_nif.o
__hh_median in hdr_histogram_nif.o
__hh_stddev in hdr_histogram_nif.o
__hh_percentile in hdr_histogram_nif.o
__hi_next in hdr_histogram_nif.o
"_enif_make_int", referenced from:
__hi_next in hdr_histogram_nif.o
"_enif_make_list", referenced from:
__hi_next in hdr_histogram_nif.o
"_enif_make_long", referenced from:
__hh_add in hdr_histogram_nif.o
__hh_min in hdr_histogram_nif.o
__hh_max in hdr_histogram_nif.o
__hh_lowest_at in hdr_histogram_nif.o
__hh_count_at in hdr_histogram_nif.o
__hi_next in hdr_histogram_nif.o
"_enif_make_resource", referenced from:
__hh_open in hdr_histogram_nif.o
__hh_from_binary in hdr_histogram_nif.o
__hi_open in hdr_histogram_nif.o
"_enif_make_tuple", referenced from:
__hh_open in hdr_histogram_nif.o
__hh_get_memory_size in hdr_histogram_nif.o
__hh_get_total_count in hdr_histogram_nif.o
__hh_record in hdr_histogram_nif.o
__hh_record_corrected in hdr_histogram_nif.o
__hh_record_many in hdr_histogram_nif.o
__hh_add in hdr_histogram_nif.o
...
"_enif_make_ulong", referenced from:
__hh_get_memory_size in hdr_histogram_nif.o
__hh_get_total_count in hdr_histogram_nif.o
"_enif_open_resource_type", referenced from:
_on_load in hdr_histogram_nif.o
"_enif_priv_data", referenced from:
__hh_open in hdr_histogram_nif.o
__hh_get_memory_size in hdr_histogram_nif.o
__hh_get_total_count in hdr_histogram_nif.o
__hh_record in hdr_histogram_nif.o
__hh_record_corrected in hdr_histogram_nif.o
__hh_record_many in hdr_histogram_nif.o
__hh_add in hdr_histogram_nif.o
...
"_enif_release_resource", referenced from:
__hh_open in hdr_histogram_nif.o
__hh_from_binary in hdr_histogram_nif.o
__hi_open in hdr_histogram_nif.o
"_inflate", referenced from:
_hdr_decode_compressed in hdr_histogram_log.o
"_inflateEnd", referenced from:
_hdr_decode_compressed in hdr_histogram_log.o
"_inflateInit_", referenced from:
_hdr_decode_compressed in hdr_histogram_log.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/.../customized_hdr_histogram/c_src/../priv/hdr_histogram_nif.so] Error 1
===> Hook for compile failed!
** (Mix) Could not compile dependency :customized_hdr_histogram, ...
Someone linked this issue in Elixir's #general slack channel. I wrote https://github.com/2nd/histogrex a while ago, if it helps (pure Elixir HDR histogram)
hi Karl,
thanks for bringing to our attention that someone had this issue. And even more for the pointer to your pure Elixir implementation. Currently there is a requirement that we need to compile and run XProf in an env without Elixir, so cannot include your lib straight away, but it's a good starting point (maybe porting it to Erlang) and motivation to tackle this issue sooner rather than later.