ctf: Fix formatting in CTFTrace
authorSimon Delisle <simon.delisle@ericsson.com>
Tue, 21 May 2013 19:22:27 +0000 (15:22 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Wed, 26 Jun 2013 19:41:43 +0000 (15:41 -0400)
Change-Id: I416204b08281e0bb66b5c1389a4ec03b247a2828
Signed-off-by: Simon Delisle <simon.delisle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/13032
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java

index 9c3553dc129823e13287a0d0ddb53da3d2394df0..40b367710bbc2d9af996dbc0a883a53bb8dd6b24 100644 (file)
@@ -117,7 +117,7 @@ public class CTFTrace implements IDefinitionScope {
     /**
      * Collection of streams contained in the trace.
      */
-    private final Map<Long, Stream> streams =  new HashMap<Long, Stream>();
+    private final Map<Long, Stream> streams = new HashMap<Long, Stream>();
 
     /**
      * Collection of environment variables set by the tracer
@@ -137,7 +137,7 @@ public class CTFTrace implements IDefinitionScope {
     private static final Comparator<File> METADATA_COMPARATOR = new MetadataComparator();
 
     /** map of all the event types */
-    private final Map<Long,HashMap<Long, IEventDeclaration>> eventDecs = new HashMap<Long, HashMap<Long,IEventDeclaration>>();
+    private final Map<Long, HashMap<Long, IEventDeclaration>> eventDecs = new HashMap<Long, HashMap<Long, IEventDeclaration>>();
 
     /** map of all the indexes */
     private final Map<StreamInput, StreamInputPacketIndex> indexes = new HashMap<StreamInput, StreamInputPacketIndex>();
@@ -148,8 +148,6 @@ public class CTFTrace implements IDefinitionScope {
     /** Callsite helpers */
     private TreeSet<CTFCallsite> callsitesByIP = new TreeSet<CTFCallsite>();
 
-
-
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
@@ -194,8 +192,7 @@ public class CTFTrace implements IDefinitionScope {
         /* Open all the trace files */
         /* Create the definitions needed to read things from the files */
         if (packetHeaderDecl != null) {
-            packetHeaderDef = packetHeaderDecl.createDefinition(this,
-                    "packet.header"); //$NON-NLS-1$
+            packetHeaderDef = packetHeaderDecl.createDefinition(this, "packet.header"); //$NON-NLS-1$
         }
 
         /* List files not called metadata and not hidden. */
@@ -232,6 +229,7 @@ public class CTFTrace implements IDefinitionScope {
 
     /**
      * Dispose the trace
+     *
      * @since 2.0
      */
     public void dispose() {
@@ -244,7 +242,8 @@ public class CTFTrace implements IDefinitionScope {
                 }
             }
         }
-        System.gc(); // Invoke GC to release MappedByteBuffer objects (Java bug JDK-4724038)
+        // Invoke GC to release MappedByteBuffer objects (Java bug JDK-4724038)
+        System.gc();
     }
 
     // ------------------------------------------------------------------------
@@ -265,17 +264,18 @@ public class CTFTrace implements IDefinitionScope {
 
     /**
      * Gets an index for a given StreamInput
-     * @param id the StreamInput
+     *
+     * @param id
+     *            the StreamInput
      * @return The index
      */
-    StreamInputPacketIndex getIndex(StreamInput id){
-        if(! indexes.containsKey(id)){
+    StreamInputPacketIndex getIndex(StreamInput id) {
+        if (!indexes.containsKey(id)) {
             indexes.put(id, new StreamInputPacketIndex());
         }
         return indexes.get(id);
     }
 
-
     /**
      * Gets an event Declaration hashmap for a given StreamInput
      *
@@ -283,8 +283,8 @@ public class CTFTrace implements IDefinitionScope {
      *            the StreamInput
      * @return an empty hashmap, please see deprecated
      * @since 2.0
-     * @deprecated You should be using {@link StreamInputReader#getEventDefinitions()}
-     *             instead.
+     * @deprecated You should be using
+     *             {@link StreamInputReader#getEventDefinitions()} instead.
      */
     @Deprecated
     public Map<Long, EventDefinition> getEventDefs(StreamInput id) {
@@ -529,7 +529,7 @@ public class CTFTrace implements IDefinitionScope {
             fc = fis.getChannel();
 
             /* Map one memory page of 4 kiB */
-            byteBuffer = fc.map(MapMode.READ_ONLY, 0, Math.min((int)fc.size(), 4096));
+            byteBuffer = fc.map(MapMode.READ_ONLY, 0, Math.min((int) fc.size(), 4096));
         } catch (IOException e) {
             /* Shouldn't happen at this stage if every other check passed */
             throw new CTFReaderException(e);
@@ -572,7 +572,8 @@ public class CTFTrace implements IDefinitionScope {
             /* Read the stream ID */
             Definition streamIDDef = packetHeaderDef.lookupDefinition("stream_id"); //$NON-NLS-1$
 
-            if (streamIDDef instanceof IntegerDefinition) { //this doubles as a null check
+            if (streamIDDef instanceof IntegerDefinition) { // this doubles as a
+                                                            // null check
                 long streamID = ((IntegerDefinition) streamIDDef).getValue();
                 stream = streams.get(streamID);
             } else {
@@ -646,11 +647,12 @@ public class CTFTrace implements IDefinitionScope {
 
         /* It should be ok now. */
         streams.put(stream.getId(), stream);
-        eventDecs.put(stream.getId(), new HashMap<Long,IEventDeclaration>());
+        eventDecs.put(stream.getId(), new HashMap<Long, IEventDeclaration>());
     }
 
     /**
      * gets the Environment variables from the trace metadata (See CTF spec)
+     *
      * @return the environment variables in a map form (key value)
      * @since 2.0
      */
@@ -660,7 +662,9 @@ public class CTFTrace implements IDefinitionScope {
 
     /**
      * Look up a specific environment variable
-     * @param key the key to look for
+     *
+     * @param key
+     *            the key to look for
      * @return the value of the variable, can be null.
      */
     public String lookupEnvironment(String key) {
@@ -669,8 +673,11 @@ public class CTFTrace implements IDefinitionScope {
 
     /**
      * Add a variable to the environment variables
-     * @param varName the name of the variable
-     * @param varValue the value of the variable
+     *
+     * @param varName
+     *            the name of the variable
+     * @param varValue
+     *            the value of the variable
      */
     public void addEnvironmentVar(String varName, String varValue) {
         environment.put(varName, varValue);
@@ -678,8 +685,11 @@ public class CTFTrace implements IDefinitionScope {
 
     /**
      * Add a clock to the clock list
-     * @param nameValue the name of the clock (full name with scope)
-     * @param ctfClock the clock
+     *
+     * @param nameValue
+     *            the name of the clock (full name with scope)
+     * @param ctfClock
+     *            the clock
      */
     public void addClock(String nameValue, CTFClock ctfClock) {
         clocks.put(nameValue, ctfClock);
@@ -687,16 +697,15 @@ public class CTFTrace implements IDefinitionScope {
 
     /**
      * gets the clock with a specific name
-     * @param name the name of the clock.
+     *
+     * @param name
+     *            the name of the clock.
      * @return the clock
      */
     public CTFClock getClock(String name) {
         return clocks.get(name);
     }
 
-
-
-
     /**
      * gets the clock if there is only one. (this is 100% of the use cases as of
      * June 2012)
@@ -799,22 +808,26 @@ public class CTFTrace implements IDefinitionScope {
 
     /**
      * Does a given stream contain any events?
-     * @param id the stream ID
+     *
+     * @param id
+     *            the stream ID
      * @return true if the stream has events.
      */
-    public boolean hasEvents(Long id){
+    public boolean hasEvents(Long id) {
         return eventDecs.containsKey(id);
     }
 
     /**
      * Add an event declaration map to the events map.
-     * @param id the id of a stream
+     *
+     * @param id
+     *            the id of a stream
      * @return the hashmap containing events.
      * @since 2.0
      */
-    public Map<Long, IEventDeclaration> createEvents(Long id){
+    public Map<Long, IEventDeclaration> createEvents(Long id) {
         HashMap<Long, IEventDeclaration> value = eventDecs.get(id);
-        if( value == null ) {
+        if (value == null) {
             value = new HashMap<Long, IEventDeclaration>();
             eventDecs.put(id, value);
         }
@@ -868,7 +881,7 @@ public class CTFTrace implements IDefinitionScope {
      */
     public List<CTFCallsite> getCallsiteCandidates(String eventName) {
         LinkedList<CTFCallsite> retVal = callsitesByName.get(eventName);
-        if( retVal == null ) {
+        if (retVal == null) {
             retVal = new LinkedList<CTFCallsite>();
         }
         return retVal;
@@ -916,8 +929,8 @@ public class CTFTrace implements IDefinitionScope {
     public CTFCallsite getCallsite(String eventName, long ip) {
         final LinkedList<CTFCallsite> candidates = callsitesByName.get(eventName);
         final CTFCallsite dummyCs = new CTFCallsite(null, null, ip, null, -1);
-        final int pos = Collections.binarySearch(candidates, dummyCs)+1;
-        ifpos >= candidates.size()) {
+        final int pos = Collections.binarySearch(candidates, dummyCs) + 1;
+        if (pos >= candidates.size()) {
             return null;
         }
         return candidates.get(pos);
This page took 0.035066 seconds and 5 git commands to generate.