[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] Logging slow pages



On Jun 14, 2006, at 7:51 AM, Mark Johnson wrote:

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.
Thank you. I have it hooked up and working.

Bill

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.