1

Is there any plugin that I can use to determine the performance of the plugin that I'm writing?

I'm currently checking out the following plugins to determine any problems that might cause low performance:

  • cron-view
  • log deprecated notices
  • p3 profiler
  • core-control

But what I want to do is to be able to log how much time a method takes before it returns a value. The plugin that I've created is heavy on API access so I'm trying to cache everything that can be cache in the database and on the file system using the transients API.

Is there a plugin that can do this? how can I do this using the functions available in PHP?

Update

There's this PHP function called microtime() and it seems like the one that I need, but is there any way I can hook it up in Wordpress without having to do something like the function below on every function in the plugin?

public function fetch_data(){
  $start = microtime(true);
  $query->amazon($params);
  $time_spent = microtime(true) - $start;
  //log to file
}
  • I think there is no Wordpress hook that allow to grab the time spent for every function or method of your code. I think that you will have to do it with pure PHP. – cybmeta Sep 10 '13 at 5:44
  • 2
    Make yourself familiar with unit tests and Xdebug. Both can report the time a function needs to run. – fuxia Sep 10 '13 at 7:51
  • Interesting: How to test a plugin before release? – brasofilo Sep 12 '13 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.