[gtk-doc] gktdoc-mkhtml: add a GTKDOC_PROFILE envvar to activate xslt profiling



commit 76fcc30f36dc6896c5742a0488ec057b706c4a72
Author: Stefan Sauer <ensonic users sf net>
Date:   Wed Jul 1 18:11:27 2015 +0200

    gktdoc-mkhtml: add a GTKDOC_PROFILE envvar to activate xslt profiling

 HACKING          |   11 +++++++++++
 gtkdoc-mkhtml.in |   16 ++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/HACKING b/HACKING
index 4094594..3fa7aca 100644
--- a/HACKING
+++ b/HACKING
@@ -77,6 +77,17 @@ time xsltproc --nonet --xinclude --stringparam gtkdoc.bookname "tester" --string
 time saxon ../tester-docs.xml ../../../../gtk-doc.xsl gtkdoc.bookname="tester" gtkdoc.version="1.12"
 ~ 53 sec.
 
+xsltproc --profile data.xsl data.xml 2>report.txt
+cat report.txt | gprof2dot.py -e 0.01 -n 0.01 | dot -Tpng -o report.png
+
+one can now use "GTKDOC_PROFILE=1 make" to run this during gtkdoc-mkhtml. It
+still needs a change in gprof2dot.py
+https://bugzilla.gnome.org/show_bug.cgi?id=612186#c3
+
+Performance tips:
+* uses keys when we have slow xpath selects
+  http://www.xml.com/pub/a/2002/02/06/key-lookups.html
+
 Troubles with parsing regexps
 =============================
 Test regexps online:
diff --git a/gtkdoc-mkhtml.in b/gtkdoc-mkhtml.in
index 5012669..bbdb5c3 100644
--- a/gtkdoc-mkhtml.in
+++ b/gtkdoc-mkhtml.in
@@ -77,22 +77,30 @@ else
     path_arg="--path $searchpath"
 fi
 
-# Delete the old index.sgml file, if it exists.
-if test -f index.sgml; then
-  rm -f index.sgml
+# profiling
+profile_args=""
+if test "$GTKDOC_PROFILE" != ""; then
+  profile_args="--profile"
 fi
 
 #echo @XSLTPROC@ $path_arg --nonet --xinclude \
 #    --stringparam gtkdoc.bookname $module \
 #    --stringparam gtkdoc.version "@VERSION@" \
 #    "$@" $gtkdocdir/gtk-doc.xsl $document
- XSLTPROC@ $path_arg --nonet --xinclude \
+ XSLTPROC@ 2>profile.txt $profile_args $path_arg --nonet --xinclude \
     --stringparam gtkdoc.bookname $module \
     --stringparam gtkdoc.version "@VERSION@" \
     --stringparam chunk.quietly $quiet \
     --stringparam chunker.output.quiet $quiet \
     "$@" $gtkdocdir/gtk-doc.xsl $document || exit $?
 
+# profiling
+if test "$GTKDOC_PROFILE" != ""; then
+  cat profile.txt | gprof2dot.py -e 0.01 -n 0.01 | dot -Tpng -o profile.png
+else
+  rm profile.txt
+fi
+
 # copy navigation images and stylesheets to html directory ...
 cp -f $styledir/*.png $styledir/*.css ./
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]