Skip to content

Instantly share code, notes, and snippets.

@enolan
Created October 8, 2019 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enolan/e95bb5ff85b1718dcbd90eb5ce1bdf12 to your computer and use it in GitHub Desktop.
Save enolan/e95bb5ff85b1718dcbd90eb5ce1bdf12 to your computer and use it in GitHub Desktop.
#/usr/bin/env bash
# Convert the XML output of malloc_info() into CSV for putting into a spreadsheet
echo -n "$(date -u '+%F %T' --date=$(basename $1)),"
XMLCMD="xmlstarlet sel -I -t -v"
echo -n "$($XMLCMD 'count(//malloc/heap)' $1),"
echo -n "$($XMLCMD '//malloc/system[@type="current"]/@size' $1),"
echo -n "$($XMLCMD '//malloc/total[@type="fast"]/@size' $1),"
echo -n "$($XMLCMD '//malloc/total[@type="rest"]/@size' $1),"
echo -n "$($XMLCMD '//malloc/total[@type="mmap"]/@size' $1)"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment