mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-12 19:04:03 +08:00
adding scripts for easy local run (#59)
This commit is contained in:
1 parent
0b82c1188c
commit
3a35bcda91
3 files changed
+86
-1
No files matched your search
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
helpFunction_flame()
|
||||
{
|
||||
echo "Usage: $0 -o output_file -p program"
|
||||
echo -e "\t-o output .svg filename, where to save flame graph"
|
||||
echo -e "\t-p .py program we want to profile with associated arguments"
|
||||
exit 1 # Exit program after printing help
|
||||
}
|
||||
|
||||
helpFunction_top()
|
||||
{
|
||||
echo "Usage: $0 -p program"
|
||||
echo -e "\t-p .py program we want to profile with associated arguments"
|
||||
exit 1 # Exit program after printing help
|
||||
}
|
||||
|
||||
|
||||
while getopts "t:o:p:a:" opt; do
|
||||
case "$opt" in
|
||||
t ) type="$OPTARG" ;;
|
||||
o ) output_file="$OPTARG" ;;
|
||||
p ) program="$OPTARG" ;;
|
||||
? ) helpFunction ;;
|
||||
esac
|
||||
done
|
||||
if [ -z "$type" ]; then
|
||||
echo "Missing profiling type (flame / top)"
|
||||
fi
|
||||
# Print helpFunction in case parameters are empty
|
||||
if [[ "$type" = "flame" ]]; then
|
||||
if [ -z "$output_file" ] || [ -z "$program" ]; then
|
||||
echo "Some or all of the parameters are empty";
|
||||
helpFunction_flame
|
||||
fi
|
||||
py-spy record -o "$output_file" python "$program"
|
||||
elif [[ "$type" = "top" ]]; then
|
||||
if [ -z "$program" ]; then
|
||||
echo "Some or all of the parameters are empty";
|
||||
helpFunction_top
|
||||
fi
|
||||
py-spy top python "$program"
|
||||
fi
|
||||
Reference in new issue
Block a user