Benchmarking Nucleus
- Create a file calls benchmark_setup.txt
- Add the following lines into index.php, also all FancyURL script files if FancyURL is setup
- Create a file calls benchmark.txt
- Add the following code to the end of your skin
<?php if (!function_exists('getmtime')) { function getmtime() { $a = explode (' ',microtime()); return(double) $a[0] + $a[1]; } } // For benchmarking global $StartTime; $StartTime = getmtime(); ?>
//setup for benchmarking include('./benchmark_setup.txt');
<?php // There are some setup done in index.php..... if (!function_exists('getmtime')) { function getmtime() { $a = explode (' ',microtime()); return(double) $a[0] + $a[1]; } } global $StartTime; $loadtime = getmtime() - $StartTime; echo 'This page takes ' . $loadtime . ' to load<br />'; ?>
<%phpinclude(/path/to/blog/benchmark.txt)%>
Credit: Code steal shamelessly from: here
Comments
TeRanEX wrote:
Admun wrote:
Good idea... I will look into it.
Admun wrote:
Took a look, but it seems tricky... still trying..
TeRanEX wrote:
Maybe you can add this item as an article at the NUDN site, so that it will be easier to find it again in a few months? (maybe create a category 'performance' or something like that?).
Admun wrote:
I considered this is an article that NUDN should be linked to (just prefer to write from my NUDN member blog, which the Dev notes/Dev Info/code trace are my contribution to NUDN, General/My wwork are local to my blog), like many others I wrote.
Meanwhile, I don't think we need a performance category just yet.... I think just put in the article section is fine.
BTW, I was suggesting hcgtv to make a script to link other NUDN member site's posts on NUDN. I think we eventually want it.
Admun wrote:
Done, I linked all my articles to NUDN.
TeRanEX wrote:
just saw it. Nice
karma wrote:
To see which queries are executed during a request, I start mysqld using the --log option. Then I browse through the logfile (created in its data dir).
Another option would be to add some code in the sql_query() function (through which most of the Nucleus queries are executed)
Admun wrote:
Thx, karma.
Whoow! That's cool! I have always been wondering how to do this
Can you also add a method to count how many SQL-queries are executed?