equal
deleted
inserted
replaced
79 private static boolean perfLoggingOn = false; |
79 private static boolean perfLoggingOn = false; |
80 private static boolean useNanoTime = false; |
80 private static boolean useNanoTime = false; |
81 private static Vector<TimeData> times; |
81 private static Vector<TimeData> times; |
82 private static String logFileName = null; |
82 private static String logFileName = null; |
83 private static Writer logWriter = null; |
83 private static Writer logWriter = null; |
|
84 private static long baseTime; |
84 |
85 |
85 static { |
86 static { |
86 String perfLoggingProp = |
87 String perfLoggingProp = |
87 java.security.AccessController.doPrivileged( |
88 java.security.AccessController.doPrivileged( |
88 new sun.security.action.GetPropertyAction("sun.perflog")); |
89 new sun.security.action.GetPropertyAction("sun.perflog")); |
186 setStartTime(message, nowTime); |
187 setStartTime(message, nowTime); |
187 } |
188 } |
188 } |
189 } |
189 |
190 |
190 /** |
191 /** |
|
192 * Sets the base time, output can then |
|
193 * be displayed as offsets from the base time;. |
|
194 */ |
|
195 public static void setBaseTime(long time) { |
|
196 if (loggingEnabled()) { |
|
197 baseTime = time; |
|
198 } |
|
199 } |
|
200 |
|
201 /** |
191 * Sets the start time. |
202 * Sets the start time. |
192 * This version of the method is |
203 * This version of the method is |
193 * given the time to log, instead of expecting this method to |
204 * given the time to log, instead of expecting this method to |
194 * get the time itself. This is done in case the time was |
205 * get the time itself. This is done in case the time was |
195 * recorded much earlier than this method was called. |
206 * recorded much earlier than this method was called. |
279 synchronized(times) { |
290 synchronized(times) { |
280 for (int i = 0; i < times.size(); ++i) { |
291 for (int i = 0; i < times.size(); ++i) { |
281 TimeData td = times.get(i); |
292 TimeData td = times.get(i); |
282 if (td != null) { |
293 if (td != null) { |
283 writer.write(i + " " + td.getMessage() + ": " + |
294 writer.write(i + " " + td.getMessage() + ": " + |
284 td.getTime() + "\n"); |
295 (td.getTime() - baseTime) + "\n"); |
|
296 |
285 } |
297 } |
286 } |
298 } |
287 } |
299 } |
288 writer.flush(); |
300 writer.flush(); |
289 } catch (Exception e) { |
301 } catch (Exception e) { |