lttng: Add a view for the CPU usage analysis
[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 /**
38 * Constructor
39 */
40 public CpuUsageView() {
41 super(Messages.CpuUsageView_Title);
42 }
43
44 @Override
45 public void createPartControl(Composite parent) {
46
47 final SashForm sash = new SashForm(parent, SWT.NONE);
48
49 CpuUsageComposite treeViewer = new CpuUsageComposite(sash);
50
51 /* Build the XY chart part of the view */
52 TmfXYChartViewer xyViewer = new CpuUsageXYViewer(sash, treeViewer);
53
54 sash.setLayout(new FillLayout());
55
56 /* Initialize the viewers with the currently selected trace */
57 ITmfTrace trace = getActiveTrace();
58 if (trace != null) {
59 TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
60 treeViewer.traceSelected(signal);
61 xyViewer.traceSelected(signal);
62 }
63
64 }
65
66 @Override
67 public void setFocus() {
68 }
69
70 }
This page took 0.034614 seconds and 6 git commands to generate.