c67d0e6263c41f4f84fbb7c38b18ed12a85914b0
1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 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
.jdt
.annotation
.NonNull
;
17 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
18 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
19 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.TimeGraphEntry
;
22 * An entry, or row, in the resource view
24 * @author Patrick Tasse
26 public class ResourcesEntry
extends TimeGraphEntry
implements Comparable
<ITimeGraphEntry
> {
28 /** Type of resource */
29 public static enum Type
{
30 /** Null resources (filler rows, etc.) */
32 /** Entries for CPUs */
34 /** Entries for IRQs */
36 /** Entries for Soft IRQ */
40 private final int fId
;
41 private final @NonNull ITmfTrace fTrace
;
42 private final Type fType
;
43 private final int fQuark
;
49 * The attribute quark matching the entry
51 * The trace on which we are working
53 * The exec_name of this entry
55 * The start time of this entry lifetime
57 * The end time of this entry
59 * The type of this entry
61 * The id of this entry
63 public ResourcesEntry(int quark
, @NonNull ITmfTrace trace
, String name
,
64 long startTime
, long endTime
, Type type
, int id
) {
65 super(name
, startTime
, endTime
);
76 * The trace on which we are working
78 * The exec_name of this entry
80 * The start time of this entry lifetime
82 * The end time of this entry
84 * The id of this entry
86 public ResourcesEntry(@NonNull ITmfTrace trace
, String name
,
87 long startTime
, long endTime
, int id
) {
88 this(-1, trace
, name
, startTime
, endTime
, Type
.NULL
, id
);
95 * The attribute quark matching the entry
97 * The trace on which we are working
99 * The start time of this entry lifetime
101 * The end time of this entry
103 * The type of this entry
105 * The id of this entry
107 public ResourcesEntry(int quark
, @NonNull ITmfTrace trace
,
108 long startTime
, long endTime
, Type type
, int id
) {
109 this(quark
, trace
, type
.toString() + " " + id
, startTime
, endTime
, type
, id
); //$NON-NLS-1$
115 * @return the entry's id
122 * Get the entry's trace
124 * @return the entry's trace
126 public @NonNull ITmfTrace
getTrace() {
131 * Get the entry Type of this entry. Uses the inner Type enum.
133 * @return The entry type
135 public Type
getType() {
140 * Retrieve the attribute quark that's represented by this entry.
142 * @return The integer quark The attribute quark matching the entry
144 public int getQuark() {
149 public boolean hasTimeEvents() {
150 if (fType
== Type
.NULL
) {
157 public int compareTo(ITimeGraphEntry other
) {
158 if (!(other
instanceof ResourcesEntry
)) {
159 /* Should not happen, but if it does, put those entries at the end */
162 ResourcesEntry o
= (ResourcesEntry
) other
;
165 * Resources entry names should all be of type "ABC 123"
167 * We want to filter on the Type first (the "ABC" part), then on the ID
168 * ("123") in numerical order (so we get 1,2,10 and not 1,10,2).
170 int ret
= this.getType().compareTo(o
.getType());
174 return Integer
.compare(this.getId(), o
.getId());
This page took 0.0489 seconds and 4 git commands to generate.