applechief
applechief

Reputation: 6895

Tracking php high cpu usage

I have a few codeigniter controllers executed through command line. They are big and complex scripts.

I've been experiencing high cpu loads on my server and tracked down the cause to those scripts.

Is there a way to know what part of the scripts is eating up the cpu?

The scripts are running on a ubuntu and php 5.3

Upvotes: 1

Views: 3800

Answers (2)

Jamoe
Jamoe

Reputation: 56

You could use some like xhprof to profile your php scripts. Profiling with xhprof

Upvotes: 3

stormdrain
stormdrain

Reputation: 7895

Use the built-in profiler

http://codeigniter.com/user_guide/general/profiling.html

$this->output->enable_profiler(TRUE);

edit:

sorry, just saw someone mentioned this in the comments... Leaving for posterity.

Upvotes: 1

Related Questions