[ic] Logging slow pages

Peter peter at pajamian.dhs.org
Wed Jun 14 08:53:35 EDT 2006


On 06/14/2006 04:51 AM, Mark Johnson wrote:
> Use IC's [time] instead:
> [calcn]
> 	$Tag->tmpn('StartTime', $Tag->time({},'%s'));
> 	return;
> [/calcn]
> 
> Then you access it via $Scratch->{StartTime}:
> 
> [calcn]
>      my $long_page_time = $Variable->{LONG_PAGE_TIME} || 5;
>      my $page_time = $Tag->time({},'%s') - $Scratch->{StartTime};
>      if ($page_time >= $long_page_time) {
>           my $mv_page = $Tag->var('MV_PAGE',1);
>           my $remote_addr = $Session->{shost} || $Session->{ohost};
>           Debug(qq{Slow page: $Variable->{IC_CATALOG}/$mv_page, Time:
> $page_time, remote_host: $remote_addr, CGI:} .
>  ::uneval($CGI));
>      }
>      return;
> [/calcn]

You shouldn't need $Tag->tmpn.  Just set a global (initialise without 
my), it will hold till the end of the page...

[calcn]
	$start_time = $tag->time({},'%s');
	return;
[/calcn]

...

[calcn]
	my $long_page_time = $Variable->{LONG_PAGE_TIME} || 5;
	my $page_time = $tag->time({},'%s') - $start_time;

	...

[/calcn]

Peter


More information about the interchange-users mailing list