[ic] Logging slow pages

Mark Johnson mark at endpoint.com
Wed Jun 14 07:51:40 EDT 2006


Bill Carr wrote:
> 
> On Jun 13, 2006, at 9:55 AM, Stefan Hornburg (Racke) wrote:
> 
>> Bill Carr wrote:
>>>
>>> And thanks to Racke for his tip. I did this:
>>> AutoLoad <<EOA
>>> [perl global=1]
>>>     $Tmp->{StartTime} = time;
>>> [/perl]
>>> EOA
>>
>> Global is not necessary for that. If the code above doesn't work, try
>> $Tag->tmp();
> I need global for 'time'. I thought it might not be necessary after I
> made my last post but I got the following when I took it away:
> /var/log/interchange/debug.log.1:Safe: 'time' trapped by operation mask
> at (tag 'perl') line 2.

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]

I think that addresses all Safe issues and allows you to use calcn
instead of perl, which has lower overhead.

Mark


--
Mark Johnson
End Point Corp.


More information about the interchange-users mailing list