Re: script for checking average obj size?

From: Kolics Bertold, University of Veszprem <bertold@dont-contact.us>
Date: Fri, 17 Jan 1997 10:02:03 +0100 (MET)

Dear All,

The scripts you sent are good, but they give *extra* overhead on the file
system. I suggest using the cache_swap_log file...

So, here is my script:

#!/bin/sh

# the squid configuration file - change it to your settings
CONF="/usr/local/squid/etc/squid.conf"

# find the swap log file
LOGFILE=`cat $CONF | grep "^cache_swap_log" | cut -d' ' -f2`

# if it is not set then the swap log resides in the first cache_dir entry
if [ "${LOGFILE}" = "" ]; then
CACHEDIR=`cat $CONF | grep "^cache_dir" | cut -d' ' -f2 | head -1`
LOGFILE=$CACHEDIR"/log"
fi

# do the calculation
awk ' BEGIN { a=0; } { a=a+$5 } END { print "avg_object_size:",a/NR, "bytes" } ' $LOGFILE
 

Yours,
Bertold

==-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==
 Kolics, Bertold E-Mail: bertold@tohotom.vein.hu
 University of Veszprem, Hungary W3: http://tohotom.vein.hu/~bertold/
 Information Engineering Course
==-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==
Received on Fri Jan 17 1997 - 01:11:20 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:34:06 MST