summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-11-11 09:46:38 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-11-13 11:36:32 +0000
commit7ad2635ebe84ba7c050a7f00c5389cdc31ab1172 (patch)
treea1ef4d2c8548a25591cf5118482961ab17b9eb16
parentefa9e1088cbf1b5331cc0bab3348520f3b91ae4b (diff)
[trace] Disable stdout by default.
Don't hog the terminal when we save to a trace file anyway.
-rw-r--r--util/cairo-trace/cairo-trace.in48
1 files changed, 29 insertions, 19 deletions
diff --git a/util/cairo-trace/cairo-trace.in b/util/cairo-trace/cairo-trace.in
index 93bb954c..c9be5a68 100644
--- a/util/cairo-trace/cairo-trace.in
+++ b/util/cairo-trace/cairo-trace.in
@@ -4,20 +4,43 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
nofile=
-silent=
+verbose=
+
+usage() {
+cat << EOF
+usage: cairo-trace [--no-file|--verbose] command
+cairo-trace will generate a log of all calls made by command to
+cairo. This log will be stored in a file in the local directory
+called command.pid.trace.
+Whatever else happens is driven by its argument:
+ --verbose - Show the trace on stdout.
+ --no-file - disables the generation of an output file
+
+Enviroment variables understood by cairo-trace:
+ CAIRO_TRACE_FLUSH - flush the output after every function call.
+EOF
+exit
+}
skip=1
while test $skip -eq 1; do
skip=0
case $1 in
- --silent)
+ --verbose)
skip=1
- silent=1
+ verbose=1
;;
--no-file)
skip=1
nofile=1
;;
+ --version)
+ echo "cairo-trace, version @CAIRO_VERSION_MAJOR@.@CAIRO_VERSION_MINOR@.@CAIRO_VERSION_MICRO@."
+ exit
+ ;;
+ --help)
+ usage
+ ;;
esac
if test $skip -eq 1; then
shift
@@ -25,21 +48,7 @@ while test $skip -eq 1; do
done
if test $# -eq 0; then
-cat << EOF
-usage: cairo-trace [--no-file|--silent] command
-cairo-trace will generate a log of all calls made by command to
-cairo. This log will be stored in a file in the local directory
-called command.pid.trace.
-Whatever else happens is driven by its argument:
- --silent - disables the overriding of stdout by cairo-trace.
- The trace file is still generated, but your application
- is free to continue to use stdout.
- --no-file - disables the generation of an output file
-
-Enviroment variables understood by cairo-trace:
- CAIRO_TRACE_FLUSH - flush the output after every function call.
-EOF
-exit
+ usage
fi
#echo $*
@@ -58,7 +67,8 @@ export LC_ALL
if test -z "$filename"; then
CAIRO_TRACE_FD=3 $* 3>&1 >/dev/null
-elif test -n "$silent"; then
+elif test -z "$verbose"; then
+ echo "Recording trace in $filename."
CAIRO_TRACE_OUTFILE_EXACT=$filename $*
else
CAIRO_TRACE_FD=3 $* 3>&1 >/dev/null | tee $filename