linux.core: optimize system calls for memory usage
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / internal / analysis / os / linux / core / latency / SystemCall.java
CommitLineData
7b79ee46
FLN
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
660d4ed9 10package org.eclipse.tracecompass.internal.analysis.os.linux.core.latency;
7b79ee46 11
7b79ee46 12import java.io.Serializable;
7b79ee46 13
f1c52947 14import org.eclipse.jdt.annotation.NonNull;
7b79ee46 15import org.eclipse.tracecompass.segmentstore.core.ISegment;
7b79ee46 16
7b79ee46
FLN
17/**
18 * A linux kernel system call, represented as an {@link ISegment}.
19 *
20 * @author Alexandre Montplaisir
fb3a499b 21 * @since 2.0
7b79ee46
FLN
22 */
23public class SystemCall implements ISegment {
24
25 private static final long serialVersionUID = 1554494342105208730L;
26
7b79ee46
FLN
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;
7b79ee46
FLN
36
37 /**
38 * @param startTime
39 * Start time of the system call
40 * @param name
41 * Name of the system call
7b79ee46
FLN
42 */
43 public InitialInfo(
44 long startTime,
137512b3 45 String name) {
7b79ee46
FLN
46 fStartTime = startTime;
47 fName = name;
7b79ee46
FLN
48 }
49 }
50
51 private final InitialInfo fInfo;
52 private final long fEndTime;
7b79ee46
FLN
53
54 /**
55 * @param info
56 * Initial information of the system call
57 * @param endTime
58 * End time of the system call
7b79ee46
FLN
59 */
60 public SystemCall(
61 InitialInfo info,
137512b3 62 long endTime) {
7b79ee46
FLN
63 fInfo = info;
64 fEndTime = endTime;
7b79ee46
FLN
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
7b79ee46
FLN
77 /**
78 * Get the name of the system call
79 *
80 * @return Name
81 */
82 public String getName() {
83 return fInfo.fName;
84 }
85
7b79ee46 86 @Override
f1c52947
JCK
87 public int compareTo(@NonNull ISegment o) {
88 int ret = ISegment.super.compareTo(o);
89 if (ret != 0) {
90 return ret;
7b79ee46 91 }
f1c52947 92 return toString().compareTo(o.toString());
7b79ee46
FLN
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$
137512b3 100 "; Name = " + getName(); //$NON-NLS-1$
7b79ee46
FLN
101 }
102}
This page took 0.053183 seconds and 5 git commands to generate.