Skip to content

Commit d05f6b8

Browse files
committed
common: Deprecate TraceCompassLogUtils and use trace-event-logger lib
Deprecate TraceCompassLogUtils and make its implementation defer all its work to LogUtils from the trace-event-logger library. Replace all use of TraceCompassLogUtils with LogUtils. 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 122b3ea commit d05f6b8

File tree

85 files changed

+482
-659
lines changed

Some content is hidden

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

85 files changed

+482
-659
lines changed

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,

analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageAnalysis.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2014, 2015 École Polytechnique de Montréal and others.
2+
* Copyright (c) 2014, 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
@@ -35,8 +35,6 @@
3535
import org.eclipse.tracecompass.analysis.os.linux.core.trace.KernelEventLayoutRequirement;
3636
import org.eclipse.tracecompass.common.core.NonNullUtils;
3737
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
38-
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils;
39-
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.ScopeLog;
4038
import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
4139
import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
4240
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
@@ -52,6 +50,8 @@
5250
import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
5351
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
5452
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
53+
import org.eclipse.tracecompass.traceeventlogger.LogUtils;
54+
import org.eclipse.tracecompass.traceeventlogger.LogUtils.ScopeLog;
5555

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

275275
long currentCount = countAtEnd - countAtStart;
276276
if (currentCount < 0) {
277-
TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, "Negative count", //$NON-NLS-1$
277+
LogUtils.traceInstant(LOGGER, Level.FINE, "Negative count", //$NON-NLS-1$
278278
"CPU", curCpuName, //$NON-NLS-1$
279279
"tid", curTidName, //$NON-NLS-1$
280280
"startTime", startTime, //$NON-NLS-1$
@@ -283,7 +283,7 @@ public Map<String, Long> getCpuUsageInRange(Set<@NonNull Integer> cpus, long sta
283283
"countAtEnd", countAtEnd); //$NON-NLS-1$
284284
currentCount = 0;
285285
} else if (currentCount > endTime - startTime) {
286-
TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, "CPU usage over 100%", //$NON-NLS-1$
286+
LogUtils.traceInstant(LOGGER, Level.FINE, "CPU usage over 100%", //$NON-NLS-1$
287287
"CPU", curCpuName, //$NON-NLS-1$
288288
"tid", curTidName, //$NON-NLS-1$
289289
"startTime", startTime, //$NON-NLS-1$

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ Import-Package: com.google.common.annotations,
5555
com.google.common.base,
5656
com.google.common.cache,
5757
com.google.common.collect,
58-
org.apache.commons.lang3
58+
org.apache.commons.lang3,
59+
org.eclipse.tracecompass.traceeventlogger

analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/flamegraph/FlameGraphDataProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019 École Polytechnique de Montréal
2+
* Copyright (c) 2019, 2025 École Polytechnique de Montréal
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
@@ -40,14 +40,12 @@
4040
import org.eclipse.tracecompass.analysis.profiling.core.tree.ITree;
4141
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeGroupDescriptor;
4242
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider;
43+
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider.MetricType;
4344
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeSet;
4445
import org.eclipse.tracecompass.analysis.profiling.core.tree.WeightedTree;
4546
import org.eclipse.tracecompass.analysis.profiling.core.tree.WeightedTreeGroupBy;
46-
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider.MetricType;
4747
import org.eclipse.tracecompass.analysis.timing.core.statistics.IStatistics;
4848
import org.eclipse.tracecompass.common.core.log.TraceCompassLog;
49-
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLog;
50-
import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder;
5149
import org.eclipse.tracecompass.datastore.core.serialization.ISafeByteBufferWriter;
5250
import org.eclipse.tracecompass.internal.analysis.profiling.core.instrumented.FlameChartEntryModel;
5351
import org.eclipse.tracecompass.internal.analysis.profiling.core.instrumented.FlameChartEntryModel.EntryType;
@@ -81,6 +79,8 @@
8179
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
8280
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
8381
import org.eclipse.tracecompass.tmf.core.util.Pair;
82+
import org.eclipse.tracecompass.traceeventlogger.LogUtils.FlowScopeLog;
83+
import org.eclipse.tracecompass.traceeventlogger.LogUtils.FlowScopeLogBuilder;
8484

8585
import com.google.common.collect.HashMultimap;
8686
import com.google.common.collect.ImmutableList;

0 commit comments

Comments
 (0)