line-of-code;
++counter-for-this-line;
before = System.currentTimeMillis();
line-of-code;
after = System.currentTimeMillis();
time-for-this-line += after-before;
Profiler
class and
build a Profiler
object for each line you want to profile.
Profiler()
-- create new profiler.
Profiler(String rep)
-- create a new profiler with the
textual representation of the line of code you're profiling.
pre()
-- Call immediately before the execution of a line you're
profiling.
post()
-- Call immediately after the execution of a line you're
profiling.
int count()
-- Get the number of times the line is executed.
int time()
-- Get the total amount of time spent executing that
line (plus, perhaps, the extra from these methods).
String report()
-- Give a simple report of the time spent.
profiler-for-this-line.pre();
line-of-code;
profiler-for-this-line.post();
profiler-for-this.class.pre(info-on-this-line);
line-of-code;
profiler-for-this.class.post(info-on-this-line);
Profiler
class is
also relatively straightforward; implementation of the
paremter-based one may be harder.
Profiler
class.
import Profiler
statement at the appropriate
point.
{ prof.pre(info); command; prof.post(info); }
java -t
.
Warning! This produces huge trace files.
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Fri Nov 21 08:21:12 1997.
This page generated on Fri Nov 21 08:23:46 1997 by SiteWeaver.
Contact our webmaster at rebelsky@math.grin.edu