xoops forums

sarahmx

Quite a regular
Posted on: 2010/6/12 0:00
sarahmx
sarahmx (Show more)
Quite a regular
Posts: 378
Since: 2007/10/28
#1

Execution Time in theme ?

i tried search but didn't find anything

How do i show page execution/loading time in theme.html


Thank You..

Catzwolf

Home away from home
Posted on: 2010/6/12 0:29
Catzwolf
Catzwolf (Show more)
Home away from home
Posts: 1392
Since: 2007/9/30
#2

Re: Execution Time in theme ?

This might help as it is all the info you will need, but how you implement it, is up to you. It should be a starting point.

Code:
$XoopsTime = $GLOBAL['xoopsLogger']->dumpTime( 'XOOPS' );
$XoopsQueries = count( $GLOBAL['xoopsLogger']->queries);

'<p align="center">Page generated <span style="color:#ff0000;">$XoopsTime</span> queries - Generation time: <span style="color:#ff0000;">' . sprintf( "%.4f", $XoopsTime ) . '</span> seconds</p>' . "\n";

I added this into Zarilia/Xoosla and it requires code changes to the core files, if you email me I will update it for Xoops and send you the code.

ghia

Community Support Member
Posted on: 2010/6/12 0:46
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#3

Re: Execution Time in theme ?

See FAQ.

Catzwolf

Home away from home
Posted on: 2010/6/12 0:53
Catzwolf
Catzwolf (Show more)
Home away from home
Posts: 1392
Since: 2007/9/30
#4

Re: Execution Time in theme ?

Which is 6 years old.......... interesting to see how far we have come in those years and fyi, the link is out of date.

sarahmx

Quite a regular
Posted on: 2010/6/12 6:50
sarahmx
sarahmx (Show more)
Quite a regular
Posts: 378
Since: 2007/10/28
#5

Re: Execution Time in theme ?

Thanks Ghia & Catzwolf


Catzwolf
Yes..please update the code to xoops Mr John ..put it in core..
where do i put the code ?

Ghia:
<{php}>
echo 
round(($GLOBALS['xoopsLogger']->dumpTime()), 3)." Seconds | ".count($GLOBALS['xoopsLogger']->queries)." Queries";
<{/
php}>


this is not working i got 0 second 7 queries for all pages..


I'm using XOOPS 2.4.4

underdog

Just popping in
Posted on: 2010/6/12 7:19
underdog
underdog (Show more)
Just popping in
Posts: 44
Since: 2007/6/21
#6

Re: Execution Time in theme ?

Try this:
<{php}> 
$XoopsTime $GLOBAL['xoopsLogger']->dumpTime'XOOPS' );
$XoopsQueries count$GLOBAL['xoopsLogger']->queries);

echo 
'<p align="center">Page generated <span style="color:#ff0000;">' $XoopsQueries '</span> queries - Generation time: <span style="color:#ff0000;">' sprintf"%.4f"$XoopsTime ) . '</span> seconds</p>' "\n";
<{/
php}>

sarahmx

Quite a regular
Posted on: 2010/6/12 8:29
sarahmx
sarahmx (Show more)
Quite a regular
Posts: 378
Since: 2007/10/28
#7

Re: Execution Time in theme ?

thank you underdog

i put your code in footer in my theme.html


i got this error in my theme

Fatal errorCall to a member function dumpTime() on a non-object in /xxxxx/xxxx/mydata/caches/smarty_compile/http%253A%252F%252Fxxxxxx%25%25axxxxxx-default^%%B5^B57^B5762074%%theme.html.php  on line 322



clear cache...same problem

underdog

Just popping in
Posted on: 2010/6/12 9:11
underdog
underdog (Show more)
Just popping in
Posts: 44
Since: 2007/6/21
#8

Re: Execution Time in theme ?

My mistake, really sorry.
It's not $GLOBAL but $GLOBALS
Try this:
<{php}> 
$XoopsTime $GLOBALS['xoopsLogger']->dumpTime'XOOPS' );
$XoopsQueries count$GLOBALS['xoopsLogger']->queries);

echo 
'<p align="center">Page generated <span style="color:#ff0000;">' $XoopsQueries '</span> queries - Generation time: <span style="color:#ff0000;">' sprintf"%.4f"$XoopsTime ) . '</span> seconds</p>' "\n";
<{/
php}>

Anonymous

Posted on: 2010/6/12 9:42
Anonymous
Anonymous (Show more)
Posts: 0
Since:
#9

Re: Execution Time in theme ?

Hi underdog .. remove extra <{php}> in your code and this code work only in case xoopslogger is activated.

underdog

Just popping in
Posted on: 2010/6/12 9:50
underdog
underdog (Show more)
Just popping in
Posts: 44
Since: 2007/6/21
#10

Re: Execution Time in theme ?

Thanx Mowaffaq
I edited my post and removed the extra <{php}> like you said.
Let's see if it works for sarahmx