Debugging and memory management

How do I test how much memory or CPU usage certain methods take? Or anything similar that may need testing?
THANKS

The profiler ca certainly help with some of this
It logs time & number of calls

having a similiar need, but in runtime, since i need to know how much memory a class uses while running