Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-01 22:31:57

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

How to get rendering time in live mode?

I’m looking for way to get rendering time which can be seen while debug-test modes. But i want this while site in live mode. Is it possible?

I want to prepare some statistic about site loading…


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#2 2010-04-02 02:40:19

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: How to get rendering time in live mode?

Yes, no, yes, no and yes. Basically yes.

  • Query times are in global $qtime.
  • Total query count is stored in $qcount.
  • Page rendering start time is stored in $microstart.

Using those we can do magic:

<txp:php>
	global $qtime, $qcount, $microstart;
	echo 
		'<!-- Runtime: '.(getmicrotime() - $microstart).'-->'.n.
		'<!-- Query time: '.$qtime.'-->'.n.
		'<!-- Queries: '.$qcount.'-->'.
		maxMemUsage('end of textpattern()',1)
	;
</txp:php>

Last edited by Gocom (2010-04-02 02:42:34)

Offline

#3 2010-04-02 08:12:50

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: How to get rendering time in live mode?

It works! Thanks!


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

Board footer

Powered by FluxBB