*
* Contributors:
* Alvaro Sanchez-Leon - Initial API and implementation
+ * Michel Dagenais (michel.dagenais@polymtl.ca) - Reference C implementation, used with permission
*******************************************************************************/
package org.eclipse.linuxtools.lttng.ui.views.controlflow.model;
import java.util.HashMap;
import java.util.Iterator;
-import org.eclipse.linuxtools.lttng.TraceDebug;
+import org.eclipse.linuxtools.lttng.core.TraceDebug;
import org.eclipse.linuxtools.lttng.ui.model.trange.ItemContainer;
import org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeEventProcess;
*
* @param newProcess The process to add
*/
+ @Override
public void addItem(TimeRangeEventProcess newItem) {
if (newItem != null) {
allProcesses.put(new ProcessKey(newItem), newItem);
*
* @return Integer
*/
- public Integer getUniqueId() {
+ @Override
+ public Integer getUniqueId() {
return uniqueId++;
}
*
* @return TimeRangeEventProcess[]
*/
+ @Override
public TimeRangeEventProcess[] readItems() {
// This allow us to return an Array of the correct type of the exact correct dimension, without looping
* Clear the children information for processes e.g. just before refreshing
* data with a new time range
*/
+ @Override
public void clearChildren() {
TimeRangeEventProcess process = null;
Iterator<ProcessKey> iterator = allProcesses.keySet().iterator();
/**
* Clear all process items
*/
- public void clearItems() {
+ @Override
+ public void clearItems() {
allProcesses.clear();
}
*
* @param traceId The trace unique id (trace name?) on which we want to remove process
*/
+ @Override
public void removeItems(String traceId) {
ProcessKey iterKey = null;
if ( obj instanceof ProcessKey ) {
ProcessKey procKey = (ProcessKey) obj;
- if ( valueRef != null ) {
- if ( (procKey.getPid().equals(valueRef.getPid()) ) &&
- (procKey.getTraceId().equals(valueRef.getTraceID()) ) &&
- (procKey.getCpuId().equals(valueRef.getCpu()) ) &&
- (procKey.getCreationtime().equals(valueRef.getCreationTime()) ) )
- {
- isSame = true;
- }
- }
- else {
- if ( (procKey.getPid().equals(this.pid ) ) &&
- (procKey.getTraceId().equals(this.traceId ) ) &&
- (procKey.getCpuId().equals(this.cpuId ) ) &&
- (procKey.getCreationtime().equals(this.creationtime ) ) )
- {
- isSame = true;
- }
- }
+ if (valueRef != null) {
+ if ((procKey.getPid().equals(valueRef.getPid()))
+ && (procKey.getTraceId().equals(valueRef.getTraceID()))
+ && (procKey.getCreationtime().equals(valueRef.getCreationTime()))) {
+ // use the cpu value to validate pid 0
+ if (valueRef.getPid().longValue() == 0L && !procKey.getCpuId().equals(valueRef.getCpu())) {
+ isSame = false;
+ } else {
+ isSame = true;
+ }
+ }
+ } else {
+ if ((procKey.getPid().equals(this.pid)) && (procKey.getTraceId().equals(this.traceId))
+ && (procKey.getCreationtime().equals(this.creationtime))) {
+ // use the cpu value to validate pid 0
+ if (this.pid.longValue() == 0L && !procKey.getCpuId().equals(this.cpuId)) {
+ isSame = false;
+ } else {
+ isSame = true;
+ }
+ }
+ }
}
else {
- TraceDebug.debug("ERROR : The given key is not of the type ProcessKey!" + obj.getClass().toString());
+ TraceDebug.debug("ERROR : The given key is not of the type ProcessKey!" + obj.getClass().toString()); //$NON-NLS-1$
}
return isSame;
}
- @Override
+ @Override
+ @SuppressWarnings("nls")
public String toString() {
if ( valueRef != null ) {
- return (valueRef.getPid().toString() + ":" + valueRef.getCpu().toString() + ":" + valueRef.getTraceID().toString() + ":" + valueRef.getCreationTime().toString());
+ // return (valueRef.getPid().toString() + ":" +
+ // valueRef.getCpu().toString() + ":"
+ // + valueRef.getTraceID().toString() + ":" +
+ // valueRef.getCreationTime().toString());
+ return (valueRef.getPid().toString() + ":" + valueRef.getTraceID().toString() + ":" + valueRef
+ .getCreationTime().toString());
}
- return (pid.toString() + ":" + cpuId.toString() + ":" + traceId.toString() + ":" + creationtime.toString());
+ // return (pid.toString() + ":" + cpuId.toString() + ":" +
+ // traceId.toString() + ":" + creationtime.toString());
+
+ return (pid.toString() + ":" + traceId.toString() + ":" + creationtime.toString());
}
}