#!/bin/sh # These are options to change depending on site-specifics: GTK_2_6_DIR=/opt/gtk-2.6 GTK_2_10_DIR=/opt/gtk-2.10 EXCLUDE_THEMES='\(Default\|Emacs\|Raleigh\)' html_header() { title=$1 cat < $title

$title

EOT } html_footer() { cat < EOT } tab_to_html() { read title html_header "$title" sed -e ' /^#/ s,^#,#, /^[^#]/ s,^,, /^#/ s,^#,,' html_footer } process_theme() { theme=$1 awk '{print $1 " " $2+$3+$4+$5}' gtk-2.6 > boot-2.6 awk '{print $2+$3+$4+$5}' gtk-2.10 > boot-2.10 echo "$theme \"boot\" performance of GTK+ 2.10 relative to 2.6" > boot echo -e "#Widget\t2.6 Time\t2.10 Time\t2.10 / 2.6" >> boot paste boot-2.6 boot-2.10 | grep -v ^# | awk '{printf "%s\t%.2f\t%.2f\t%.2f\n", $1, $2, $3, $3 / $2}' >> boot awk '{print $1 " " $6}' gtk-2.6 > expose-2.6 awk '{print $6}' gtk-2.10 > expose-2.10 echo "$theme \"expose\" performance of GTK+ 2.10 relative to 2.6" > expose echo -e "#Widget\t2.6 Time\t2.10 Time\t2.10 / 2.6" >> expose paste expose-2.6 expose-2.10 | grep -v ^# | awk '{printf "%s\t%.2f\t%.2f\t%.2f\n", $1, $2, $3, $3 / $2}' >> expose awk '{print $1 " " $7}' gtk-2.6 > resize-2.6 awk '{print $7}' gtk-2.10 > resize-2.10 echo "$theme \"resize\" performance of GTK+ 2.10 relative to 2.6" > resize echo -e "#Widget\t2.6 Time\t2.10 Time\t2.10 / 2.6" >> resize paste resize-2.6 resize-2.10 | grep -v ^# | awk '{printf "%s\t%.2f\t%.2f\t%.2f\n", $1, $2, $3, $3 / $2}' >> resize bootavg=$(awk '{ lines++; total=total+$4 }; END { printf "%.2f", total / lines }' boot) exposeavg=$(awk '{ lines++; total=total+$4 }; END { printf "%.2f", total / lines }' expose) resizeavg=$(awk '{ lines++; total=total+$4 }; END { printf "%.2f", total / lines }' resize) tab_to_html < boot > boot.html tab_to_html < expose > expose.html tab_to_html < resize > resize.html echo -e "$bootavg\t$exposeavg\t$resizeavg" rm boot-2.6 boot-2.10 expose-2.6 expose-2.10 resize-2.6 resize-2.10 } process_results() { title="Performance comparison of GTK+ 2.10 relative to GTK+ 2.6 for various themes." html_header "$title" echo "" for theme in $(find . -mindepth 1 -maxdepth 1 -type d ); do theme=$(basename $theme); echo -n "" cd $theme; process_theme $theme | sed -e " s,^,," cd ..; done html_footer } export LD_LIBRARY_PATH=$GTK_2_6_DIR/lib for theme in $(find $GTK_2_6_DIR/share/themes -mindepth 1 -maxdepth 1 | grep -v $EXCLUDE_THEMES); do gtk-theme-switch2 $theme theme=$(basename $theme) mkdir -p html/$theme ./torturer -t > html/$theme/gtk-2.6 done export LD_LIBRARY_PATH=$GTK_2_10_DIR/lib for theme in $(find $GTK_2_10_DIR/share/themes -mindepth 1 -maxdepth 1 | grep -v $EXCLUDE_THEMES); do gtk-theme-switch2 $theme theme=$(basename $theme) mkdir -p html/$theme ./torturer -t > html/$theme/gtk-2.10 done cd html process_results > index.html
, /^#/ s,\t,,g /^#/ s,$,
, /^[^#]/ s,\t,,g /^[^#]/ s,$,
ThemeBootExposeResize
$theme, s,\t,, s,\t,, s,$,