Skip to content

Commit

Permalink
OTF2: Add counter analysis
Browse files Browse the repository at this point in the history
Added a counter analysis, using the generic counter aspects. To create
the different aspects, when the trace is opened, all the definitions at
the beginning of the trace are read. It allows to reconstruct the system
architecture (to build the different groups in the counter analysis) and
create the different counter aspects.

Dependencies from org.eclipse.tracecompass:
https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/193595

Dependencies from tracecompass-test-traces:
https://git.eclipse.org/r/c/tracecompass/tracecompass-test-traces/+/193594
https://git.eclipse.org/r/c/tracecompass/tracecompass-test-traces/+/193332

Signed-off-by: yoann-heitz <yoann.heitz@polymtl.ca>
Change-Id: I8140df961c717b42e029d880306163dad9b42b6e
Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/193333
Reviewed-by: Marco Miller <marco.miller@ericsson.com>
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Marco Miller <marco.miller@ericsson.com>
  • Loading branch information
yoann-heitz authored and marco-miller committed Oct 24, 2022
1 parent 333ec17 commit cb425f4
Show file tree
Hide file tree
Showing 22 changed files with 1,182 additions and 41 deletions.
Expand Up @@ -16,6 +16,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.tracecompass.tmf.ctf.core,
org.eclipse.tracecompass.incubator.callstack.core,
org.eclipse.tracecompass.analysis.os.linux.core,
org.eclipse.tracecompass.analysis.counters.core,
org.eclipse.tracecompass.incubator.analysis.core;bundle-version="0.0.1",
org.eclipse.tracecompass.analysis.timing.core;bundle-version="5.2.1",
org.eclipse.tracecompass.segmentstore.core;bundle-version="3.0.1"
Expand All @@ -28,5 +29,8 @@ Export-Package: org.eclipse.tracecompass.incubator.internal.otf2.core;x-friends:
org.eclipse.tracecompass.incubator.otf2.core.trace;x-friends:="org.eclipse.tracecompass.incubator.otf2.ui,org.eclipse.tracecompass.incubator.otf2.core.tests"
Import-Package: com.google.common.collect,
org.apache.commons.io,
org.apache.commons.lang3.math
org.apache.commons.lang3;version="3.1.0",
org.apache.commons.lang3.math,
org.eclipse.tracecompass.analysis.counters.core,
org.eclipse.tracecompass.analysis.counters.core.aspects
Automatic-Module-Name: org.eclipse.tracecompass.incubator.otf2.core
Expand Up @@ -14,6 +14,15 @@
</extension>
<extension
point="org.eclipse.linuxtools.tmf.core.analysis">
<module
analysis_module="org.eclipse.tracecompass.analysis.counters.core.CounterAnalysis"
automatic="false"
id="org.eclipse.tracecompass.analysis.counters.core.counteranalysis"
name="Counters">
<tracetype
class="org.eclipse.tracecompass.incubator.otf2.core.trace.Otf2Trace">
</tracetype>
</module>
<module
analysis_module="org.eclipse.tracecompass.incubator.internal.otf2.core.analysis.callstack.Otf2CallstackAnalysis"
automatic="true"
Expand Down Expand Up @@ -87,4 +96,4 @@
id="org.eclipse.tracecompass.incubator.otf2.core.analysis.flows.xy.dataprovider">
</dataProviderFactory>
</extension>
</plugin>
</plugin>
Expand Up @@ -58,7 +58,7 @@ public interface IOtf2Constants {
/**
* Enum for collective MPI operations
*/
public enum CollectiveOperation {
enum CollectiveOperation {
/**
* MPI_Barrier operation
*/
Expand Down Expand Up @@ -185,7 +185,7 @@ public enum CollectiveOperation {
* The code for the collective operation
* @return the associated operation member from CollectiveOperation
*/
public static CollectiveOperation getOperation(int operationCode) {
static CollectiveOperation getOperation(int operationCode) {
switch (operationCode) {
case 0:
return CollectiveOperation.BARRIER;
Expand Down Expand Up @@ -253,6 +253,11 @@ public static CollectiveOperation getOperation(int operationCode) {
*/
long OTF2_UNDEFINED_UINT64 = ~(0L);

/**
* long constant representing OTF2 undefined int64 value
*/
long OTF2_UNDEFINED_INT64 = ~(OTF2_UNDEFINED_UINT64 >>> 1);

/**
* In the following lines, undefined and unknown constants are defined for
* the different OTF2 references.
Expand Down Expand Up @@ -295,4 +300,79 @@ public static CollectiveOperation getOperation(int operationCode) {
* Constant representing an unknown location group type.
*/
int OTF2_UNKNOWN_LOCATION_GROUP_TYPE = OTF2_UNDEFINED_UINT8;

/**
* Constant representing an unknown metric member reference.
*/
long OTF2_UNKNOWN_METRIC_MEMBER = OTF2_UNDEFINED_UINT32;

/**
* Constant representing an unknown metric type.
*/
int OTF2_UNKNOWN_METRIC_TYPE = OTF2_UNDEFINED_UINT8;

/**
* Constant representing an unknown metric mode.
*/
int OTF2_UNKNOWN_METRIC_MODE = OTF2_UNDEFINED_UINT8;

/**
* Constant representing an unknown value type.
*/
int OTF2_UNKNOWN_VALUE_TYPE = OTF2_UNDEFINED_UINT8;

/**
* Constant representing an unknown base.
*/
int OTF2_UNKNOWN_BASE = OTF2_UNDEFINED_UINT8;

/**
* Constant representing an unknown exponent.
*/
long OTF2_UNKNOWN_EXPONENT = OTF2_UNDEFINED_INT64;

/**
* Constant representing an unknown metric class reference.
*/
long OTF2_UNKNOWN_METRIC_CLASS = OTF2_UNDEFINED_UINT32;

/**
* Value of the "base" field for a binary metric
*/
int BINARY_BASE_CODE = 0;

/**
* Value of the "base" field for a decimal metric
*/
int DECIMAL_BASE_CODE = 1;

/**
* Mask to get the mode of a metric
*/
int METRIC_MODE_MASK = ((1 << 4) - 1);

/**
* OTF2_METRIC_ABSOLUTE_POINT code
*/
int OTF2_METRIC_ABSOLUTE_POINT = 4;

/**
* OTF2_METRIC_ABSOLUTE_NEXT code
*/
int OTF2_METRIC_ABSOLUTE_NEXT = 6;

/**
* OTF2_TYPE_INT64 value
*/
int OTF2_TYPE_INT64 = 4;

/**
* OTF2_TYPE_UINT64 value
*/
int OTF2_TYPE_UINT64 = 8;

/**
* OTF2_TYPE_DOUBLE value
*/
int OTF2_TYPE_DOUBLE = 10;
}
Expand Up @@ -14,6 +14,10 @@
/**
* CTF fields name after conversion from OTF2
*
* These fields are used to access parameters from CTF events that were
* converted from OTF2. They are defined in the OTF2-to-CTF converter:
* https://github.com/dorsal-lab/OTF2-to-CTF-converter
*
* @author Yoann Heitz
*/
public interface IOtf2Fields {
Expand Down Expand Up @@ -137,4 +141,59 @@ public interface IOtf2Fields {
* Size sent field name
*/
String OTF2_SIZE_SENT = "sizeSent"; //$NON-NLS-1$

/**
* Metric members field name
*/
String OTF2_METRIC_MEMBERS = "metricMembers"; //$NON-NLS-1$

/**
* Description field name
*/
String OTF2_DESCRIPTION = "description"; //$NON-NLS-1$

/**
* Metric type field name
*/
String OTF2_METRIC_TYPE = "metricType"; //$NON-NLS-1$

/**
* Metric mode field name
*/
String OTF2_METRIC_MODE = "metricMode"; //$NON-NLS-1$

/**
* Value type field name
*/
String OTF2_VALUE_TYPE = "valueType"; //$NON-NLS-1$

/**
* Base field name
*/
String OTF2_BASE = "base"; //$NON-NLS-1$

/**
* Exponent field name
*/
String OTF2_EXPONENT = "exponent"; //$NON-NLS-1$

/**
* Unit field name
*/
String OTF2_UNIT = "unit"; //$NON-NLS-1$

/**
* Metric value field name
*/
String OTF2_METRIC_VALUE = "metricValue"; //$NON-NLS-1$

/**
* Metric field name
*/
String OTF2_METRIC = "metric"; //$NON-NLS-1$

/**
* Index field name
*/
String OTF2_INDEX = "index"; //$NON-NLS-1$
}
Expand Up @@ -57,4 +57,14 @@ public interface IOtf2GlobalDefinitions {
* Group member name
*/
String OTF2_GROUP_MEMBER = "GroupMember"; //$NON-NLS-1$
}

/**
* Metric member name
*/
String OTF2_METRIC_MEMBER = "MetricMember"; //$NON-NLS-1$

/**
* Metric class name
*/
String OTF2_METRIC_CLASS = "MetricClass"; //$NON-NLS-1$
}
Expand Up @@ -171,10 +171,13 @@ public CallstackLocation(ITmfEvent event) {
fCallStackQuark = UNKNOWN_ID;
}

/*
/**
* This method will be called by each location when all definitions have
* been read : the name of the location may be computed at this moment,
* and the corresponding quark may be created.
*
* @param ssb
* The state system to write to
*/
public void initializeQuarks(ITmfStateSystemBuilder ssb) {
// Get the name of the location
Expand Down Expand Up @@ -205,12 +208,14 @@ public void leave(ITmfEvent event, ITmfStateSystemBuilder ssb) {
ssb.popAttribute(timestamp, fCallStackQuark);
}

/*
/**
* This method is called when a location finished to send data through a
* MPI routine (it does not mean the location exited the associated code
* region). It stores the informations about the send event in order to
* link it to the receive event when encountered.
*
* @param srcEvent
* The event generated when sending data
*/
public void mpiSend(ITmfEvent srcEvent) {
ITmfEventField content = srcEvent.getContent();
Expand All @@ -227,12 +232,16 @@ public void mpiSend(ITmfEvent srcEvent) {
fMsgDataEvent.put(new MessageIdentifiers(communicator, srcRank, destRank, messageTag), srcEvent);
}

/*
/**
* This method is called when a location finished to receive data
* through a MPI routine (it does not mean the location exited the
* associated code region). It searches for the associated send event
* and draw an edge between the two events.
*
* @param destEvent
* The event generated when receiving data
* @param ssb
* The state system to write to
*/
public void mpiRecv(ITmfEvent destEvent, ITmfStateSystemBuilder ssb) {
ITmfEventField content = destEvent.getContent();
Expand Down Expand Up @@ -261,11 +270,16 @@ public void mpiCollectiveBegin(ITmfEvent event) {
fCollectiveBeginTimestamp = event.getTimestamp().toNanos();
}

/*
/**
* Called when a location finished an one to all MPI operation. This
* location is necessarily a destination in an exchange of data. The
* event corresponding to the root sending the data is retrieved in
* order to draw an edge
*
* @param destEvent
* The event that waits for all MPI operations to finish
* @param ssb
* The state system to write to
*/
public void mpiRootToAll(ITmfEvent destEvent, ITmfStateSystemBuilder ssb) {
ITmfEventField content = destEvent.getContent();
Expand Down Expand Up @@ -322,12 +336,17 @@ public void mpiRootToAll(ITmfEvent destEvent, ITmfStateSystemBuilder ssb) {

}

/*
/**
* Called when a location finished an all to one MPI operation. This
* location is necessarily a source in an exchange of data. The
* informations about the event are stored : if it is the root
* (receiver) that call this method then the communication is done and
* edges may be drawn.
*
* @param srcEvent
* The event that generates this operation
* @param ssb
* The state system to write to
*/
public void mpiAllToRoot(ITmfEvent srcEvent, ITmfStateSystemBuilder ssb) {
ITmfEventField content = srcEvent.getContent();
Expand Down Expand Up @@ -519,7 +538,7 @@ protected void processOtf2Event(ITmfEvent event, String name, ITmfStateSystemBui
}
}

/*
/**
* Iterates over all the location and initializes the associated quarks
*/
private void initializeQuarks(ITmfStateSystemBuilder ssb) {
Expand All @@ -534,7 +553,7 @@ private void initializeQuarks(ITmfStateSystemBuilder ssb) {
}
}

/*
/**
* Calls the corresponding method from the associated location given the
* type of event
*/
Expand Down

0 comments on commit cb425f4

Please sign in to comment.