summaryrefslogtreecommitdiff
path: root/unittests/autotestscripts/subtests/file_size_monitor.pl
blob: fa834d34da25b933ba08a6bd3599e33eb23e67c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!perl

use File::Find;

# customize here
print "Running file size monitor\n";

LogDirectorySize("PC shader size", "../../../game/hl2/shaders","\.vcs","\.360\.vcs");
LogDirectorySize("PC Game Bin DLL size", "../../../game/bin/","\.dll","_360\.dll");
LogDirectorySize("360 shader size", "../../../game/hl2/shaders","\.360\.vcs");
LogDirectorySize("360 Game Bin DLL size", "../../../game/bin/","_360\.dll");
LogDirectorySize("tf texture size","../../../game/tf/materials/","\.vtf");







sub LogDirectorySize
  {
	my ($label, $basedir, $filepattern, $excludepattern ) = @_;
	undef @FileList;
	find(\&ProcessFile, $basedir);
	my $total_size = 0;
	foreach $_ (@FileList)
	  {
		next if ( length($excludepattern) && ( /$excludepattern/i ) );
		if (/$filepattern/i)
		{
		  $total_size += (-s $_ );
		}
	  }
	print "$label := $total_size\n";
  }

sub ProcessFile
  {
	push @FileList, $File::Find::name;
  }