gecko-dev/xpcom/doc/xpcom-log-analyze.sh

106 lines
2.8 KiB
Bash
Raw Normal View History

2000-05-05 07:24:30 +00:00
#!/bin/sh
#
# Shell script to analyze the xpcom log file
#
# Usage: xpcom-log-analize.sh [<logfile>] > xpcom-log.html
#
# You can generate the xpcom log file using:
# setenv NSPR_LOG_MODULES nsComponentManager:5
# setenv NSPR_LOG_FILE xpcom.log
# ./mozilla
# <quit>
#
2000-05-05 07:44:50 +00:00
# Contributors:
# Suresh Duddi <dp@netscape.com>
# Vamsee Nalagandla <vamsee9@hotmail.com>
#
2000-05-05 07:24:30 +00:00
if [ $# -gt 0 ]
then
logfile=$1
else
logfile=xpcom.log
fi
# make sure we got the logfile
if [ ! -f $logfile ]
then
echo "Error: Cannot find xpcom logfile $logfile"
exit -1
fi
echo "<HTML>"
echo "<HEAD>"
echo "<TITLE>XPCOM Log analysis dated:"
date
echo "</TITLE></HEAD>"
echo "<H1><center>"
echo "XPCOM Log analysis dated:"
date
echo "</center></H1>"
# ========================================================================
# Performance analysis
# ========================================================================
echo "<H2>Performance Analysis</H2>"
# Number of dlls loaded
2000-05-26 01:21:25 +00:00
n=`grep -i ': loading' ${logfile} | wc -l`
2000-05-05 07:24:30 +00:00
echo "<H3>Dlls Loaded : $n</H3>"
echo "<blockquote><pre>"
grep ': loading' $logfile
echo "</pre></blockquote>"
# Objects created with a histogram
2000-05-26 01:21:25 +00:00
n=`grep -i 'createinstance.*succeeded' ${logfile} | wc -l`
2000-05-05 07:24:30 +00:00
echo "<H3>Objects created : $n</H3>"
echo "<blockquote><pre>"
2000-05-26 01:21:25 +00:00
grep -i 'createinstance.*succeeded' ${logfile} | sort | uniq -c | sort -nr
2000-05-05 07:24:30 +00:00
echo "</pre></blockquote>"
# Number of RegisterFactory
n=`grep 'RegisterFactory' $logfile | wc -l`
echo "<H3>Factory registrations : $n</H3>"
echo "<blockquote><pre>"
grep 'RegisterFactory' $logfile
echo "</pre></blockquote>"
# Number of RegisterComponentCommon.
# XXX Order them by dllname
n=`grep 'RegisterComponentCommon({' $logfile | wc -l`
echo "<H3>Component Registrations : $n</H3>"
echo "<blockquote><pre>"
grep 'RegisterComponentCommon({' $logfile
echo "</pre></blockquote>"
# Number of succeeded calls to ContractIDToClassID() with histogram
n=`grep -i 'contractidtoclassid.*}' $logfile | wc -l`
echo "<H3>Count of succeeded ContractIDToClassID() : $n</H3>"
2000-05-05 07:24:30 +00:00
echo "<blockquote><pre>"
grep -i 'contractidtoclassid.*}' $logfile | sort | uniq -c | sort -nr
2000-05-05 07:24:30 +00:00
echo "</pre></blockquote>"
# ========================================================================
# Error analysis
# ========================================================================
echo "<H2>Error Analysis</H2>"
# CreateInstance() FAILED
n=`grep 'CreateInstance.*FAILED' $logfile | wc -l`
echo "<H3>Failed CreateInstance() : $n</H3>"
echo "<blockquote><pre>"
grep 'CreateInstance.*FAILED' $logfile
echo "</pre></blockquote>"
# ContractIDToClassID() FAILED with a histogram
n=`grep 'ContractIDToClassID.*FAILED' $logfile | wc -l`
echo "<H3>Failed ContractIDToClassID() : $n</H3>"
2000-05-05 07:24:30 +00:00
echo "<blockquote><pre>"
grep 'ContractIDToClassID.*FAILED' $logfile | sort | uniq -c | sort -nr
2000-05-05 07:24:30 +00:00
echo "</pre></blockquote>"
#
# Cleanup
echo "</HTML>"