1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Ericsson, É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 * Patrick Tasse - Initial API and implementation
11 * Geneviève Bastien - Move code to provide base classes for time graph view
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.ui
.views
.resources
;
16 import org
.eclipse
.linuxtools
.lttng2
.kernel
.core
.trace
.LttngKernelTrace
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.TimeGraphEntry
;
20 * An entry, or row, in the resource view
22 * @author Patrick Tasse
24 public class ResourcesEntry
extends TimeGraphEntry
{
26 /** Type of resource */
27 public static enum Type
{
28 /** Null resources (filler rows, etc.) */
30 /** Entries for CPUs */
32 /** Entries for IRQs */
34 /** Entries for Soft IRQ */
38 private final int fId
;
39 private final LttngKernelTrace fTrace
;
40 private final Type fType
;
41 private final int fQuark
;
47 * The attribute quark matching the entry
49 * The trace on which we are working
51 * The exec_name of this entry
53 * The start time of this entry lifetime
55 * The end time of this entry
57 * The type of this entry
59 * The id of this entry
61 public ResourcesEntry(int quark
, LttngKernelTrace trace
, String name
, long startTime
, long endTime
, Type type
, int id
) {
62 super(name
, startTime
, endTime
);
73 * The trace on which we are working
75 * The exec_name of this entry
77 * The start time of this entry lifetime
79 * The end time of this entry
81 * The id of this entry
83 public ResourcesEntry(LttngKernelTrace trace
, String name
, long startTime
, long endTime
, int id
) {
84 this(-1, trace
, name
, startTime
, endTime
, Type
.NULL
, id
);
91 * The attribute quark matching the entry
93 * The trace on which we are working
95 * The start time of this entry lifetime
97 * The end time of this entry
99 * The type of this entry
101 * The id of this entry
103 public ResourcesEntry(int quark
, LttngKernelTrace trace
, long startTime
, long endTime
, Type type
, int id
) {
104 this(quark
, trace
, type
.toString() + " " + id
, startTime
, endTime
, type
, id
); //$NON-NLS-1$
110 * @return the entry's id
117 * Get the entry's kernel trace
119 * @return the entry's kernel trace
121 public LttngKernelTrace
getTrace() {
126 * Get the entry Type of this entry. Uses the inner Type enum.
128 * @return The entry type
130 public Type
getType() {
135 * Retrieve the attribute quark that's represented by this entry.
137 * @return The integer quark The attribute quark matching the entry
139 public int getQuark() {
144 public boolean hasTimeEvents() {
145 if (fType
== Type
.NULL
) {
152 * Add a child to this entry of type ResourcesEntry
157 public void addChild(ResourcesEntry entry
) {
159 for (index
= 0; index
< getChildren().size(); index
++) {
160 ResourcesEntry other
= (ResourcesEntry
) getChildren().get(index
);
161 if (entry
.getType().compareTo(other
.getType()) < 0) {
163 } else if (entry
.getType().equals(other
.getType())) {
164 if (entry
.getId() < other
.getId()) {
170 entry
.setParent(this);
171 getChildren().add(index
, entry
);
This page took 0.033928 seconds and 5 git commands to generate.