3

I'm not experiencing any performance issues, however I'd like to take a look at what takes how long and how much memory cpu it uses etc.

I'd like to get a firsthand understanding of which things can be bottle necks etc and improve any code i might reuse or build upon... (perfectionist)

I'm looking to create a little function that i can call at the begining and end of each function that records:

  • execution time
  • memory used
  • cpu demand

any ideas?

i haven't used things like memory_get_usage(), or methods of recording time() before so would love to get some tips on their combined implementation

3 Answers 3

2

There are already a host of solutions made just for that, you might want to have a look at some of these:

XDEBUG EXTENSION FOR PHP

Xdebug's Profiler is a powerful tool that gives you the ability to analyze your PHP code and determine bottlenecks or generally see which parts of your code are slow and could use a speed boost.

Other Resource:

PHP Quick Profiler

Sign up to request clarification or add additional context in comments.

Comments

0

I haven't tested it a lot, but friend of mine recomended http://xdebug.org/ for profiling PHP

1 Comment

this looks far more powerful/coples than what i need, i was looking for a simple homemade function using some of php's built in functions like memory_get_usage() - will update question
0

Try using XDebug to debug your code flow. XDebug will generate some file that tell how well your codes, you can use Kcachegrind to visualize that files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.