Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.DS_Store
.polyglot.build.properties
.tycho-consumer-pom.xml
jsonify.py
bin/
target/
workspace/
Expand Down
7 changes: 6 additions & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ Trace Compass can be traced by doing the following in the launch configuration:
* -Djava.util.logging.config.file=%gitroot%/logging.properties (where %gitroot% is the directory tracecompass is checked out to)
* -Dorg.eclipse.tracecompass.logging=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add some description here on how to use the other handlers and how to make it work with the -Xbootclasspath setting? We should also have a reference link to the trace-event-logger documentation for more information.

The README.md in this repo should mention about tracing Trace Compass and have link to the chapter in BUILDING.md.


Additionally the folder the trace is being written to (default is `home/.tracecompass/logs`) needs to be created in advance. After running Trace Compass, a `trace_n.json` will be created in the tracing folder. It needs to be converted to true json, so use the `jsonify.sh` script in the root directory to convert it. Then it can be loaded into Trace Compass, if the **Trace Event format** is installed from the incubator, or from a web browser such as Chromium.
Additionally the folder the trace is being written to (default is `%home%/.tracecompass/logs`) needs to be created in advance. After running Trace Compass, a `trace_n.json` will be created in the tracing folder. It needs to be converted to true json, so use the `jsonify.sh` script in the root directory to convert it. Then it can be loaded into Trace Compass, if the **Trace Event format** is installed from the incubator, or from a web browser such as Chromium.

To use the handlers provided in the trace-event-logger library by adding them to the logging config file, they will need to be added to the bootstrap class path in vmargs using a relative path (RCP) or absolute path (development):

* -Xbootclasspath/a:./plugins/org.eclipse.tracecompass.trace-event-logger_x.y.z.jar
* -Xbootclasspath/a:%home%/.m2/repository/org/eclipse/tracecompass/trace-event-logger/x.y.z/trace-event-logger-x.y.z.jar

The performance impact is low enough as long as the log level is greater than "*FINEST*".

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Eclipse IDE, as well as standalone application.

