# Generate "jeprof" tool.

cd contrib/jemalloc
./autogen.sh

# The tool is in /bin directory. Copy it somewhere or add it to PATH.

cp bin/jeprof ...

# Build ClickHouse in debug mode.

# Set environment variable to enable profiling.

export MALLOC_CONF="prof:true,prof_accum:true,lg_prof_interval:28"

# Run clickhouse-server.

# ClickHouse will generate profile dumps with names like jeprof*
# Use jeprof tool to analyze them:

./jeprof ./clickhouse-server jeprof.4017.0.f.heap

# It will spend a few minutes before displaying prompt.
