mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 06:49:13 +08:00
fixed profiler bug with variable options (#254)
This commit is contained in:
1 parent
a95f47cd08
commit
6281896e1d
1 file changed
+27
-18
@@ -16,28 +16,37 @@ helpFunction_top()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
while getopts "t:o:p:a:" opt; do
|
while getopts "t:o:p" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
t ) type="$OPTARG" ;;
|
t ) type="$OPTARG" ;;
|
||||||
o ) output_file="$OPTARG" ;;
|
o ) output_file="$OPTARG" ;;
|
||||||
p ) program="$OPTARG" ;;
|
p ) program="$OPTARG" ;;
|
||||||
? ) helpFunction ;;
|
? ) helpFunction ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
if [ -z "$type" ]; then
|
|
||||||
echo "Missing profiling type (flame / top)"
|
if [ -z "$type" ]; then
|
||||||
|
echo "Missing profiling type (flame / top)"
|
||||||
|
fi
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
program="$@"
|
||||||
|
program=${program/"--"/"-- --"}
|
||||||
|
|
||||||
|
# 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
|
fi
|
||||||
# Print helpFunction in case parameters are empty
|
command=`echo py-spy record -o "$output_file" python "$program"`
|
||||||
if [[ "$type" = "flame" ]]; then
|
echo "Running..." $command
|
||||||
if [ -z "$output_file" ] || [ -z "$program" ]; then
|
eval "$command"
|
||||||
echo "Some or all of the parameters are empty";
|
elif [[ "$type" = "top" ]]; then
|
||||||
helpFunction_flame
|
if [ -z "$program" ]; then
|
||||||
fi
|
echo "Some or all of the parameters are empty";
|
||||||
py-spy record -o "$output_file" python "$program"
|
helpFunction_top
|
||||||
elif [[ "$type" = "top" ]]; then
|
fi
|
||||||
if [ -z "$program" ]; then
|
command=`echo py-spy top python "$program"`
|
||||||
echo "Some or all of the parameters are empty";
|
echo "Running..." $command
|
||||||
helpFunction_top
|
eval "$command"
|
||||||
fi
|
fi
|
||||||
py-spy top python "$program"
|
|
||||||
fi
|
|
||||||
Reference in new issue
Block a user