#!/bin/bash # This scripts transforms the output of clang's -ftime-trace JSON files into a format to upload to ClickHouse # Example: # mkdir time_trace # utils/prepare-time-trace/prepare-time-trace.sh build time_trace # See also https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview true< \"${OUTPUT_DIR}/\$\$\" " # Now you can upload it as follows: #cat "$OUTPUT_DIR"/* | clickhouse-client --progress --query "INSERT INTO build_time_trace (extra_column_names, file, library, time, pid, tid, ph, ts, dur, cat, name, detail, count, avgMs, args_name) FORMAT JSONCompactEachRow" # Additionally, collect information about the sizes of translation units true< "${OUTPUT_DIR}/binary_sizes.txt" # Additionally, collect information about the symbols inside translation units true< '{}.symbols' " find "$INPUT_DIR" -type f -name '*.o.symbols' | xargs cat > "${OUTPUT_DIR}/binary_symbols.txt" fi