xref: /trunk/main/slideshow/qa/debug/nodetree.sh (revision 99e66e07)
1#!/bin/sh
2# *************************************************************
3#
4#  Licensed to the Apache Software Foundation (ASF) under one
5#  or more contributor license agreements.  See the NOTICE file
6#  distributed with this work for additional information
7#  regarding copyright ownership.  The ASF licenses this file
8#  to you under the Apache License, Version 2.0 (the
9#  "License"); you may not use this file except in compliance
10#  with the License.  You may obtain a copy of the License at
11#
12#    http://www.apache.org/licenses/LICENSE-2.0
13#
14#  Unless required by applicable law or agreed to in writing,
15#  software distributed under the License is distributed on an
16#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17#  KIND, either express or implied.  See the License for the
18#  specific language governing permissions and limitations
19#  under the License.
20#
21# *************************************************************
22#
23#  $Revision: 1.3 $
24#
25#  Last changes: $Author$ $Date$
26#
27#  Generate node tree from verbose logfile
28#
29#  HOWTO USE
30#  =========
31#
32#  First of all, you need to recompile modules slideshow and canvas
33#  with VERBOSE=t set in the environment, and debug=t defined at the
34#  build tool command line. Then run your slideshow and redirect stdout
35#  to a file.
36#
37#  Then, call 'nodetree.sh trace-file > tree.ps' to generate a
38#  PostScript file for the AnimationNode tree generated during the show.
39#  Since these easily get pretty huge, use only one page, and try to
40#  limit the slide content (which have effects assigned, that is) to
41#  the bare minimum (to reproduce your bug, or whatever you need this
42#  for).
43#
44#  The generated output will have all nodes color-coded with their state
45#  at the point when the tree was dumped (see colors.sh for the color
46#  codes)
47#
48#  When looking for the mechanics that generate the relevant output,
49#  grep for the DEBUG_NODES_SHOWTREE macros in the slideshow source:
50#  Each such place dumps the current node tree to the trace output. Thus,
51#  if you need to check the tree state at other places or times, just add
52#  a DEBUG_NODES_SHOWTREE (or DEBUG_NODES_SHOWTREE_WITHIN, that is).
53#
54
55###################################################
56#
57# Generate node tree
58#
59###################################################
60
61egrep "Node connection|Node state" $1 | 										\
62	sed -e '/Node state/ s/.*Node state.*: \(.*\)/\1/' 							\
63		-e '/Node connection/ s/.*Node connection.*: \(n.*\)/\1/' | 			\
64																				\
65awk 'BEGIN { print "digraph Event_network {" }; { print } END { print "}" }' |	\
66																				\
67																				\
68# fill a complete A1 page with graph output
69dot -Gratio=fill -Gsize=23,33 -Tps
70#dot -Gratio=fill -Gorientation=land -Tps
71