1 /*******************************************************************************
2 * Copyright (c) 2014 École Polytechnique de Montréal
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.ui
.views
.cpuusage
;
15 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTraceSelectedSignal
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.xycharts
.TmfXYChartViewer
;
18 import org
.eclipse
.linuxtools
.tmf
.ui
.views
.TmfView
;
19 import org
.eclipse
.swt
.SWT
;
20 import org
.eclipse
.swt
.custom
.SashForm
;
21 import org
.eclipse
.swt
.layout
.FillLayout
;
22 import org
.eclipse
.swt
.widgets
.Composite
;
25 * CPU usage view. It contains 2 viewers: one tree viewer showing all the
26 * threads who were on the CPU in the time range, and one XY chart viewer
27 * plotting the total time spent on CPU and the time of the threads selected in
30 * @author Geneviève Bastien
32 public class CpuUsageView
extends TmfView
{
35 public static final String ID
= "org.eclipse.linuxtools.lttng2.kernel.ui.views.cpuusage"; //$NON-NLS-1$
37 private CpuUsageComposite fTreeViewer
= null;
38 private TmfXYChartViewer fXYViewer
= null;
43 public CpuUsageView() {
44 super(Messages
.CpuUsageView_Title
);
48 public void createPartControl(Composite parent
) {
50 final SashForm sash
= new SashForm(parent
, SWT
.NONE
);
52 fTreeViewer
= new CpuUsageComposite(sash
);
54 /* Build the XY chart part of the view */
55 fXYViewer
= new CpuUsageXYViewer(sash
, fTreeViewer
);
57 sash
.setLayout(new FillLayout());
59 /* Initialize the viewers with the currently selected trace */
60 ITmfTrace trace
= getActiveTrace();
62 TmfTraceSelectedSignal signal
= new TmfTraceSelectedSignal(this, trace
);
63 fTreeViewer
.traceSelected(signal
);
64 fXYViewer
.traceSelected(signal
);
70 public void setFocus() {
74 public void dispose() {
76 if (fTreeViewer
!= null) {
77 fTreeViewer
.dispose();
79 if (fXYViewer
!= null) {