-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OTF2: Add a flows analysis with an initial view
Added a new analysis in the OTF2 plugin. One view is provided with this analysis. This view shows the input and output flows of the threads/processes/nodes/clusters when they are exchanging data through MPI blocking operations. The colors of states that are displayed when data is exchanged depends on the mean and standard deviation of all the data that has been exchanged on the row. Test case can be found in tracecompass-test-traces, under the name bandwidth_issue: tracecompass-test-traces/ctf/src/main/resources/bandwidth_issue Signed-off-by: yoann-heitz <yoann.heitz@polymtl.ca> Change-Id: Ie3ea1d99bb0e1d9e6f5d1646895cd2b477387702 Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/191486 Tested-by: Marco Miller <marco.miller@ericsson.com> Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org> Reviewed-by: Marco Miller <marco.miller@ericsson.com>
- Loading branch information
1 parent
fefe48c
commit ce99299
Showing
22 changed files
with
1,484 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 157 additions & 0 deletions
157
...c/org/eclipse/tracecompass/incubator/internal/otf2/core/analysis/flows/FlowsLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 École Polytechnique de Montréal | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 which accompanies | ||
* this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.tracecompass.incubator.internal.otf2.core.analysis.flows; | ||
|
||
import java.util.Map; | ||
|
||
import org.eclipse.tracecompass.incubator.internal.otf2.core.trace.Location; | ||
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder; | ||
import org.eclipse.tracecompass.statesystem.core.StateSystemBuilderUtils; | ||
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; | ||
|
||
/** | ||
* A class representing a location for the flows analysis | ||
* | ||
* @author Yoann Heitz | ||
*/ | ||
class FlowsLocation extends Location implements IFlowsNode { | ||
|
||
private int fInputQuark = UNKNOWN_ID; | ||
private int fOutputQuark = UNKNOWN_ID; | ||
private long fLatestEnteredTimestamp = 0; | ||
private long fInputMessageSize = 0; | ||
private long fOutputMessageSize = 0; | ||
|
||
/** | ||
* Constructor for this class | ||
* | ||
* @param event | ||
* a GlobalDef_Location event | ||
*/ | ||
public FlowsLocation(ITmfEvent event) { | ||
super(event); | ||
} | ||
|
||
/** | ||
* Initializes the quarks related to this location. This method should be | ||
* called by the state provider after all definitions have been read | ||
* | ||
* @param ssb | ||
* the state system builder | ||
* @param locationGroupMap | ||
* a map containing the different location groups and their IDs | ||
* @param stringIdMap | ||
* a map containing the different strings and their IDs | ||
*/ | ||
public void initializeQuarks(ITmfStateSystemBuilder ssb, FlowsNodeMap<Long, FlowsLocationGroup> locationGroupMap, Map<Integer, String> stringIdMap) { | ||
String locationName = getName(stringIdMap); | ||
long parentId = getLocationGroupId(); | ||
int parentInputQuark = locationGroupMap.getNodeQuark(parentId, INPUT); | ||
int parentOutputQuark = locationGroupMap.getNodeQuark(parentId, OUTPUT); | ||
fInputQuark = ssb.getQuarkRelativeAndAdd(parentInputQuark, locationName); | ||
fOutputQuark = ssb.getQuarkRelativeAndAdd(parentOutputQuark, locationName); | ||
} | ||
|
||
@Override | ||
public int getInputQuark() { | ||
return fInputQuark; | ||
} | ||
|
||
@Override | ||
public int getOutputQuark() { | ||
return fOutputQuark; | ||
} | ||
|
||
/** | ||
* Gets the timestamp of the last Enter event for this location | ||
* | ||
* @return the timestamp of the last Enter event for this location | ||
*/ | ||
public long getLatestEnteredTimestamp() { | ||
return fLatestEnteredTimestamp; | ||
} | ||
|
||
/** | ||
* Sets the timestamp of the last Enter event for this location | ||
* | ||
* @param latestEnteredTimestamp | ||
* the timestamp when this location entered a region the last | ||
* time | ||
*/ | ||
public void setLatestEnteredTimestamp(long latestEnteredTimestamp) { | ||
fLatestEnteredTimestamp = latestEnteredTimestamp; | ||
} | ||
|
||
/** | ||
* Update the flow value of this location for the correct quark, depending | ||
* on the direction of the communication. The flow value is in | ||
* bytes/nanoseconds | ||
* | ||
* @param ssb | ||
* the state system builder | ||
* @param messageLength | ||
* the number of bytes that were exchanged | ||
* @param endTimestamp | ||
* the timestamp of the end of the communication | ||
* @param direction | ||
* the direction of the communication | ||
*/ | ||
private void updateFlow(ITmfStateSystemBuilder ssb, Long messageLength, long endTimestamp, String direction) { | ||
int correctQuark = getQuark(direction); | ||
if (correctQuark == UNKNOWN_ID) { | ||
return; | ||
} | ||
long operationDuration = endTimestamp - fLatestEnteredTimestamp; | ||
double flow = (double) messageLength / operationDuration; | ||
StateSystemBuilderUtils.incrementAttributeDouble(ssb, fLatestEnteredTimestamp, correctQuark, flow); | ||
StateSystemBuilderUtils.incrementAttributeDouble(ssb, endTimestamp, correctQuark, -flow); | ||
} | ||
|
||
/** | ||
* Updates the fOutputMessageSize field with a new value | ||
* | ||
* @param messageLength | ||
* the new value for the fOutputMessageSize field | ||
*/ | ||
public void updateOutputMessageSize(Long messageLength) { | ||
fOutputMessageSize = messageLength; | ||
} | ||
|
||
/** | ||
* Updates the fInputMessageSize field with a new value | ||
* | ||
* @param messageLength | ||
* the new value for the fInputMessageSize field | ||
*/ | ||
public void updateInputMessageSize(Long messageLength) { | ||
fInputMessageSize = messageLength; | ||
} | ||
|
||
/** | ||
* Method to call when an event representing a region exit for this location | ||
* occurs | ||
* | ||
* @param ssb | ||
* the state system builder | ||
* @param leaveTimestamp | ||
* the timestamp when this location exited a region | ||
*/ | ||
public void processLeave(ITmfStateSystemBuilder ssb, long leaveTimestamp) { | ||
if (fInputMessageSize != 0) { | ||
updateFlow(ssb, fInputMessageSize, leaveTimestamp, INPUT); | ||
fInputMessageSize = 0; | ||
} | ||
if (fOutputMessageSize != 0) { | ||
updateFlow(ssb, fOutputMessageSize, leaveTimestamp, OUTPUT); | ||
fOutputMessageSize = 0; | ||
} | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
.../eclipse/tracecompass/incubator/internal/otf2/core/analysis/flows/FlowsLocationGroup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 École Polytechnique de Montréal | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 which accompanies | ||
* this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.tracecompass.incubator.internal.otf2.core.analysis.flows; | ||
|
||
import java.util.Map; | ||
|
||
import org.eclipse.tracecompass.incubator.internal.otf2.core.trace.LocationGroup; | ||
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder; | ||
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; | ||
|
||
/** | ||
* A class representing a location group for the flows analysis | ||
* | ||
* @author Yoann Heitz | ||
*/ | ||
class FlowsLocationGroup extends LocationGroup implements IFlowsNode { | ||
|
||
private int fInputQuark = UNKNOWN_ID; | ||
private int fOutputQuark = UNKNOWN_ID; | ||
|
||
/** | ||
* Constructor for this class | ||
* | ||
* @param event | ||
* a GlobalDef_LocationGroup event | ||
*/ | ||
public FlowsLocationGroup(ITmfEvent event) { | ||
super(event); | ||
} | ||
|
||
/** | ||
* Initializes the quarks related to this location group. This method should | ||
* be called by the state provider after all definitions have been read | ||
* | ||
* @param ssb | ||
* the state system builder | ||
* @param systemTreeNodeMap | ||
* a map containing the different system tree nodes and their IDs | ||
* @param stringIdMap | ||
* a map containing the different strings and their IDs | ||
*/ | ||
public void initializeQuarks(ITmfStateSystemBuilder ssb, FlowsNodeMap<Long, FlowsSystemTreeNode> systemTreeNodeMap, Map<Integer, String> stringIdMap) { | ||
long parentId = getParentId(); | ||
String fullName = getFullName(stringIdMap); | ||
int parentInputQuark = systemTreeNodeMap.getNodeQuark(parentId, INPUT); | ||
int parentOutputQuark = systemTreeNodeMap.getNodeQuark(parentId, OUTPUT); | ||
if (parentInputQuark != UNKNOWN_ID && parentOutputQuark != UNKNOWN_ID) { | ||
fInputQuark = ssb.getQuarkRelativeAndAdd(parentInputQuark, fullName); | ||
fOutputQuark = ssb.getQuarkRelativeAndAdd(parentOutputQuark, fullName); | ||
} | ||
} | ||
|
||
@Override | ||
public int getInputQuark() { | ||
return fInputQuark; | ||
} | ||
|
||
@Override | ||
public int getOutputQuark() { | ||
return fOutputQuark; | ||
} | ||
} |
Oops, something went wrong.