Last active
November 23, 2022 21:30
-
-
Save dvessel/a046f9944c4050f2ce841a8e445128ac to your computer and use it in GitHub Desktop.
Throw it into a bin path, cd into it and `chmod +x link-loaded-textures`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
sec=${argv[( $argv[(i)--timeout|-t] + 1 )]:-10} | |
out=${argv[( $argv[(i)--output|-o] + 1 )]:-~/Desktop/Texture\ Loads/`date "+%m.%d,%H.%M.%S"`} | |
com=$argv[( $argv[(i)--compare|-c] + 1 )] | |
pre=$argv[( $argv[(i)--preview|-p] )] | |
if [[ $argv[(I)(--help|-h)] -gt 0 ]]; then | |
echo "\ | |
--timeout|-t [n] | |
Sample time in seconds. Defaults to 10. | |
--output|-o [path] | |
Path to output. Defaults to \"Desktop/Texture Loads/`date "+%m.%d,%H.%M.%S"`\" | |
--compare|-c [path] | |
Path to a directory of textures with the same naming pattern. | |
Use for comparison. Results will be added to output path. | |
--preview|-p | |
Preview all matching textures with quicklook." | |
exit | |
fi | |
if [[ -n $com ]]; then | |
test ! -d $com && | |
echo "--compare \"$com\" does not exist." && | |
return 1 | |
com="$(cd $com && pwd)" | |
fi | |
echo "Sampling texture reads for $sec seconds." | |
mkdir -p $out | |
while read -r p; do ((c++)) | |
ln -sf $p $out | |
test -n $com && | |
for i in $com/$p:t:r.*(N) | |
ln -sf $i $out/$p:t:r.compare | |
done < <( | |
sudo fs_usage -t $sec -wf pathname Dolphin | | |
sed -nE "s;^.+open[^/]+(/.+/tex1_.+\.(dds|png)).+$;\1;p" | |
) | |
# Remove broken links from outside scripts actively cleaning up dumps. | |
find -L $out -type l -depth 1 | xargs -I % rm % | |
echo "$c calls to open `find $out ! -name "*.compare" | wc -l | bc` textures." | |
test ! -z $pre && | |
qlmanage -p &>/dev/null $out/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The above script will generate symbolic links to your desktop of all the upscaled texture reads while running Dolphin. This is to aid in narrowing down which textures are being used at a given moment.
It runs under sudo as it’s required for
fs_usage
and it’s MacOS specific. You should be able to adapt this with something like DTrace on other OS’s.Options:
Duration of the sample in seconds. 10 is the default.
link-loaded-textures --timeout 10
Output location. Defaults to ~/Desktop/Texture\ Loads.tmp/
date "+%m.%d,%H.%M.%S"
link-loaded-textures --output “path/to/linked/results”
Path to compare with. Just for reference.
link-loaded-textures --compare-path “path/to/textures”
Shows the output with QuickLook.
link-loaded-textures --quicklook