/** * Starts the memory tracing. * * @param delay * Sleep delay between trace log iterations. * @param filename * Trace logfile name. */ public static synchronized void commence(long delay, String filename) { if (instance == null) { instance = new MemoryAnalyzer(delay, filename); usages = new ArrayList<String>(); // yeah, yeah, it's not multi-thread safe. sdf = new SimpleDateFormat("HH:mm:ss.SSS"); instance.start(); } }
/** * Simple constructor. * * @param delay * Sleep delay between trace log iterations. * @param filename * Trace logfile name. */ private MemoryAnalyzer(long delay, String filename) { super(); this.delay = delay; this.filename = filename; this.setName("Substance memory analyzer"); }
if (MemoryAnalyzer.isRunning()) { sb.append("\n"); MemoryAnalyzer.enqueueUsage("Blank " + width + "*" + height + "\n" + sb.toString());
requestStop(); while (!hasStopRequest()) { ArrayList<String> usages = getUsages(); for (String usage : usages) { bw.write(usage + "\n"); bw.write("\n"); } catch (IOException ioe) { this.requestStop(); } finally { if (bw != null) { sleep(this.delay); } catch (InterruptedException ie) {
.getVmParameter(SubstanceLookAndFeel.TRACE_FILE); if (paramTraceFile != null) { MemoryAnalyzer.commence(1000, paramTraceFile); for (Object plugin : SubstanceLookAndFeel.componentPlugins .getAvailablePlugins(true)) MemoryAnalyzer.enqueueUsage("Has plugin '" + plugin.getClass().getName() + "'");
requestStop(); } catch (Throwable t) { } finally {
if (MemoryAnalyzer.isRunning()) { sb.append("\n"); MemoryAnalyzer.enqueueUsage("Blank " + width + "*" + height + "\n" + sb.toString());
requestStop(); while (!hasStopRequest()) { ArrayList<String> usages = getUsages(); for (String usage : usages) { bw.write(usage + "\n"); bw.write("\n"); } catch (IOException ioe) { this.requestStop(); } finally { if (bw != null) { sleep(this.delay); } catch (InterruptedException ie) {
.getVmParameter(SubstanceLookAndFeel.TRACE_FILE); if (paramTraceFile != null) { MemoryAnalyzer.commence(1000, paramTraceFile); for (Object plugin : SubstanceLookAndFeel.componentPlugins .getAvailablePlugins(true)) MemoryAnalyzer.enqueueUsage("Has plugin '" + plugin.getClass().getName() + "'");
requestStop(); } catch (Throwable t) { } finally {
if (MemoryAnalyzer.isRunning()) { .append("\n"); MemoryAnalyzer.enqueueUsage("Blank " + width + "*" + height + "\n" + sb.toString());
/** * Starts the memory tracing. * * @param delay * Sleep delay between trace log iterations. * @param filename * Trace logfile name. */ public static synchronized void commence(long delay, String filename) { if (instance == null) { instance = new MemoryAnalyzer(delay, filename); usages = new ArrayList<String>(); // yeah, yeah, it's not multi-thread safe. sdf = new SimpleDateFormat("HH:mm:ss.SSS"); instance.start(); } }
/** * Simple constructor. * * @param delay * Sleep delay between trace log iterations. * @param filename * Trace logfile name. */ private MemoryAnalyzer(long delay, String filename) { super(); this.delay = delay; this.filename = filename; this.setName("Substance memory analyzer"); }
if (MemoryAnalyzer.isRunning()) { .append("\n"); MemoryAnalyzer.enqueueUsage("Blank " + width + "*" + height + "\n" + sb.toString());
/** * Sets maximized bounds according to the display screen insets. */ public void setMaximized() { Component tla = this.root.getTopLevelAncestor(); // fix for defect 213 - maximizing frame under multiple // screens shouldn't always use insets of the primary // screen. GraphicsConfiguration gc = (currentRootPaneGC != null) ? currentRootPaneGC : tla.getGraphicsConfiguration(); Rectangle screenBounds = gc.getBounds(); screenBounds.x = 0; screenBounds.y = 0; Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Rectangle maxBounds = new Rectangle( (screenBounds.x + screenInsets.left), (screenBounds.y + screenInsets.top), screenBounds.width - ((screenInsets.left + screenInsets.right)), screenBounds.height - ((screenInsets.top + screenInsets.bottom))); if (tla instanceof JFrame) ((JFrame) tla).setMaximizedBounds(maxBounds); if (MemoryAnalyzer.isRunning()) { MemoryAnalyzer.enqueueUsage("Frame set to bounds " + maxBounds); } }
/** * Sets maximized bounds according to the display screen insets. */ public void setMaximized() { Component tla = this.root.getTopLevelAncestor(); // fix for defect 213 - maximizing frame under multiple // screens shouldn't always use insets of the primary // screen. GraphicsConfiguration gc = (currentRootPaneGC != null) ? currentRootPaneGC : tla.getGraphicsConfiguration(); Rectangle screenBounds = gc.getBounds(); screenBounds.x = 0; screenBounds.y = 0; Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(gc); Rectangle maxBounds = new Rectangle( (screenBounds.x + screenInsets.left), (screenBounds.y + screenInsets.top), screenBounds.width - ((screenInsets.left + screenInsets.right)), screenBounds.height - ((screenInsets.top + screenInsets.bottom))); if (tla instanceof JFrame) ((JFrame) tla).setMaximizedBounds(maxBounds); if (MemoryAnalyzer.isRunning()) { MemoryAnalyzer.enqueueUsage("Frame set to bounds " + maxBounds); } }
if (MemoryAnalyzer.isRunning()) { MemoryAnalyzer.enqueueUsage("Root pane @" + root.hashCode() + "\n" + SubstanceCoreUtilities.getHierarchy(parent));
if (MemoryAnalyzer.isRunning()) { MemoryAnalyzer.enqueueUsage("Root pane @" + root.hashCode() + "\n" + SubstanceCoreUtilities.getHierarchy(parent));