Re: script for checking average obj size?

From: Bernd P. Ziller <bziller@dont-contact.us>
Date: Fri, 17 Jan 1997 09:01:44 +0100

> Date: 16 Jan 1997 23:10:00 +0200
> From: A.Reeh@andromeda.wad.org (Andreas Reeh)

> does anybody have a script which checks the cache_dir and reports the true
> average object size ?

If you don't care about the headers counted in, i.e. you're only
interrested in the average file size in your cache-dir may be this
quick written perl script helps.

#!/usr/local/bin/perl

(($dir)=@ARGV)==1 || die "Usage: avgsize dir\n";

open(FIND, "find $dir -type f -print |") || die "open() : $!, stopped";
while(<FIND>)
{
  chop;
  $sum += -s;
  $count++;
}
close(FIND);
print "$count files with a total of $sum bytes\n";
print "which is an average of", int($sum/$count), " bytes per file\n";

Regards,

-- 
   Bernd                  bziller@ba-stuttgart.de
-------------------------------------------------
      http://www.ba-stuttgart.de/~bziller/
  Perry Rhodan - Blind Guardian - Morwen   Pages
   Ft. Bragg South Africa Nazi quiche Plutonium
munitions bomb Erpressung Hacker [Hello to all my
fans in domestic surveillance] World Trade Center
	   arrangements hashish spy G3
Received on Fri Jan 17 1997 - 00:50:09 MST

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