""Altmann, Michael"" skribis:
> I have been using xemacs and jde for quite a while, but I am not much of an
> elisp programmer. Could someone help me (or point me to the appropriate
> online resource) write the following elisp function? I have a java class
> called Timer that I use to time various chunks of code. It has methods
> startTimer and stopTimer that should surround any code I want to time. I
> would like an elisp function to insert calls to Timer for the current java
> method. For example, given a java program that looks like
>
[...]
>
> I would like code inserted like
>
[...]
> void bar() {
> Timer.startTimer("Test.bar");
> int x=3;
> Timer.stopTimer("Test.bar");
> }
> }
(Sorry for missing tabs, my newsreader ignores or deletes them.)
What should be done here?
---
int getValue() {
return super.getValue()*5;
}
---
The simple Version
---
int getValue() {
Timer.startTimer("Test.getValue()");
Timer.stopTimer("Test.getValue()");
return super.getValue() * 5;
}
---
is not really helpful (it does not time
anything time-consuming).
You may need something like
---
int getValue() {
Timer.startTimer("Test.getValue()");
int temp = super.getValue() * 5;
Timer.stopTimer("Test.getValue()");
return temp;
}
---
So your function has to choose a name for a
temporary variable, and using the right type ...
Sorry, this does not really help, but only
shows a possible problem.
Paul