linux.core: optimize system calls for memory usage
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 17 May 2016 14:56:47 +0000 (10:56 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 18 May 2016 15:30:03 +0000 (11:30 -0400)
Drop the arguments and return value and internalize the
Strings.

Change-Id: Id8ab76df2679917e1bcd3e76457ee8f6632bb5b0
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/72939
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCall.java
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/latency/SystemCallLatencyAnalysis.java

index 5c6c04be213715751ee912d665c4ccf64827c003..0b72c10289dffcdf3a03eb00df7868d961e21494 100644 (file)
 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<String, String> 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<String, String> 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<String, String> 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$
     }
 }
index 133a6ea130b9b2bc5023cd0cb0abc0f157ad719b..43cc6b6aca4ad60885b16197d7f733d2753c8b07 100644 (file)
@@ -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<String, String> 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);
             }
         }
This page took 0.027682 seconds and 5 git commands to generate.