Skip to content

Commit 383f3fe

Browse files
committed
common: Deprecate TraceCompassLogUtils and use trace-event-logger lib
Deprecate TraceCompassLogUtils and TraceCompassMonitorManager. Replace all use of TraceCompassLogUtils with LogUtils from the trace-event-logger library. Update all targets to include the trace-event-logger jar from Maven. Add trace-event-logger plug-in to RCP feature and releng-site. Signed-off-by: Patrick Tasse <[email protected]>
1 parent 1f8fcff commit 383f3fe

File tree

90 files changed

+474
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+474
-256
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.DS_Store
44
.polyglot.build.properties
55
.tycho-consumer-pom.xml
6+
jsonify.py
67
bin/
78
target/
89
workspace/

BUILDING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ Trace Compass can be traced by doing the following in the launch configuration:
4444
* -Djava.util.logging.config.file=%gitroot%/logging.properties (where %gitroot% is the directory tracecompass is checked out to)
4545
* -Dorg.eclipse.tracecompass.logging=true
4646

47-
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.
47+
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.
48+
49+
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):
50+
51+
* -Xbootclasspath/a:./plugins/org.eclipse.tracecompass.trace-event-logger_x.y.z.jar
52+
* -Xbootclasspath/a:%home%/.m2/repository/org/eclipse/tracecompass/trace-event-logger/x.y.z/trace-event-logger-x.y.z.jar
4853

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

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Eclipse IDE, as well as standalone application.
3333

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

36+
## Building and Tracing Trace Compass
37+
38+
Information about building and tracing Trace Compass can be found in the [building guide](BUILDING.md).
39+
3640
## Contributing to Trace Compass
3741

3842
**👋 Want to help?** Read our [contributor guide](CONTRIBUTING.md) and follow the

analysis/org.eclipse.tracecompass.analysis.counters.core/META-INF/MANIFEST.MF

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ Export-Package: org.eclipse.tracecompass.analysis.counters.core,
1818
org.eclipse.tracecompass.internal.analysis.counters.core;x-friends:="org.eclipse.tracecompass.analysis.counters.ui"
1919
Import-Package: com.google.common.base,
2020
com.google.common.collect,
21-
com.google.common.primitives
21+
com.google.common.primitives,
22+
org.eclipse.tracecompass.traceeventlogger
2223
Automatic-Module-Name: org.eclipse.tracecompass.analysis.counters.core

analysis/org.eclipse.tracecompass.analysis.counters.core/src/org/eclipse/tracecompass/analysis/counters/core/CounterStateProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017 Ericsson
2+
* Copyright (c) 2017, 2025 Ericsson
33
*
44
* All rights reserved. This program and the accompanying materials are
55
* made available under the terms of the Eclipse Public License 2.0 which
@@ -21,7 +21,6 @@
2121
import org.eclipse.tracecompass.analysis.counters.core.aspects.CounterAspect;
2222
import org.eclipse.tracecompass.analysis.counters.core.aspects.ITmfCounterAspect;
2323
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
24-
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils;
2524
import org.eclipse.tracecompass.internal.analysis.counters.core.Activator;
2625
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
2726
import org.eclipse.tracecompass.statesystem.core.StateSystemBuilderUtils;
@@ -33,6 +32,7 @@
3332
import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
3433
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
3534
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
35+
import org.eclipse.tracecompass.traceeventlogger.LogUtils;
3636

