Access RAM Memory & CPU Usage By User Files

OK, I don't really now how this can be done, but as far as I can remember when I was in shared hosting, they always complaint about memory usage.... but they always know what specific files were cosing the most load on the server.

So, I remember I have this count.php file that was constantly hited and the complaint and tell me exactly what file it was cosing the heavy load.

This is just an example, but looks like they always knew the specific files that were cosing problems, so what the hell, this can be done!

Now that I have my own server I would like to know these things as well, so I can know what files need to be optimized.

I searched and searched and searched and... OK, you'll get the point, and I just HAVE NOT find any information on this.

Can someone tell me this "secret"? What do you use to get the files that are cosing the most heavy load on a Linux server?