/**
* 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
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>();
/** Callsite helpers */
private TreeSet<CTFCallsite> callsitesByIP = new TreeSet<CTFCallsite>();
-
-
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/* 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. */
/**
* Dispose the trace
+ *
* @since 2.0
*/
public void dispose() {
}
}
}
- System.gc(); // Invoke GC to release MappedByteBuffer objects (Java bug JDK-4724038)
+ // Invoke GC to release MappedByteBuffer objects (Java bug JDK-4724038)
+ System.gc();
}
// ------------------------------------------------------------------------
/**
* 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
*
* 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) {
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);
/* 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 {
/* 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
*/
/**
* 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) {
/**
* 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);
/**
* 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);
/**
* 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)
/**
* 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);
}
*/
public List<CTFCallsite> getCallsiteCandidates(String eventName) {
LinkedList<CTFCallsite> retVal = callsitesByName.get(eventName);
- if( retVal == null ) {
+ if (retVal == null) {
retVal = new LinkedList<CTFCallsite>();
}
return retVal;
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;
- if( pos >= candidates.size()) {
+ final int pos = Collections.binarySearch(candidates, dummyCs) + 1;
+ if (pos >= candidates.size()) {
return null;
}
return candidates.get(pos);