0b72c10289dffcdf3a03eb00df7868d961e21494
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / internal / analysis / os / linux / core / latency / SystemCall.java
1 /*******************************************************************************
2 * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
10 package org.eclipse.tracecompass.internal.analysis.os.linux.core.latency;
11
12 import java.io.Serializable;
13
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.tracecompass.segmentstore.core.ISegment;
16
17 /**
18 * A linux kernel system call, represented as an {@link ISegment}.
19 *
20 * @author Alexandre Montplaisir
21 * @since 2.0
22 */
23 public class SystemCall implements ISegment {
24
25 private static final long serialVersionUID = 1554494342105208730L;
26
27 /**
28 * The subset of information that is available from the syscall entry event.
29 */
30 public static class InitialInfo implements Serializable {
31
32 private static final long serialVersionUID = -5009710718804983721L;
33
34 private final long fStartTime;
35 private final String fName;
36
37 /**
38 * @param startTime
39 * Start time of the system call
40 * @param name
41 * Name of the system call
42 */
43 public InitialInfo(
44 long startTime,
45 String name) {
46 fStartTime = startTime;
47 fName = name;
48 }
49 }
50
51 private final InitialInfo fInfo;
52 private final long fEndTime;
53
54 /**
55 * @param info
56 * Initial information of the system call
57 * @param endTime
58 * End time of the system call
59 */
60 public SystemCall(
61 InitialInfo info,
62 long endTime) {
63 fInfo = info;
64 fEndTime = endTime;
65 }
66
67 @Override
68 public long getStart() {
69 return fInfo.fStartTime;
70 }
71
72 @Override
73 public long getEnd() {
74 return fEndTime;
75 }
76
77 /**
78 * Get the name of the system call
79 *
80 * @return Name
81 */
82 public String getName() {
83 return fInfo.fName;
84 }
85
86 @Override
87 public int compareTo(@NonNull ISegment o) {
88 int ret = ISegment.super.compareTo(o);
89 if (ret != 0) {
90 return ret;
91 }
92 return toString().compareTo(o.toString());
93 }
94
95 @Override
96 public String toString() {
97 return "Start Time = " + getStart() + //$NON-NLS-1$
98 "; End Time = " + getEnd() + //$NON-NLS-1$
99 "; Duration = " + getLength() + //$NON-NLS-1$
100 "; Name = " + getName(); //$NON-NLS-1$
101 }
102 }
This page took 0.037638 seconds and 4 git commands to generate.