From: <bri...@us...> - 2003-07-17 05:25:10
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro In directory sc8-pr-cvs1:/tmp/cvs-serv28783/src/org/webmacro Modified Files: Broker.java Context.java WM.java WebMacro.java Log Message: Eliminate profiling and pooling Index: Broker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Broker.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Broker.java 16 Jul 2003 10:50:40 -0000 1.38 --- Broker.java 17 Jul 2003 05:25:06 -0000 1.39 *************** *** 20,29 **** package org.webmacro; - import org.webmacro.engine.*; - import org.webmacro.profile.Profile; - import org.webmacro.profile.ProfileCategory; - import org.webmacro.profile.ProfileSystem; - import org.webmacro.util.*; - import java.io.*; import java.lang.ref.WeakReference; --- 20,23 ---- *************** *** 33,36 **** --- 27,42 ---- import java.util.*; + import org.webmacro.engine.DefaultEvaluationExceptionHandler; + import org.webmacro.engine.EvaluationExceptionHandler; + import org.webmacro.engine.IntrospectionUtils; + import org.webmacro.engine.MethodWrapper; + import org.webmacro.engine.PropertyOperatorCache; + import org.webmacro.util.LogFile; + import org.webmacro.util.LogSystem; + import org.webmacro.util.LogTarget; + import org.webmacro.util.LogTargetFactory; + import org.webmacro.util.Settings; + import org.webmacro.util.SubSettings; + /** * The Broker is responsible for loading and initializing almost everything *************** *** 74,78 **** protected Log _log; - protected ProfileCategory _prof; private EvaluationExceptionHandler _eeHandler; --- 80,83 ---- *************** *** 286,314 **** } - // set up profiling - ProfileSystem ps = ProfileSystem.getInstance(); - int pRate = _config.getIntegerSetting("Profile.rate", 0); - int pTime = _config.getIntegerSetting("Profile.time", 60000); - - _log.debug("Profiling rate=" + pRate + " time=" + pTime); - - if ((pRate != 0) && (pTime != 0)) - { - _prof = ps.newProfileCategory(_name, pRate, pTime); - _log.debug("ProfileSystem.newProfileCategory: " + _prof); - } - else - { - _prof = null; - } - if (_prof != null) - { - _log.notice("Profiling started: " + _prof); - } - else - { - _log.info("Profiling not started."); - } - // set up providers _config.processListSetting("Providers", new ProviderSettingHandler()); --- 291,294 ---- *************** *** 691,695 **** /** ! * Retrieve a FastWriter from WebMacro's internal pool of FastWriters. * A FastWriter is used when writing templates to an output stream * --- 671,675 ---- /** ! * Get a new FastWriter * A FastWriter is used when writing templates to an output stream * *************** *** 797,810 **** { return Class.forName(name); - } - - /** - * Get a profile instance that can be used to instrument code. - * This instance must not be shared between threads. If profiling - * is currently disabled this method will return null. - */ - public Profile newProfile () - { - return (_prof == null) ? null : _prof.newProfile(); } --- 777,780 ---- Index: Context.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Context.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** Context.java 16 Jul 2003 06:44:59 -0000 1.62 --- Context.java 17 Jul 2003 05:25:06 -0000 1.63 *************** *** 69,74 **** = org.webmacro.engine.UndefinedMacro.getInstance(); - private org.webmacro.profile.Profile _prof = null; - /** * Create a new Context relative to the default WM instance --- 69,72 ---- *************** *** 83,101 **** public Context (Broker broker) { - _prof = broker.newProfile(); - if (_prof != null) - { - startTiming("Context life"); - } - if (_prof != null) - { - startTiming("Context init"); - } _broker = broker; _log = broker.getLog("context", "property and evaluation errors"); - if (_prof != null) - { - stopTiming(); - } } --- 81,86 ---- *************** *** 124,131 **** public Context cloneContext () { - if (_prof != null) - { - startTiming("cloneContext"); - } Context c; try --- 109,112 ---- *************** *** 138,143 **** return null; // never going to happen } - c._prof = _broker.newProfile(); - c.startTiming("Context life"); // stops in clear() c._teContext = new TemplateEvaluationContext(); if (_variables instanceof HashMap) --- 119,122 ---- *************** *** 149,156 **** c._variables = new HashMap(_variables); } - if (_prof != null) - { - stopTiming(); - } return c; } --- 128,131 ---- *************** *** 166,174 **** _variables.clear(); _eeHandler = null; - if (_prof != null) - { - stopTiming(); - _prof.destroy(); - } } --- 141,144 ---- *************** *** 583,678 **** ////////////////////////////////////////////////////////////// - - /** - * Return true if the Context contains an active profiler, and - * calls to startTiming/stopTiming will be counted. - */ - public final boolean isTiming () - { - return (_prof != null); - } - - /** - * Mark the start of an event for profiling. Note that you MUST - * call stop() or the results of profiling will be invalid. - */ - public final void startTiming (String name) - { - if (_prof == null) - { - return; - } - _prof.startEvent(name); - } - - /** - * Same as startTiming(name1 + "(" + arg + ")") but the concatenation - * of strings and the call to arg.toString() occurs only if profiling - * is enabled. - */ - public final void startTiming (String name1, Object arg) - { - if (_prof == null) - { - return; - } - _prof.startEvent(name1 + "(" + arg + ")"); - } - - /** - * Same as startTiming(name1 + "(" + arg1 + "," + arg2 + ")") but the - * concatenation of strings and the call to arg.toString() occurs only - * if profiling * is enabled. - */ - public final void startTiming (String name1, Object arg1, Object arg2) - { - if (_prof == null) - { - return; - } - _prof.startEvent(name1 + "(" + arg1 + ", " + arg2 + ")"); - } - - /** - * Same as startTiming(name1 + "(" + arg + ")") but the - * concatenation of strings and the call to toString() occurs only - * if profiling is enabled. - */ - public final void startTiming (String name, int arg) - { - if (_prof == null) - { - return; - } - _prof.startEvent(name + "(" + arg + ")"); - } - - /** - * Same as startTiming(name1 + "(" + arg + ")") but the - * concatenation of strings and the call to toString() occurs only - * if profiling is enabled. - */ - public final void startTiming (String name, boolean arg) - { - if (_prof == null) - { - return; - } - _prof.startEvent(name + "(" + arg + ")"); - } - - /** - * Mark the end of an event for profiling. Note that you MUST - * HAVE CALLED start() first or the results of profiling will - * be invalid. - */ - public final void stopTiming () - { - if (_prof == null) - { - return; - } - _prof.stopEvent(); - } /** --- 553,556 ---- Index: WM.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/WM.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** WM.java 16 Jul 2003 06:44:59 -0000 1.43 --- WM.java 17 Jul 2003 05:25:06 -0000 1.44 *************** *** 164,168 **** /** ! * Retrieve a FastWriter from WebMacro's internal pool of FastWriters. * A FastWriter is used when writing templates to an output stream * --- 164,168 ---- /** ! * Get a new FastWriter. * A FastWriter is used when writing templates to an output stream * Index: WebMacro.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/WebMacro.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** WebMacro.java 16 Jul 2003 06:44:59 -0000 1.16 --- WebMacro.java 17 Jul 2003 05:25:06 -0000 1.17 *************** *** 61,70 **** /** ! * Retrieve a FastWriter from WebMacro's internal pool of FastWriters. * A FastWriter is used when writing templates to an output stream.<p> * * If using a FastWriter directly, <b>always</b> make sure to <code>flush()</code> ! * and <code>close()</code> it when you're finished. Closing it ! * automatically returns back to the pool for later reuse. * * @param out The output stream the FastWriter should write to. Typically --- 61,69 ---- /** ! * Get a new FastWriter * A FastWriter is used when writing templates to an output stream.<p> * * If using a FastWriter directly, <b>always</b> make sure to <code>flush()</code> ! * and <code>close()</code> it when you're finished. * * @param out The output stream the FastWriter should write to. Typically |