10 ms·
I had this exact idea almost a year ago: https://github.com/m1el/du-flamegraph https://github.com/m1el/du-flamegraph find $1 -type f | xargs -n32 -d'\n' -
by m1el 10y ago
I had this exact idea almost a year ago:
https://github.com/m1el/du-flamegraph https://github.com/m1el/du-flamegraph
find $1 -type f | xargs -n32 -d'\n' -- du -ab \
| awk -F'\t' '{print $2" "$1;}' | sed 's#/##;s#/#;#g' \
| flamegraph.pl --title "Disk usage" --countname "bytes" \
--nametype "file" --width 1900 --minwidth 0.05
... and tested it using linux sources:
http://m1el.github.io/du-flamegraph/linux-sources.svg http://m1el.github.io/du-flamegraph/linux-sources.svg
http://m1el.github.io/du-flamegraph/illumos-gate.svg http://m1el.github.io/du-flamegraph/illumos-gate.svg
http://m1el.github.io/du-flamegraph/dota2.svg http://m1el.github.io/du-flamegraph/dota2.svg
- brendangregg 10y agoI've done this before with awk, but with "find ... -ls". I don't know why you want to use du with xargs (is it really to get du's measure of bytes rather than the stat's count, for when they are different?) -- as that's calling over a thousand du's to walk the linux tree, when find can print bytes built-in with -ls (much more efficient).
- m1el 10y agoWell, this could be explained by my ignorance in *nix tools.
- surki 10y agoI do something like find $PWD -type f -ls | awk '{gsub("/", ";", $11); print $11" "$7}' | flamegraph.pl --title "Disk usage" --countname "bytes" --nametype "file" --width 1900 --minwidth 0.05