use of com.github.bordertech.wcomponents.monitor.UicStats in project wcomponents by BorderTech.
the class DevToolkit method getUicStats.
/**
* Retrieves statistics on the active UIContext, in a format suitable for rendering to the UI.
*
* @return statistics on the active UIContext.
*/
public String getUicStats() {
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
UicStats stats = new UicStats(UIContextHolder.getCurrent());
UicStatsAsHtml.write(printWriter, stats);
printWriter.close();
return writer.toString();
}
use of com.github.bordertech.wcomponents.monitor.UicStats in project wcomponents by BorderTech.
the class SimplePicker method afterPaint.
/**
* Override afterPaint in order to paint the UIContext serialization statistics if the profile button has been
* pressed.
*
* @param renderContext the renderContext to send output to.
*/
@Override
protected void afterPaint(final RenderContext renderContext) {
super.afterPaint(renderContext);
if (profileBtn.isPressed()) {
// UIC serialization stats
UicStats stats = new UicStats(UIContextHolder.getCurrent());
WComponent currentComp = this.getCurrentComponent();
if (currentComp != null) {
stats.analyseWC(currentComp);
}
if (renderContext instanceof WebXmlRenderContext) {
PrintWriter writer = ((WebXmlRenderContext) renderContext).getWriter();
writer.println("<hr />");
writer.println("<h2>Serialization Profile of UIC</h2>");
UicStatsAsHtml.write(writer, stats);
if (currentComp != null) {
writer.println("<hr />");
writer.println("<h2>ObjectProfiler - " + currentComp + "</h2>");
writer.println("<pre>");
try {
writer.println(ObjectGraphDump.dump(currentComp).toFlatSummary());
} catch (Exception e) {
LOG.error("Failed to dump component", e);
}
writer.println("</pre>");
}
}
}
}
Aggregations