Check [Downloads](https://projects.eclipse.org/projects/tools.tracecompass/downloads) for downloading specific versions of Trace Compass.

## Building and Tracing Trace Compass

Information about building and tracing Trace Compass can be found in the [building guide](BUILDING.md).

## Contributing to Trace Compass

**👋 Want to help?** Read our [contributor guide](CONTRIBUTING.md) and follow the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ Export-Package: org.eclipse.tracecompass.analysis.counters.core,
org.eclipse.tracecompass.internal.analysis.counters.core;x-friends:="org.eclipse.tracecompass.analysis.counters.ui"
Import-Package: com.google.common.base,
com.google.common.collect,
com.google.common.primitives
com.google.common.primitives,
org.eclipse.tracecompass.traceeventlogger
Automatic-Module-Name: org.eclipse.tracecompass.analysis.counters.core
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017 Ericsson
* Copyright (c) 2017, 2025 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand All @@ -21,7 +21,6 @@
import org.eclipse.tracecompass.analysis.counters.core.aspects.CounterAspect;
import org.eclipse.tracecompass.analysis.counters.core.aspects.ITmfCounterAspect;
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils;
import org.eclipse.tracecompass.internal.analysis.counters.core.Activator;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
import org.eclipse.tracecompass.statesystem.core.StateSystemBuilderUtils;
Expand All @@ -33,6 +32,7 @@
import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
import org.eclipse.tracecompass.traceeventlogger.LogUtils;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -192,7 +192,7 @@ private static void handleCounterAspect(ITmfEvent event, ITmfStateSystemBuilder
break;
}
} catch (StateValueTypeException e) {
TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "HandleCounterAspect:Exception", e); //$NON-NLS-1$
LogUtils.traceInstant(LOGGER, Level.WARNING, "HandleCounterAspect:Exception", e); //$NON-NLS-1$
}
} else {
ss.modifyAttribute(event.getTimestamp().toNanos(), eventContent, quark);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ Import-Package: com.google.common.annotations,
com.google.common.cache,
com.google.common.collect,
com.google.common.hash,
org.apache.commons.lang3
org.apache.commons.lang3,
org.eclipse.tracecompass.traceeventlogger
Automatic-Module-Name: org.eclipse.tracecompass.analysis.graph.core
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 École Polytechnique de Montréal and others
* Copyright (c) 2022, 2025 École Polytechnique de Montréal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand All @@ -26,9 +26,9 @@

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils;
import org.eclipse.tracecompass.datastore.core.interval.IHTIntervalReader;
import org.eclipse.tracecompass.internal.analysis.graph.core.Activator;
import org.eclipse.tracecompass.traceeventlogger.LogUtils;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.cache.CacheBuilder;
Expand Down Expand Up @@ -101,7 +101,7 @@ public GraphTreeNode load(CacheKey key) throws IOException {
HtIo io = key.fHistoryTreeIo;
int seqNb = key.fSeqNumber;

TraceCompassLogUtils.traceInstant(LOGGER, Level.FINEST, "HtIo:CacheMiss", "seqNum", seqNb); //$NON-NLS-1$ //$NON-NLS-2$
LogUtils.traceInstant(LOGGER, Level.FINEST, "HtIo:CacheMiss", "seqNum", seqNb); //$NON-NLS-1$ //$NON-NLS-2$

synchronized (io) {
io.seekFCToNodePos(io.fFileChannelIn, seqNb);
Expand Down Expand Up @@ -233,7 +233,7 @@ public HtIo(File stateHistoryFile,
*/
public GraphTreeNode readNode(int seqNumber) throws ClosedChannelException {
/* Do a cache lookup. If it's not present it will be loaded from disk */
TraceCompassLogUtils.traceInstant(LOGGER, Level.FINEST, "HtIo:CacheLookup", "seqNum", seqNumber); //$NON-NLS-1$ //$NON-NLS-2$
LogUtils.traceInstant(LOGGER, Level.FINEST, "HtIo:CacheLookup", "seqNum", seqNumber); //$NON-NLS-1$ //$NON-NLS-2$
CacheKey key = new CacheKey(this, seqNumber);
try {
return checkNotNull(NODE_CACHE.get(key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ Export-Package: org.eclipse.tracecompass.internal.analysis.lami.core;x-internal:
Import-Package: com.google.common.annotations,
com.google.common.base,
com.google.common.collect,
org.eclipse.tracecompass.traceeventlogger,
org.json
Automatic-Module-Name: org.eclipse.tracecompass.analysis.lami.core
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir
* Copyright (c) 2015, 2025 EfficiOS Inc., Alexandre Montplaisir and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand Down Expand Up @@ -41,7 +41,6 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils;
import org.eclipse.tracecompass.common.core.process.ProcessUtils;
import org.eclipse.tracecompass.common.core.process.ProcessUtils.OutputReaderFunction;
import org.eclipse.tracecompass.internal.analysis.lami.core.Activator;
Expand All @@ -68,6 +67,7 @@
import org.eclipse.tracecompass.tmf.core.analysis.ondemand.IOnDemandAnalysis;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.traceeventlogger.LogUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -309,18 +309,18 @@ private void readVersion() {
final String output = getOutputFromCommand(commandLine);

if (output == null) {
TraceCompassLogUtils.traceInstant(LOGGER, Level.INFO, LOG_NO_MI_VERSION, INVALID_MI_VERSION, command);
LogUtils.traceInstant(LOGGER, Level.INFO, LOG_NO_MI_VERSION, INVALID_MI_VERSION, command);
return;
}

final String versionString = output.trim();

if (!versionString.matches("\\d{1,3}\\.\\d{1,3}")) { //$NON-NLS-1$
TraceCompassLogUtils.traceInstant(LOGGER, Level.INFO, LOG_NO_MI_VERSION, COMMAND, command, VERSION, versionString);
LogUtils.traceInstant(LOGGER, Level.INFO, LOG_NO_MI_VERSION, COMMAND, command, VERSION, versionString);
return;
}

TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, LOG_VERSION, COMMAND, command, VERSION, versionString);
LogUtils.traceInstant(LOGGER, Level.FINE, LOG_VERSION, COMMAND, command, VERSION, versionString);


final String[] parts = versionString.split("\\."); //$NON-NLS-1$
Expand Down Expand Up @@ -406,7 +406,7 @@ protected boolean checkMetadata() {
*/
List<String> command = ImmutableList.<@NonNull String> builder()
.addAll(fScriptCommand).add(METADATA_FLAG).build();
TraceCompassLogUtils.traceInstant(LOGGER, Level.INFO, RUNNING_METADATA_COMMAND, COMMAND, command);
LogUtils.traceInstant(LOGGER, Level.INFO, RUNNING_METADATA_COMMAND, COMMAND, command);
String output = getOutputFromCommand(command);
if (output == null || output.isEmpty()) {
fHelpMessage = noMetadata(NonNullUtils.nullToEmptyString(Messages.LamiAnalysis_ErrorNoOutput));
Expand Down Expand Up @@ -492,7 +492,7 @@ protected boolean checkMetadata() {

} catch (JSONException e) {
/* Error in the parsing of the JSON, script is broken? */
TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, ERROR_PARSING_METADATA, e.getMessage());
LogUtils.traceInstant(LOGGER, Level.WARNING, ERROR_PARSING_METADATA, e.getMessage());
fHelpMessage = noMetadata(NonNullUtils.nullToEmptyString(NLS.bind(Messages.LamiAnalysis_ParsingError, e.getMessage())));
return false;
}
Expand Down Expand Up @@ -699,7 +699,7 @@ public List<LamiResultTable> execute(ITmfTrace trace, @Nullable TmfTimeRange tim
builder.addAll(extraParams);
builder.add(tracePath);
List<String> command = builder.build();
TraceCompassLogUtils.traceInstant(LOGGER, Level.INFO, RUNNING_EXECUTE_COMMAND, COMMAND, command);
LogUtils.traceInstant(LOGGER, Level.INFO, RUNNING_EXECUTE_COMMAND, COMMAND, command);
String output = getResultsFromCommand(command, monitor);

if (output.isEmpty()) {
Expand Down Expand Up @@ -848,7 +848,7 @@ public List<LamiResultTable> execute(ITmfTrace trace, @Nullable TmfTimeRange tim
}

} catch (JSONException e) {
TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, ERROR_PARSING_EXECUTION_OUTPUT, e.getMessage());
LogUtils.traceInstant(LOGGER, Level.WARNING, ERROR_PARSING_EXECUTION_OUTPUT, e.getMessage());
IStatus status = new Status(IStatus.ERROR, Activator.instance().getPluginId(), e.getMessage(), e);
throw new CoreException(status);
}
Expand All @@ -868,7 +868,7 @@ private LamiTableClass getTableClassFromName(String tableClassName) throws JSONE

@Nullable
private static String getOutputFromCommand(List<String> command, boolean orError) {
TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, LOG_RUNNING_MESSAGE, COMMAND, command);
LogUtils.traceInstant(LOGGER, Level.FINE, LOG_RUNNING_MESSAGE, COMMAND, command);
List<String> lines = ProcessUtils.getOutputFromCommand(command, orError);
if (lines == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Import-Package: com.google.common.base,
com.google.common.primitives,
org.apache.commons.io,
org.apache.commons.io.input,
org.apache.commons.lang3
org.apache.commons.lang3,
org.eclipse.tracecompass.traceeventlogger
Export-Package: org.eclipse.tracecompass.analysis.os.linux.core.contextswitch,
org.eclipse.tracecompass.analysis.os.linux.core.cpuusage,
org.eclipse.tracecompass.analysis.os.linux.core.event.aspect,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2015 École Polytechnique de Montréal and others.
* Copyright (c) 2014, 2025 École Polytechnique de Montréal and others.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand Down Expand Up @@ -35,8 +35,6 @@
import org.eclipse.tracecompass.analysis.os.linux.core.trace.KernelEventLayoutRequirement;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.ScopeLog;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
Expand All @@ -52,6 +50,8 @@
import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
import org.eclipse.tracecompass.traceeventlogger.LogUtils;
import org.eclipse.tracecompass.traceeventlogger.LogUtils.ScopeLog;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -274,7 +274,7 @@ public Map<String, Long> getCpuUsageInRange(Set<@NonNull Integer> cpus, long sta

long currentCount = countAtEnd - countAtStart;
if (currentCount < 0) {
TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, "Negative count", //$NON-NLS-1$
LogUtils.traceInstant(LOGGER, Level.FINE, "Negative count", //$NON-NLS-1$
"CPU", curCpuName, //$NON-NLS-1$
"tid", curTidName, //$NON-NLS-1$
"startTime", startTime, //$NON-NLS-1$
Expand All @@ -283,7 +283,7 @@ public Map<String, Long> getCpuUsageInRange(Set<@NonNull Integer> cpus, long sta
"countAtEnd", countAtEnd); //$NON-NLS-1$
currentCount = 0;
} else if (currentCount > endTime - startTime) {
TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, "CPU usage over 100%", //$NON-NLS-1$
LogUtils.traceInstant(LOGGER, Level.FINE, "CPU usage over 100%", //$NON-NLS-1$
"CPU", curCpuName, //$NON-NLS-1$
"tid", curTidName, //$NON-NLS-1$
"startTime", startTime, //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ Import-Package: com.google.common.annotations,
com.google.common.base,
com.google.common.cache,
com.google.common.collect,
org.apache.commons.lang3
org.apache.commons.lang3,
org.eclipse.tracecompass.traceeventlogger
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 École Polytechnique de Montréal
* Copyright (c) 2019, 2025 É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
Expand Down Expand Up @@ -40,14 +40,12 @@
import org.eclipse.tracecompass.analysis.profiling.core.tree.ITree;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeGroupDescriptor;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider.MetricType;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeSet;
import org.eclipse.tracecompass.analysis.profiling.core.tree.WeightedTree;
import org.eclipse.tracecompass.analysis.profiling.core.tree.WeightedTreeGroupBy;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider.MetricType;
import org.eclipse.tracecompass.analysis.timing.core.statistics.IStatistics;
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLog;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder;
import org.eclipse.tracecompass.datastore.core.serialization.ISafeByteBufferWriter;
import org.eclipse.tracecompass.internal.analysis.profiling.core.instrumented.FlameChartEntryModel;
import org.eclipse.tracecompass.internal.analysis.profiling.core.instrumented.FlameChartEntryModel.EntryType;
Expand Down Expand Up @@ -81,6 +79,8 @@
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.util.Pair;
import org.eclipse.tracecompass.traceeventlogger.LogUtils.FlowScopeLog;
import org.eclipse.tracecompass.traceeventlogger.LogUtils.FlowScopeLogBuilder;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018 École Polytechnique de Montréal
* Copyright (c) 2018, 2025 É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
Expand Down Expand Up @@ -45,8 +45,6 @@
import org.eclipse.tracecompass.analysis.profiling.core.instrumented.IFlameChartProvider;
import org.eclipse.tracecompass.analysis.profiling.core.model.IHostModel;
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLog;
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder;
import org.eclipse.tracecompass.internal.analysis.profiling.core.instrumented.FlameChartEntryModel.EntryType;
import org.eclipse.tracecompass.internal.analysis.profiling.core.model.ModelManager;
import org.eclipse.tracecompass.internal.analysis.profiling.core.model.ProcessStatusInterval;
Expand Down Expand Up @@ -77,6 +75,8 @@
import org.eclipse.tracecompass.tmf.core.symbols.SymbolProviderUtils;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.util.Pair;
import org.eclipse.tracecompass.traceeventlogger.LogUtils.FlowScopeLog;
import org.eclipse.tracecompass.traceeventlogger.LogUtils.FlowScopeLogBuilder;

import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ Import-Package: com.google.common.annotations,
com.google.common.base,
com.google.common.collect,
org.apache.commons.lang3,
org.eclipse.swtchart
org.eclipse.swtchart,
org.eclipse.tracecompass.traceeventlogger
Loading
Loading