Skip to content

Commit

Permalink
common: Deprecate TraceCompassLogUtils and use trace-event-logger lib
Browse files Browse the repository at this point in the history
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 wrapped plug-in to RCP feature.

Signed-off-by: Patrick Tasse <[email protected]>
  • Loading branch information
PatrickTasse committed Jan 23, 2025
1 parent c65f3a4 commit 967dc6a
Show file tree
Hide file tree
Showing 84 changed files with 481 additions and 659 deletions.
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.trace_event_logger
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.trace_event_logger.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.trace_event_logger
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.trace_event_logger.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.trace_event_logger,
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.trace_event_logger.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.trace_event_logger
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.trace_event_logger.LogUtils;
import org.eclipse.tracecompass.trace_event_logger.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.trace_event_logger
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.trace_event_logger.LogUtils.FlowScopeLog;
import org.eclipse.tracecompass.trace_event_logger.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.trace_event_logger.LogUtils.FlowScopeLog;
import org.eclipse.tracecompass.trace_event_logger.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.trace_event_logger
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016 Ericsson
* Copyright (c) 2016, 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 Down Expand Up @@ -74,12 +74,10 @@
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeGroupDescriptor;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.common.core.NonNullUtils;
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.ui.Activator;
import org.eclipse.tracecompass.internal.analysis.profiling.core.flamegraph.DataProviderUtils;
import org.eclipse.tracecompass.internal.analysis.profiling.core.flamegraph.FlameGraphDataProvider;
import org.eclipse.tracecompass.internal.analysis.profiling.core.tree.AllGroupDescriptor;
import org.eclipse.tracecompass.internal.analysis.profiling.ui.Activator;
import org.eclipse.tracecompass.internal.analysis.profiling.ui.flamegraph.SortOption;
import org.eclipse.tracecompass.internal.provisional.tmf.core.model.filters.TmfFilterAppliedSignal;
import org.eclipse.tracecompass.internal.provisional.tmf.core.model.filters.TraceCompassFilter;
Expand Down Expand Up @@ -129,6 +127,8 @@
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry.Sampling;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils.TimeFormat;
import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog;
import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ Import-Package: com.google.common.annotations,
com.google.common.collect,
com.google.common.hash,
com.google.common.primitives,
org.apache.commons.lang3
org.apache.commons.lang3,
org.eclipse.tracecompass.trace_event_logger
Automatic-Module-Name: org.eclipse.tracecompass.analysis.timing.core
Loading

0 comments on commit 967dc6a

Please sign in to comment.