0

Possible Duplicate:
PHP Profiler with method execution count, times etc. without extensions

So, I can't use xDebug or other stuff that requires to install a PECL extension or so, I have acces only to FTP, so I need to do some testing on a function that I use, it's an action from CodeIgniter.

So I looked in chrome with the inspector and I found that the response time for that page is 22 sec only for the backend(PHP functions used in that action) without the DOM stuff.

Does anyone know a good tool? to see what causes the load to be so huge.

Community
  • 1
  • 1
Uffo
  • 9,628
  • 24
  • 90
  • 154
  • 2
    Without placing something server side (like xdebug) to profile the application, you aren't going to be able to get much. Do you not have a development machine you can install xdebug/kcachegrind on? – Jeremy Harris May 27 '12 at 16:03
  • 1
    I asked that question before : http://stackoverflow.com/questions/10315124/php-profiler-with-method-execution-count-times-etc-without-extensions – Taha Paksu May 27 '12 at 16:03
  • @cillosis is right; you really should be doing dev work on either your local machine or a server that you have sufficient rights to that you can install xDebug. PHP, Apache and xDebug are all free and can all be installed on Linux, Windows or Mac, so whatever platform your PC is running, it is capable of running your PHP code and profiling it. Also bear in mind that profiling can generate some seriously large files -- I've seen them several hundred megs before -- so if you're paying for bandwidth you don't want to be downloading those from a remote server. – Spudley May 27 '12 at 16:21
  • I only have FTP. Does anyone know a good tool? What's that for a question. If you only have FTP, you obviously can't use the good tools. – hakre May 28 '12 at 10:59

2 Answers2

2

Without actual debugging tools, echo might be your only debugging tool. You can add $start_time = microtime(true) at the start of the entry point of your site, and you can print or log microtime(true) - $start_time at various positions in your code to track execution time.

lanzz
  • 42,060
  • 10
  • 89
  • 98
1

From the docs

$this->benchmark->mark('code_start');

// Some code happens here

$this->benchmark->mark('code_end');

echo $this->benchmark->elapsed_time('code_start', 'code_end');

This however wont tell you why your model/controller is loading slowly but you can encapsulate any request to narrow down the problematic load times. IE: You benchmark a model and realise this is making 4 queries.

Philip
  • 4,592
  • 2
  • 20
  • 28
  • He didn't say he hasn't access to it. He just can't do more modifying than ftp. – Ahatius May 27 '12 at 18:00
  • That makes NO sense what so ever! If you have access to FTP then you can upload/edit/modify files... – Philip May 27 '12 at 18:06
  • Seriously, what are you talking about. I never said you can't do that stuff with FTP. He just doesn't have more accessing methods than his browser and FTP. Your "PS" sentence didn't make any sense. – Ahatius May 27 '12 at 18:10