fa13572d4a746b2abd9d4c1bafdb60ba3914103a
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.ui / src / org / eclipse / linuxtools / internal / lttng2 / kernel / ui / views / cpuusage / CpuUsageView.java
1 /*******************************************************************************
2 * Copyright (c) 2014 École Polytechnique de Montréal
3 *
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
8 *
9 * Contributors:
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.cpuusage;
14
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;
23
24 /**
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
28 * the tree viewer.
29 *
30 * @author Geneviève Bastien
31 */
32 public class CpuUsageView extends TmfView {
33
34 /** ID string */
35 public static final String ID = "org.eclipse.linuxtools.lttng2.kernel.ui.views.cpuusage"; //$NON-NLS-1$
36
37 private CpuUsageComposite fTreeViewer = null;
38 private TmfXYChartViewer fXYViewer = null;
39
40 /**
41 * Constructor
42 */
43 public CpuUsageView() {
44 super(Messages.CpuUsageView_Title);
45 }
46
47 @Override
48 public void createPartControl(Composite parent) {
49
50 final SashForm sash = new SashForm(parent, SWT.NONE);
51
52 fTreeViewer = new CpuUsageComposite(sash);
53
54 /* Build the XY chart part of the view */
55 fXYViewer = new CpuUsageXYViewer(sash, fTreeViewer);
56
57 sash.setLayout(new FillLayout());
58
59 /* Initialize the viewers with the currently selected trace */
60 ITmfTrace trace = getActiveTrace();
61 if (trace != null) {
62 TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
63 fTreeViewer.traceSelected(signal);
64 fXYViewer.traceSelected(signal);
65 }
66
67 }
68
69 @Override
70 public void setFocus() {
71 }
72
73 @Override
74 public void dispose() {
75 super.dispose();
76 if (fTreeViewer != null) {
77 fTreeViewer.dispose();
78 }
79 if (fXYViewer != null) {
80 fXYViewer.dispose();
81 }
82 }
83
84 }
This page took 0.040783 seconds and 4 git commands to generate.