I have a very slow Visualforce page. In order to find out why, I am adding a lot of System.debug() calls to the various methods on the controller to get timestamps etc to see what is so slow. So far I have code like this
public Boolean methodUsedByVisualForce() {
System.debug('Start methodUsedByVisualForce');
//lots of potentially slow work here
System.debug('End methodUsedByVisualForce');
}
However, instead of findind and typing the method name, I would love to just be able to quickly add code like:
String CurrentMethodName = //code to get current method name
System.debug('Start methodName');
Php has a __METHOD__ function that will return the current method. Does apex have something similar or a way to get that info?
I have don't lots of searching and reading, finding lots of solutions that are close, but not enough. For example I can get the current class name with this code:
String CurrentClassName = String.valueOf(this).substring(0,String.valueOf(this).indexOf(':'));
I can use this class and example to get on what edition of Saleforce, or if it is in a sandbox.
But what I want is the current method name. How would I do this?