1 /*******************************************************************************
2 * Copyright (c) 2015 École Polytechnique de Montréal
4 * All rights reserved. This program and the accompanying materials are made
5 * 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 * Francis Giraldeau - Initial implementation and API
11 * Geneviève Bastien - Initial implementation and API
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.analysis
.graph
.core
.base
;
19 * @author Francis Giraldeau
20 * @author Geneviève Bastien
22 public class TmfEdge
{
25 * Enumeration of the different types of edges
27 * FIXME: this sounds very specific to kernel traces, maybe it shouldn't be
30 * Comment by gbastien: I think the edge itself should be either a green
31 * light or a red light and there could be a context specific qualifier to
34 * How about something like this:
37 * public enum EdgeState {
40 * [,EPS] (for "fake" edge to allow 2 vertices at the same timestamp to many vertical edges)
43 * public ISomeInterface {
46 * public enum KernelEdgeType implements ISomeInterface {
47 * RUNNING, BLOCKED, INTERRUPTED, ...
50 * public class EdgeType {
51 * private EdgeState fState;
52 * private ISomeInterface fQualifier;
56 public enum EdgeType
{
59 * Special edge, so it is possible to have two vertices at the same
65 /** Default type for an edge */
67 /** Worker is running */
69 /** Worker is blocked */
71 /** Worker is in an interrupt state */
73 /** Worker is preempted */
77 /** Edge represents a network communication */
79 /** Worker is waiting for user input */
83 /** inter-processor interrupt */
87 private EdgeType fType
;
88 private final TmfVertex fVertexFrom
;
89 private final TmfVertex fVertexTo
;
95 * The vertex this edge leaves from
97 * The vertex the edge leads to
99 public TmfEdge(TmfVertex from
, TmfVertex to
) {
102 fType
= EdgeType
.DEFAULT
;
110 * Get the origin vertex of this edge
112 * @return The origin vertex
114 public TmfVertex
getVertexFrom() {
119 * Get the destination vertex of this edge
121 * @return The destination vertex
123 public TmfVertex
getVertexTo() {
130 * @return The type of the edge
132 public EdgeType
getType() {
142 public void setType(final EdgeType type
) {
147 * Returns the duration of the edge
149 * @return The duration (in nanoseconds)
151 public long getDuration() {
152 return fVertexTo
.getTs() - fVertexFrom
.getTs();
155 @SuppressWarnings("nls")
157 public String
toString() {
158 return "[" + fVertexFrom
+ "--" + fType
+ "->" + fVertexTo
+ "]";
This page took 0.039889 seconds and 5 git commands to generate.