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$
40 public CpuUsageView() {
41 super(Messages
.CpuUsageView_Title
);
45 public void createPartControl(Composite parent
) {
47 final SashForm sash
= new SashForm(parent
, SWT
.NONE
);
49 CpuUsageComposite treeViewer
= new CpuUsageComposite(sash
);
51 /* Build the XY chart part of the view */
52 TmfXYChartViewer xyViewer
= new CpuUsageXYViewer(sash
, treeViewer
);
54 sash
.setLayout(new FillLayout());
56 /* Initialize the viewers with the currently selected trace */
57 ITmfTrace trace
= getActiveTrace();
59 TmfTraceSelectedSignal signal
= new TmfTraceSelectedSignal(this, trace
);
60 treeViewer
.traceSelected(signal
);
61 xyViewer
.traceSelected(signal
);
67 public void setFocus() {