<commit_before>#!/bin/bash

debug=
if [[ "$1" == "--debug" ]]; then
  debug=1
  shift 1;
fi

if [[ -z "$1" ]]; then
    echo "$0 DEBUGEE ARGS"
    exit 1
fi

output=$(pwd)/malloctrace.$(basename $1).

cb

echo "starting application, this might take some time..."

if [ -z "$debug" ]; then
  LD_PRELOAD=./libmalloctrace.so DUMP_MALLOC_TRACE_OUTPUT="$output" $@ &
else
  gdb --eval-command="set environment LD_PRELOAD=./libmalloctrace.so" \
      --eval-command="set environment DUMP_MALLOC_TRACE_OUTPUT=\"$output\"" \
      --eval-command="run" --args $@
fi

pid=$!
wait $pid

if [[ "$(ls $output$pid* 2> /dev/null)" != "" ]]; then
    echo "finished application, merging and zipping data files"
    cd $(dirname $output)
    output=$(basename $output)$pid
    tar -cjf "$output.tar.bz2" "$output."[0-9]* && rm "$output."[0-9]*
    du -h "$output.tar.bz2"
fi
<commit_msg>Update trace script.<commit_after>#!/bin/bash

debug=
if [[ "$1" == "--debug" ]]; then
  debug=1
  shift 1;
fi

if [[ -z "$1" ]]; then
    echo "$0 DEBUGEE ARGS"
    exit 1
fi

output=$(pwd)/malloctrace.$(basename $1).

cb

echo "starting application, this might take some time..."

if [ -z "$debug" ]; then
  LD_PRELOAD=./libmalloctrace.so DUMP_MALLOC_TRACE_OUTPUT="$output" $@ &
else
  gdb --eval-command="set environment LD_PRELOAD=./libmalloctrace.so" \
      --eval-command="set environment DUMP_MALLOC_TRACE_OUTPUT=\"$output\"" \
      --eval-command="run" --args $@
fi

pid=$!
wait $pid

if [[ "$(ls $output$pid 2> /dev/null)" != "" ]]; then
    echo "finished application, zipping data file"
    cd $(dirname $output)
    output=$(basename $output)$pid
    bzip2 "$output"
    du -h "$output.bz2"
fi

{'fraction_non_alphanumeric': 0.19189511323003575, 'fraction_numerical': 0.014302741358760428, 'mean_word_length': 3.338501291989664, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4948828', 'n_tokens_mistral': 653, 'n_tokens_neox': 615, 'n_words': 158}