Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2014-10-08 20:37:21 +0000
committerMarc-Andre Laperle2014-10-09 14:10:22 +0000
commit5d5dde8e3089464aacf0a47fc34b263f9c09ba7d (patch)
tree13de82f43b4c17c39e3fb104f93abac04a8f265d
parenta3ead63d8dd9ba9ad0988413ea7635583036e229 (diff)
downloadorg.eclipse.linuxtools-5d5dde8e3089464aacf0a47fc34b263f9c09ba7d.tar.gz
org.eclipse.linuxtools-5d5dde8e3089464aacf0a47fc34b263f9c09ba7d.tar.xz
org.eclipse.linuxtools-5d5dde8e3089464aacf0a47fc34b263f9c09ba7d.zip
tmf: Cache the result of gc.getFontMetrics in callstack view
This is a major performance bottleneck on Linux/GTK when a lot of elements are drawn. Change-Id: I5259a8910f08b6602801f97fc200b00b7c55c4a1 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/34605 Tested-by: Hudson CI Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackPresentationProvider.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackPresentationProvider.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackPresentationProvider.java
index 9eb7425da4..0fc2f6b774 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackPresentationProvider.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/CallStackPresentationProvider.java
@@ -44,6 +44,8 @@ public class CallStackPresentationProvider extends TimeGraphPresentationProvider
private final CallStackView fView;
+ private Integer fAverageCharWidth;
+
private enum State {
MULTIPLE (new RGB(100, 100, 100)),
EXEC (new RGB(0, 200, 0));
@@ -120,7 +122,10 @@ public class CallStackPresentationProvider extends TimeGraphPresentationProvider
@Override
public void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc) {
- if (bounds.width <= gc.getFontMetrics().getAverageCharWidth()) {
+ if (fAverageCharWidth == null) {
+ fAverageCharWidth = gc.getFontMetrics().getAverageCharWidth();
+ }
+ if (bounds.width <= fAverageCharWidth) {
return;
}
if (!(event instanceof CallStackEvent)) {

Back to the top