11
ZPC
Re: This page loaded in x seconds
  • 2002/2/20 19:01

  • ZPC

  • Official Support Member

  • Posts: 76

  • Since: 2002/1/16


yes..it's not about the transfer of the page from the server to your browser, it's the time that took the server to parse all the php and sql command and print-out the output...

the time depends on things like server hardware (CPU, memory), operating system, apache+php+sql setup etc...

12
jasXoop
Re: This page loaded in x seconds
  • 2003/10/2 5:54

  • jasXoop

  • Just popping in

  • Posts: 22

  • Since: 2003/10/1


Hi,
It is hard to figure out what needs to be uncommented out and where, before the load times could be displayed on a site. I am testing XOOPS version 2.03, and would like to enable this feature on the site. A posting of a piece of the code and the location would be very helpful.

Thanks in advance for your help.

Jas.

13
brash
Re: This page loaded in x seconds
  • 2003/10/5 12:56

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


I'm using 2.0.4 and would also appreciate a bit more detail on how to do this. I'm having a few performance issues, and I don't want to have to leave the debug mode on to get load time information.

14
brash
Re: This page loaded in x seconds
  • 2003/10/5 23:04

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


^bump^

Reason I'm asking about this is the line number references seem to be different to what's stated above for 2.0.4, and I don't know what I should be looking for as I'm a PHP noob.

15
brash
Re: This page loaded in x seconds
  • 2003/10/6 6:05

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


OK, I've done a bit of reading and searching, and I keep coming back to the /class/logger.php file for XOOPS 2.X based systems. I found an XOOPS doc at SourceForge which I think is relevant, and it refers to the dumpTime function. I also fount this in the /class/logger.php file which looks to me to be relevant, but then again I can barely spell PHP let alone code it.

Quote:

/**
* get the current execution time of a timer
*
* @param string $name name of the counter
* @return float current execution time of the counter
*/
function dumpTime($name = 'XOOPS')
{
if (!isset($this->logstart[$name])) {
return 0;
}
if (!isset($this->logend[$name])) {
$stop_time = explode(' ', microtime());
} else {
$stop_time = $this->logend[$name];
}
return ((float)$stop_time[1] + (float)$stop_time[0]) - ((float)$this->logstart[$name][1] + (float)$this->logstart[$name][0]);
}



Can anyone tell me if I'm going down the right track with this, or even better how to implement this into my footer?

16
Olorin
Re: This page loaded in x seconds
  • 2003/10/6 14:06

  • Olorin

  • Just popping in

  • Posts: 50

  • Since: 2003/7/5 1


First,insert the following code to your theme.html.
Quote:

<{php}>
global $ftime;
echo"This page is loaded in $ftime seconds.";
<{/php}>

Second,insert this code to your footer.php,line 30.
Quote:
$ftime=$xoopsLogger->dumpTime();

BEFORE
Quote:

$xoopsLogger->stopTime();
if ($xoopsOption['theme_use_smarty'] == 0) {

AFTER
Quote:

$xoopsLogger->stopTime();
$ftime=$xoopsLogger->dumpTime();
if ($xoopsOption['theme_use_smarty'] == 0) {

I think there is a smarter solution. But it works at very least.

17
brash
Re: This page loaded in x seconds
  • 2003/10/7 1:20

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Thanks heaps for you help Olorin

I tried entering the code you posted into the theme.html file of the theme I am using (phpkaox), but nothing is printed to the screen (I placed it at the very bottom just before the tag) . I also tried putting the code into the footer (as this is where I was wanting it anyway), and all it seems to do was print the entire code to screen. I tried making an adaption to suit my needs;

Quote:
This page loaded in seconds


This prints correctly at in the footer, except the actual load time is absent as when I replace $ftime with text such as hello, the text is displayed, so I assume I'm missing something to get the $ftime value to print.

I also made the other code changes you specified. One thing I was wondering is what kicks off the time log? Would I have to include something like

Quote:
$xoopsLogger->startTime();


in the header.php to start the time logging process?

Thanks again

18
Olorin
Re: This page loaded in x seconds
  • 2003/10/7 13:01

  • Olorin

  • Just popping in

  • Posts: 50

  • Since: 2003/7/5 1


Quote:
This page loaded in seconds

This cord doesn't work since your theme file is html.

Quote:
$xoopsLogger->startTime();

And this function is already called in common.php

Thus my code should work with XOOPS 2.0.x. At least,it's working at my site...
Did you update your cache?

19
OldSwede
Re: This page loaded in x seconds
  • 2003/10/7 15:34

  • OldSwede

  • Just popping in

  • Posts: 26

  • Since: 2003/8/15


Thank you,

this works perfect for me with 2.0.4 and 2.0.5 RC

wr
oldswede

20
brash
Re: This page loaded in x seconds
  • 2003/10/8 1:00

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Thanks so much Olorin ! I was wondering where the time logging was kicked off.

I've also managed to get the page load time displayed in the footer just as I wanted. I searched phpkaox theme.html for this bit of code;

Quote:
<{$xoops_footer}>


Then just added your code directly after this, with a

tag on the end to space it out a bit. So after I added the code it looked like this;

Quote:

<{$xoops_footer}><{php}>global $ftime;
echo"This page is loaded in $ftime seconds.";
<{/php}>



You can see what it looks like at http://www.it-hq.org

Once again, thank you so much Olorin!

Login

Who's Online

397 user(s) are online (281 user(s) are browsing Support Forums)


Members: 0


Guests: 397


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits