From: Matthew Khouzam Date: Tue, 17 May 2016 14:56:47 +0000 (-0400) Subject: linux.core: optimize system calls for memory usage X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=137512b371037d75a1a3589b0e043716ce408f5c;p=deliverable%2Ftracecompass.git linux.core: optimize system calls for memory usage Drop the arguments and return value and internalize the Strings. Change-Id: Id8ab76df2679917e1bcd3e76457ee8f6632bb5b0 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/72939 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann Reviewed-by: Genevieve Bastien Tested-by: Genevieve Bastien --- diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCall.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCall.java index 5c6c04be21..0b72c10289 100644 --- a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCall.java +++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCall.java @@ -10,13 +10,10 @@ package org.eclipse.tracecompass.internal.analysis.os.linux.core.latency; import java.io.Serializable; -import java.util.Map; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.tracecompass.segmentstore.core.ISegment; -import com.google.common.collect.ImmutableMap; - /** * A linux kernel system call, represented as an {@link ISegment}. * @@ -36,45 +33,35 @@ public class SystemCall implements ISegment { private final long fStartTime; private final String fName; - private final Map fArgs; /** * @param startTime * Start time of the system call * @param name * Name of the system call - * @param arguments - * Arguments of the system call */ public InitialInfo( long startTime, - String name, - Map arguments) { + String name) { fStartTime = startTime; fName = name; - fArgs = ImmutableMap.copyOf(arguments); } } private final InitialInfo fInfo; private final long fEndTime; - private final int fRet; /** * @param info * Initial information of the system call * @param endTime * End time of the system call - * @param ret - * Return value of the system call */ public SystemCall( InitialInfo info, - long endTime, - int ret) { + long endTime) { fInfo = info; fEndTime = endTime; - fRet = ret; } @Override @@ -96,24 +83,6 @@ public class SystemCall implements ISegment { return fInfo.fName; } - /** - * Get the arguments of the system call - * - * @return Map of the arguments - */ - public Map getArguments() { - return fInfo.fArgs; - } - - /** - * Get the return value of the system call - * - * @return Return value - */ - public int getReturnValue() { - return fRet; - } - @Override public int compareTo(@NonNull ISegment o) { int ret = ISegment.super.compareTo(o); @@ -128,8 +97,6 @@ public class SystemCall implements ISegment { return "Start Time = " + getStart() + //$NON-NLS-1$ "; End Time = " + getEnd() + //$NON-NLS-1$ "; Duration = " + getLength() + //$NON-NLS-1$ - "; Name = " + getName() + //$NON-NLS-1$ - "; Args = " + getArguments().toString() + //$NON-NLS-1$ - "; Return = " + getReturnValue(); //$NON-NLS-1$ + "; Name = " + getName(); //$NON-NLS-1$ } } diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCallLatencyAnalysis.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCallLatencyAnalysis.java index 133a6ea130..43cc6b6aca 100644 --- a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCallLatencyAnalysis.java +++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCallLatencyAnalysis.java @@ -18,8 +18,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; @@ -135,11 +133,7 @@ public class SystemCallLatencyAnalysis extends AbstractSegmentStoreAnalysisEvent long startTime = event.getTimestamp().getValue(); String syscallName = eventName.substring(layout.eventSyscallEntryPrefix().length()); - Map args = event.getContent().getFieldNames().stream() - .collect(Collectors.toMap(Function.identity(), - input -> checkNotNull(event.getContent().getField(input).toString()))); - - SystemCall.InitialInfo newSysCall = new SystemCall.InitialInfo(startTime, checkNotNull(syscallName), checkNotNull(args)); + SystemCall.InitialInfo newSysCall = new SystemCall.InitialInfo(startTime, syscallName.intern()); fOngoingSystemCalls.put(tid, newSysCall); } else if (eventName.startsWith(layout.eventSyscallExitPrefix())) { @@ -165,8 +159,7 @@ public class SystemCallLatencyAnalysis extends AbstractSegmentStoreAnalysisEvent } long endTime = event.getTimestamp().getValue(); - int ret = ((Long) event.getContent().getField("ret").getValue()).intValue(); //$NON-NLS-1$ - ISegment syscall = new SystemCall(info, endTime, ret); + ISegment syscall = new SystemCall(info, endTime); getSegmentStore().add(syscall); } }