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
}