3737
import com.google.common.collect.ImmutableMap;
3838
import com.google.common.collect.ImmutableSet;
@@ -192,7 +192,7 @@ private static void handleCounterAspect(ITmfEvent event, ITmfStateSystemBuilder
192192
break;
193193
}
194194
} catch (StateValueTypeException e) {
195-
TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "HandleCounterAspect:Exception", e); //$NON-NLS-1$
195+
LogUtils.traceInstant(LOGGER, Level.WARNING, "HandleCounterAspect:Exception", e); //$NON-NLS-1$
196196
}
197197
} else {
198198
ss.modifyAttribute(event.getTimestamp().toNanos(), eventContent, quark);

analysis/org.eclipse.tracecompass.analysis.graph.core/META-INF/MANIFEST.MF

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ Import-Package: com.google.common.annotations,
2929
com.google.common.cache,
3030
com.google.common.collect,
3131
com.google.common.hash,
32-
org.apache.commons.lang3
32+
org.apache.commons.lang3,
33+
org.eclipse.tracecompass.traceeventlogger
3334
Automatic-Module-Name: org.eclipse.tracecompass.analysis.graph.core

analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/internal/analysis/graph/core/graph/historytree/HtIo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2022 École Polytechnique de Montréal and others
2+
* Copyright (c) 2022, 2025 École Polytechnique de Montréal and others
33
*
44
* All rights reserved. This program and the accompanying materials are
55
* made available under the terms of the Eclipse Public License 2.0 which
@@ -26,9 +26,9 @@
2626

2727
import org.eclipse.jdt.annotation.Nullable;
2828
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
29-
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils;
3029
import org.eclipse.tracecompass.datastore.core.interval.IHTIntervalReader;
3130
import org.eclipse.tracecompass.internal.analysis.graph.core.Activator;
31+
import org.eclipse.tracecompass.traceeventlogger.LogUtils;
3232

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

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

106106
synchronized (io) {
107107
io.seekFCToNodePos(io.fFileChannelIn, seqNb);
@@ -233,7 +233,7 @@ public HtIo(File stateHistoryFile,
233233
*/
234234
public GraphTreeNode readNode(int seqNumber) throws ClosedChannelException {
235235
/* Do a cache lookup. If it's not present it will be loaded from disk */
236-
TraceCompassLogUtils.traceInstant(LOGGER, Level.FINEST, "HtIo:CacheLookup", "seqNum", seqNumber); //$NON-NLS-1$ //$NON-NLS-2$
236+
LogUtils.traceInstant(LOGGER, Level.FINEST, "HtIo:CacheLookup", "seqNum", seqNumber); //$NON-NLS-1$ //$NON-NLS-2$
237237
CacheKey key = new CacheKey(this, seqNumber);
238238
try {
239239
return checkNotNull(NODE_CACHE.get(key));

analysis/org.eclipse.tracecompass.analysis.lami.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ Export-Package: org.eclipse.tracecompass.internal.analysis.lami.core;x-internal:
2929
Import-Package: com.google.common.annotations,
3030
com.google.common.base,
3131
com.google.common.collect,
32+
org.eclipse.tracecompass.traceeventlogger,
3233
org.json
3334
Automatic-Module-Name: org.eclipse.tracecompass.analysis.lami.core

analysis/org.eclipse.tracecompass.analysis.lami.core/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/core/module/LamiAnalysis.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir
2+
* Copyright (c) 2015, 2025 EfficiOS Inc., Alexandre Montplaisir and others
33
*
44
* All rights reserved. This program and the accompanying materials are
55
* made available under the terms of the Eclipse Public License 2.0 which
@@ -41,7 +41,6 @@
4141
import org.eclipse.osgi.util.NLS;
4242
import org.eclipse.tracecompass.common.core.NonNullUtils;
4343
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
44-
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils;
4544
import org.eclipse.tracecompass.common.core.process.ProcessUtils;
4645
import org.eclipse.tracecompass.common.core.process.ProcessUtils.OutputReaderFunction;
4746
import org.eclipse.tracecompass.internal.analysis.lami.core.Activator;
@@ -68,6 +67,7 @@
6867
import org.eclipse.tracecompass.tmf.core.analysis.ondemand.IOnDemandAnalysis;
6968
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
7069
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
70+
import org.eclipse.tracecompass.traceeventlogger.LogUtils;
7171
import org.json.JSONArray;
7272
import org.json.JSONException;
7373
import org.json.JSONObject;
@@ -309,18 +309,18 @@ private void readVersion() {
309309
final String output = getOutputFromCommand(commandLine);
310310

311311
if (output == null) {
312-
TraceCompassLogUtils.traceInstant(LOGGER, Level.INFO, LOG_NO_MI_VERSION, INVALID_MI_VERSION, command);
312+
LogUtils.traceInstant(LOGGER, Level.INFO, LOG_NO_MI_VERSION, INVALID_MI_VERSION, command);
313313
return;
314314
}
315315

316316
final String versionString = output.trim();
317317

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

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

325325

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

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

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

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

869869
@Nullable
870870
private static String getOutputFromCommand(List<String> command, boolean orError) {
871-
TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, LOG_RUNNING_MESSAGE, COMMAND, command);
871+
LogUtils.traceInstant(LOGGER, Level.FINE, LOG_RUNNING_MESSAGE, COMMAND, command);
872872
List<String> lines = ProcessUtils.getOutputFromCommand(command, orError);
873873
if (lines == null) {
874874
return null;

analysis/org.eclipse.tracecompass.analysis.os.linux.core/META-INF/MANIFEST.MF

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Import-Package: com.google.common.base,
2626
com.google.common.primitives,
2727
org.apache.commons.io,
2828
org.apache.commons.io.input,
29-
org.apache.commons.lang3
29+
org.apache.commons.lang3,
30+
org.eclipse.tracecompass.traceeventlogger
3031
Export-Package: org.eclipse.tracecompass.analysis.os.linux.core.contextswitch,
3132
org.eclipse.tracecompass.analysis.os.linux.core.cpuusage,
3233
org.eclipse.tracecompass.analysis.os.linux.core.event.aspect,

0 commit comments

Comments
 (0)