diff --git a/analysis/org.eclipse.tracecompass.analysis.counters.core/META-INF/MANIFEST.MF b/analysis/org.eclipse.tracecompass.analysis.counters.core/META-INF/MANIFEST.MF index e0b0c3ec03..7e01257127 100644 --- a/analysis/org.eclipse.tracecompass.analysis.counters.core/META-INF/MANIFEST.MF +++ b/analysis/org.eclipse.tracecompass.analysis.counters.core/META-INF/MANIFEST.MF @@ -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 diff --git a/analysis/org.eclipse.tracecompass.analysis.counters.core/src/org/eclipse/tracecompass/analysis/counters/core/CounterStateProvider.java b/analysis/org.eclipse.tracecompass.analysis.counters.core/src/org/eclipse/tracecompass/analysis/counters/core/CounterStateProvider.java index aa0bf92292..6ae2f8fd64 100644 --- a/analysis/org.eclipse.tracecompass.analysis.counters.core/src/org/eclipse/tracecompass/analysis/counters/core/CounterStateProvider.java +++ b/analysis/org.eclipse.tracecompass.analysis.counters.core/src/org/eclipse/tracecompass/analysis/counters/core/CounterStateProvider.java @@ -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 @@ -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; @@ -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; @@ -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); diff --git a/analysis/org.eclipse.tracecompass.analysis.graph.core/META-INF/MANIFEST.MF b/analysis/org.eclipse.tracecompass.analysis.graph.core/META-INF/MANIFEST.MF index bf74aae4c9..927592442b 100644 --- a/analysis/org.eclipse.tracecompass.analysis.graph.core/META-INF/MANIFEST.MF +++ b/analysis/org.eclipse.tracecompass.analysis.graph.core/META-INF/MANIFEST.MF @@ -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 diff --git a/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/internal/analysis/graph/core/graph/historytree/HtIo.java b/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/internal/analysis/graph/core/graph/historytree/HtIo.java index 446d74ec1d..99289a6aac 100644 --- a/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/internal/analysis/graph/core/graph/historytree/HtIo.java +++ b/analysis/org.eclipse.tracecompass.analysis.graph.core/src/org/eclipse/tracecompass/internal/analysis/graph/core/graph/historytree/HtIo.java @@ -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 @@ -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; @@ -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); @@ -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)); diff --git a/analysis/org.eclipse.tracecompass.analysis.lami.core/META-INF/MANIFEST.MF b/analysis/org.eclipse.tracecompass.analysis.lami.core/META-INF/MANIFEST.MF index 47242cbf38..f7aa5d35b4 100644 --- a/analysis/org.eclipse.tracecompass.analysis.lami.core/META-INF/MANIFEST.MF +++ b/analysis/org.eclipse.tracecompass.analysis.lami.core/META-INF/MANIFEST.MF @@ -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 diff --git a/analysis/org.eclipse.tracecompass.analysis.lami.core/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/core/module/LamiAnalysis.java b/analysis/org.eclipse.tracecompass.analysis.lami.core/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/core/module/LamiAnalysis.java index bc839a12ef..e012fc2b4c 100644 --- a/analysis/org.eclipse.tracecompass.analysis.lami.core/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/core/module/LamiAnalysis.java +++ b/analysis/org.eclipse.tracecompass.analysis.lami.core/src/org/eclipse/tracecompass/internal/provisional/analysis/lami/core/module/LamiAnalysis.java @@ -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 @@ -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; @@ -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; @@ -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$ @@ -406,7 +406,7 @@ protected boolean checkMetadata() { */ List 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)); @@ -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; } @@ -699,7 +699,7 @@ public List execute(ITmfTrace trace, @Nullable TmfTimeRange tim builder.addAll(extraParams); builder.add(tracePath); List 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()) { @@ -848,7 +848,7 @@ public List 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); } @@ -868,7 +868,7 @@ private LamiTableClass getTableClassFromName(String tableClassName) throws JSONE @Nullable private static String getOutputFromCommand(List command, boolean orError) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, LOG_RUNNING_MESSAGE, COMMAND, command); + LogUtils.traceInstant(LOGGER, Level.FINE, LOG_RUNNING_MESSAGE, COMMAND, command); List lines = ProcessUtils.getOutputFromCommand(command, orError); if (lines == null) { return null; diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/META-INF/MANIFEST.MF b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/META-INF/MANIFEST.MF index 1a85c56724..2f969fe3ae 100644 --- a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/META-INF/MANIFEST.MF +++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/META-INF/MANIFEST.MF @@ -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, diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageAnalysis.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageAnalysis.java index ef55542b7b..d65116656d 100644 --- a/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageAnalysis.java +++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/cpuusage/KernelCpuUsageAnalysis.java @@ -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 @@ -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; @@ -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; @@ -274,7 +274,7 @@ public Map 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$ @@ -283,7 +283,7 @@ public Map 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$ diff --git a/analysis/org.eclipse.tracecompass.analysis.profiling.core/META-INF/MANIFEST.MF b/analysis/org.eclipse.tracecompass.analysis.profiling.core/META-INF/MANIFEST.MF index 10f8c0b9a3..1ee7f8b9e6 100644 --- a/analysis/org.eclipse.tracecompass.analysis.profiling.core/META-INF/MANIFEST.MF +++ b/analysis/org.eclipse.tracecompass.analysis.profiling.core/META-INF/MANIFEST.MF @@ -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 diff --git a/analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/flamegraph/FlameGraphDataProvider.java b/analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/flamegraph/FlameGraphDataProvider.java index b9fd631dd8..196f466ee4 100644 --- a/analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/flamegraph/FlameGraphDataProvider.java +++ b/analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/flamegraph/FlameGraphDataProvider.java @@ -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 @@ -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; @@ -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; diff --git a/analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/instrumented/FlameChartDataProvider.java b/analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/instrumented/FlameChartDataProvider.java index b34840f925..6823e59a2d 100644 --- a/analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/instrumented/FlameChartDataProvider.java +++ b/analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/internal/analysis/profiling/core/instrumented/FlameChartDataProvider.java @@ -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 @@ -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; @@ -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; diff --git a/analysis/org.eclipse.tracecompass.analysis.profiling.ui/META-INF/MANIFEST.MF b/analysis/org.eclipse.tracecompass.analysis.profiling.ui/META-INF/MANIFEST.MF index 4640f7e59f..b4a8d70835 100644 --- a/analysis/org.eclipse.tracecompass.analysis.profiling.ui/META-INF/MANIFEST.MF +++ b/analysis/org.eclipse.tracecompass.analysis.profiling.ui/META-INF/MANIFEST.MF @@ -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 diff --git a/analysis/org.eclipse.tracecompass.analysis.profiling.ui/src/org/eclipse/tracecompass/internal/analysis/profiling/ui/flamegraph2/FlameGraphView.java b/analysis/org.eclipse.tracecompass.analysis.profiling.ui/src/org/eclipse/tracecompass/internal/analysis/profiling/ui/flamegraph2/FlameGraphView.java index bf96391603..76294cb349 100644 --- a/analysis/org.eclipse.tracecompass.analysis.profiling.ui/src/org/eclipse/tracecompass/internal/analysis/profiling/ui/flamegraph2/FlameGraphView.java +++ b/analysis/org.eclipse.tracecompass.analysis.profiling.ui/src/org/eclipse/tracecompass/internal/analysis/profiling/ui/flamegraph2/FlameGraphView.java @@ -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 @@ -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; @@ -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; diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.core/META-INF/MANIFEST.MF b/analysis/org.eclipse.tracecompass.analysis.timing.core/META-INF/MANIFEST.MF index 1ab9db7a82..dd983deb5e 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.core/META-INF/MANIFEST.MF +++ b/analysis/org.eclipse.tracecompass.analysis.timing.core/META-INF/MANIFEST.MF @@ -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 diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/analysis/timing/core/segmentstore/SegmentStoreAnalysisModule.java b/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/analysis/timing/core/segmentstore/SegmentStoreAnalysisModule.java index 2790240550..5138a9b457 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/analysis/timing/core/segmentstore/SegmentStoreAnalysisModule.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/analysis/timing/core/segmentstore/SegmentStoreAnalysisModule.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 Ericsson + * Copyright (c) 2022, 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 @@ -29,7 +29,6 @@ import org.eclipse.jdt.annotation.Nullable; import org.eclipse.tracecompass.common.core.NonNullUtils; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.ScopeLog; import org.eclipse.tracecompass.segmentstore.core.ISegment; import org.eclipse.tracecompass.segmentstore.core.ISegmentStore; import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule; @@ -38,6 +37,7 @@ import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableSet; diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/segmentstore/SegmentStoreTableDataProvider.java b/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/segmentstore/SegmentStoreTableDataProvider.java index a9ae8f3dee..d40c0ff282 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/segmentstore/SegmentStoreTableDataProvider.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/segmentstore/SegmentStoreTableDataProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022, 2024 Ericsson + * Copyright (c) 2022, 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 @@ -38,9 +38,6 @@ import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider; 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.FlowScopeLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder; import org.eclipse.tracecompass.internal.provisional.tmf.core.model.filters.VirtualTableQueryFilter; import org.eclipse.tracecompass.internal.provisional.tmf.core.model.table.ITmfVirtualTableDataProvider; import org.eclipse.tracecompass.internal.provisional.tmf.core.model.table.ITmfVirtualTableModel; @@ -68,6 +65,9 @@ import org.eclipse.tracecompass.tmf.core.segment.SegmentStartNsTimeAspect; import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; @@ -247,7 +247,7 @@ public String getAspectName() { */ public SegmentStoreTableDataProvider(ITmfTrace trace, ISegmentStoreProvider segmentProvider, String analysisId) { super(trace); - TraceCompassLogUtils.traceObjectCreation(LOGGER, Level.FINE, this); + LogUtils.traceObjectCreation(LOGGER, Level.FINE, this); fId = analysisId; fIsFirstAspect = true; fAllIndexes = new HashMap<>(); @@ -257,7 +257,7 @@ public SegmentStoreTableDataProvider(ITmfTrace trace, ISegmentStoreProvider segm @Override public void dispose() { - TraceCompassLogUtils.traceObjectDestruction(LOGGER, Level.FINE, this, 10); + LogUtils.traceObjectDestruction(LOGGER, Level.FINE, this, 10); } /** @@ -278,7 +278,7 @@ private void buildIndex(long id, Comparator comparator, String aspectN if (segStore != null) { synchronized (fAllIndexes) { try (FlowScopeLog scope = new FlowScopeLogBuilder(LOGGER, Level.FINE, "SegmentStoreTableDataProvider#buildIndex.buildingIndexes").build()) { //$NON-NLS-1$ - TraceCompassLogUtils.traceObjectCreation(LOGGER, Level.FINE, fAllIndexes); + LogUtils.traceObjectCreation(LOGGER, Level.FINE, fAllIndexes); Iterable sortedSegmentStore = segStore.iterator(comparator); List indexes = getIndexes(sortedSegmentStore); if (fIsFirstAspect) { @@ -289,9 +289,9 @@ private void buildIndex(long id, Comparator comparator, String aspectN fAllIndexes.put(id, new SegmentIndexesComparatorWrapper(indexes, comparator, aspectName)); } } catch (Exception ex) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.SEVERE, "error build index", ex.getMessage()); //$NON-NLS-1$ + LogUtils.traceInstant(LOGGER, Level.SEVERE, "error build index", ex.getMessage()); //$NON-NLS-1$ } finally { - TraceCompassLogUtils.traceObjectDestruction(LOGGER, Level.FINE, fAllIndexes); + LogUtils.traceObjectDestruction(LOGGER, Level.FINE, fAllIndexes); } } } @@ -372,7 +372,7 @@ public TmfModelResponse> fetchTree(Map> fetchLines(Map fetchParameters, @Nullable IProgressMonitor monitor) { - TraceCompassLogUtils.traceAsyncStart(LOGGER, Level.FINE, "SegmentStoreTableDataProvider#fetchLines", fId, 2); //$NON-NLS-1$ + LogUtils.traceAsyncStart(LOGGER, Level.FINE, "SegmentStoreTableDataProvider#fetchLines", fId, 2); //$NON-NLS-1$ fetchParameters.putIfAbsent(DataProviderParameterUtils.REQUESTED_COLUMN_IDS_KEY, Collections.emptyList()); VirtualTableQueryFilter queryFilter = FetchParametersUtils.createVirtualTableQueryFilter(fetchParameters); if (queryFilter == null) { @@ -394,12 +394,12 @@ public TmfModelResponse> fetchLines(Map< } synchronized (fAllIndexes) { try (FlowScopeLog scope = new FlowScopeLogBuilder(LOGGER, Level.FINE, "SegmentStoreTableDataProvider#fetchLines").build()) { //$NON-NLS-1$ - TraceCompassLogUtils.traceObjectCreation(LOGGER, Level.FINER, fAllIndexes); + LogUtils.traceObjectCreation(LOGGER, Level.FINER, fAllIndexes); return extractRequestedLines(queryFilter, fetchParameters, segStore, aspects, indexesComparatorWrapper); } catch (Exception ex) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.SEVERE, "error fetching lines ", ex.getMessage()); //$NON-NLS-1$ + LogUtils.traceInstant(LOGGER, Level.SEVERE, "error fetching lines ", ex.getMessage()); //$NON-NLS-1$ } finally { - TraceCompassLogUtils.traceObjectDestruction(LOGGER, Level.FINER, fAllIndexes); + LogUtils.traceObjectDestruction(LOGGER, Level.FINER, fAllIndexes); } } } diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/META-INF/MANIFEST.MF b/analysis/org.eclipse.tracecompass.analysis.timing.ui/META-INF/MANIFEST.MF index 66c2335523..ea2f43b55b 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/META-INF/MANIFEST.MF +++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/META-INF/MANIFEST.MF @@ -31,4 +31,5 @@ Export-Package: org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore, org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.statistics;x-internal:=true, org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.table;x-internal:=true, org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.xyscatter;x-internal:=true +Import-Package: org.eclipse.tracecompass.trace_event_logger Automatic-Module-Name: org.eclipse.tracecompass.analysis.timing.ui diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java index b7de904f09..ce13bdaaef 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Ericsson + * Copyright (c) 2015, 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 @@ -55,8 +55,6 @@ import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider; 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.timing.ui.Activator; import org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.table.Messages; import org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.table.SegmentStoreContentProvider; @@ -87,6 +85,8 @@ import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; import org.eclipse.tracecompass.tmf.ui.actions.OpenSourceCodeAction; import org.eclipse.tracecompass.tmf.ui.viewers.table.TmfSimpleTableViewer; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.HashMultimap; @@ -329,7 +329,7 @@ public void updateModel(final @Nullable Object dataInput) { SegmentStoreContentProvider contentProvider = (SegmentStoreContentProvider) getTableViewer().getContentProvider(); long segmentCount = contentProvider.getSegmentCount(); String contentProviderName = contentProvider.getClass().getSimpleName(); - TraceCompassLogUtils.traceCounter(LOGGER, Level.FINE, "SegmentStoreTableViewer#updateModel", contentProviderName, segmentCount); //$NON-NLS-1$ + LogUtils.traceCounter(LOGGER, Level.FINE, "SegmentStoreTableViewer#updateModel", contentProviderName, segmentCount); //$NON-NLS-1$ if (segmentCount > MAX_ITEMS) { tableViewer.setItemCount(MAX_ITEMS); Activator.getDefault().logWarning("Too many items to display for " + contentProviderName + ". Cannot display " + segmentCount + " in a reasonable timeframe."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ diff --git a/common/org.eclipse.tracecompass.common.core.tests/META-INF/MANIFEST.MF b/common/org.eclipse.tracecompass.common.core.tests/META-INF/MANIFEST.MF index 0c4e840ded..5b7788e269 100644 --- a/common/org.eclipse.tracecompass.common.core.tests/META-INF/MANIFEST.MF +++ b/common/org.eclipse.tracecompass.common.core.tests/META-INF/MANIFEST.MF @@ -20,5 +20,6 @@ Export-Package: org.eclipse.tracecompass.common.core.tests;x-friends:="org.eclip org.eclipse.tracecompass.common.core.tests.math;x-internal:=true 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.common.core.tests diff --git a/common/org.eclipse.tracecompass.common.core/META-INF/MANIFEST.MF b/common/org.eclipse.tracecompass.common.core/META-INF/MANIFEST.MF index 77c67d1a3f..8d224e7cdc 100644 --- a/common/org.eclipse.tracecompass.common.core/META-INF/MANIFEST.MF +++ b/common/org.eclipse.tracecompass.common.core/META-INF/MANIFEST.MF @@ -21,5 +21,6 @@ Export-Package: org.eclipse.tracecompass.common.core, org.eclipse.tracecompass.internal.common.core;x-internal:=true, org.eclipse.tracecompass.internal.common.core.log;x-friends:="org.eclipse.tracecompass.common.core.tests" Import-Package: com.google.common.base, - com.google.common.collect + com.google.common.collect, + org.eclipse.tracecompass.trace_event_logger Automatic-Module-Name: org.eclipse.tracecompass.common.core diff --git a/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/log/TraceCompassLogUtils.java b/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/log/TraceCompassLogUtils.java index 66055ef09c..9688f034a9 100644 --- a/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/log/TraceCompassLogUtils.java +++ b/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/log/TraceCompassLogUtils.java @@ -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 @@ -11,20 +11,13 @@ package org.eclipse.tracecompass.common.core.log; -import java.text.DecimalFormat; -import java.text.Format; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.Objects; import java.util.logging.Level; import java.util.logging.Logger; import org.eclipse.jdt.annotation.Nullable; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.IFlowScopeLog; /** * Logger helper @@ -102,26 +95,11 @@ * @since 3.0 * @noinstantiate This class is not intended to be instantiated by clients. It * is a helper class. + * @deprecated Use {@link LogUtils} instead. */ +@Deprecated public final class TraceCompassLogUtils { - private static final Format FORMAT = new DecimalFormat("#.###"); //$NON-NLS-1$ - - /* - * Field names - */ - private static final String ARGS = "args"; //$NON-NLS-1$ - private static final String NAME = "name"; //$NON-NLS-1$ - private static final String CATEGORY = "cat"; //$NON-NLS-1$ - private static final String ID = "id"; //$NON-NLS-1$ - private static final String TID = "tid"; //$NON-NLS-1$ - private static final String PID = "pid"; //$NON-NLS-1$ - private static final String TIMESTAMP = "ts"; //$NON-NLS-1$ - private static final String PHASE = "ph"; //$NON-NLS-1$ - - private static final String ARGS_ERROR_MESSAGE = "Data should be in the form of key, value, key1, value1, ... TraceCompassScopeLog was supplied "; //$NON-NLS-1$ - private static final AtomicInteger ID_GENERATOR = new AtomicInteger(0); - private TraceCompassLogUtils() { // do nothing } @@ -151,14 +129,7 @@ private TraceCompassLogUtils() { * INFO: {"ts":"12366,"ph":"E","tid":1} * */ - public static class ScopeLog implements AutoCloseable { - - private final long fTime; - private final long fThreadId; - private final Logger fLogger; - private final Level fLevel; - private final String fLabel; - private final Map fData = new HashMap<>(); + public static class ScopeLog extends LogUtils.ScopeLog { /** * Scope logger constructor @@ -176,50 +147,7 @@ public static class ScopeLog implements AutoCloseable { * beginning of the scope */ public ScopeLog(Logger log, Level level, String label, Object... args) { - fTime = System.nanoTime(); - fLogger = log; - fLevel = level; - fThreadId = Thread.currentThread().getId(); - fLabel = label; - fLogger.log(fLevel, (() -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'B', fTime, fThreadId); - appendName(sb, fLabel); - appendArgs(sb, args); - sb.append('}'); - return sb.toString(); - })); - } - - /** - * Add a tag to the scope logger, will be written at the exit. This can - * save space on the trace by having a field appended to an event rather - * than writing a whole new event for a small chunk of data. - * - * If the timing information is important than it would be more - * appropriate to call - * {@link TraceCompassLogUtils#traceInstant(Logger, Level, String, Object...)} - * - * @param name - * the name of the field - * @param value - * The value of the field. - */ - public void addData(String name, Object value) { - fData.put(name, value); - } - - @Override - public void close() { - long time = System.nanoTime(); - fLogger.log(fLevel, (() -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'E', time, fThreadId); - return appendArgs(sb, fData).append('}').toString(); - })); - TraceCompassMonitorManager.getInstance().update(fLabel, time - fTime); + super(log, level, label, args); } } @@ -231,15 +159,7 @@ public void close() { * @author Geneviève Bastien */ public static class FlowScopeLogBuilder { - - private final Logger fLogger; - private final Level fLevel; - private final String fLabel; - private final Object[] fArgs; - private int fId = Integer.MIN_VALUE; - private @Nullable String fCategory = null; - private @Nullable FlowScopeLog fParent = null; - private boolean fHasParent = false; + private LogUtils.FlowScopeLogBuilder wrapped; /** * Flow scope log builder constructor @@ -255,10 +175,7 @@ public static class FlowScopeLogBuilder { * value2.... typically arguments */ public FlowScopeLogBuilder(Logger logger, Level level, String label, Object... args) { - fLogger = logger; - fLevel = level; - fLabel = label; - fArgs = args; + wrapped = new LogUtils.FlowScopeLogBuilder(logger, level, label, args); } /** @@ -266,7 +183,7 @@ public FlowScopeLogBuilder(Logger logger, Level level, String label, Object... a * will be automatically generated. * * This method is mutually exclusive with - * {@link #setParentScope(FlowScopeLog)}. Calling both will throw an + * {@link #setParentScope(IFlowScopeLog)}. Calling both will throw an * exception. * * @param category @@ -274,10 +191,7 @@ public FlowScopeLogBuilder(Logger logger, Level level, String label, Object... a * @return This builder */ public FlowScopeLogBuilder setCategory(String category) { - if (fParent != null) { - throw new IllegalStateException("FlowScopeLogBuilder: Cannot set a category if a parent has already been set"); //$NON-NLS-1$ - } - fCategory = category; + wrapped.setCategory(category); return this; } @@ -285,7 +199,7 @@ public FlowScopeLogBuilder setCategory(String category) { * Set a category and ID for the flow scope. * * This method is mutually exclusive with - * {@link #setParentScope(FlowScopeLog)}. Calling both will throw an + * {@link #setParentScope(IFlowScopeLog)}. Calling both will throw an * exception. * * @param category @@ -295,14 +209,7 @@ public FlowScopeLogBuilder setCategory(String category) { * @return This builder */ public FlowScopeLogBuilder setCategoryAndId(String category, int id) { - if (fParent != null) { - throw new IllegalStateException("FlowScopeLogBuilder: Cannot set a category if a parent has already been set"); //$NON-NLS-1$ - } - fCategory = category; - fId = id; - // Id is already set, so assume this scope has a parent, even if the - // parent object is not available - fHasParent = true; + wrapped.setCategoryAndId(category, id); return this; } @@ -318,11 +225,8 @@ public FlowScopeLogBuilder setCategoryAndId(String category, int id) { * The parent scope * @return This builder */ - public FlowScopeLogBuilder setParentScope(FlowScopeLog parent) { - if (fCategory != null) { - throw new IllegalStateException("FlowScopeLogBuilder: Cannot set a parent scope if a category has already been set"); //$NON-NLS-1$ - } - fParent = parent; + public FlowScopeLogBuilder setParentScope(IFlowScopeLog parent) { + wrapped.setParentScope(parent); return this; } @@ -332,14 +236,8 @@ public FlowScopeLogBuilder setParentScope(FlowScopeLog parent) { * @return The flow scope log */ public FlowScopeLog build() { - FlowScopeLog parent = fParent; - if (parent != null) { - // Has a parent scope, so step in flow - return new FlowScopeLog(fLogger, fLevel, fLabel, parent.fCategory, parent.fId, false, fArgs); - } - return new FlowScopeLog(fLogger, fLevel, fLabel, String.valueOf(fCategory), (fId == Integer.MIN_VALUE ? ID_GENERATOR.incrementAndGet() : fId), !fHasParent, fArgs); + return new FlowScopeLog(Objects.requireNonNull(wrapped.build())); } - } /** @@ -376,66 +274,11 @@ public FlowScopeLog build() { * INFO: {"ts":"12420,"ph":"f","tid":0,"cat":"category", "id":256} * */ - public static class FlowScopeLog implements AutoCloseable { - - private final long fThreadId; - private final Logger fLogger; - private final Level fLevel; - private final int fId; - private final String fCategory; - private final Map fData = new HashMap<>(); - private final String fLabel; - private final long fTime; + public static class FlowScopeLog implements IFlowScopeLog, AutoCloseable { + private LogUtils.FlowScopeLog wrapped; - /** - * Flow scope logger constructor - * - * @param log - * the JUL logger - * @param level - * the log level see {@link Level} - * @param label - * The label of the event pair - * @param category - * the category of the flow events - * @param id - * The id of the flow - * @param startFlow - * Whether this flow scope object is the start of a flow, or - * a step - * @param args - * the messages to pass, should be in pairs key, value, key2, - * value2.... typically arguments - */ - private FlowScopeLog(Logger log, Level level, String label, String category, int id, boolean startFlow, Object... args) { - fTime = System.nanoTime(); - fId = id; - fLogger = log; - fLevel = level; - fCategory = category; - fLabel = label; - fThreadId = Thread.currentThread().getId(); - fLogger.log(fLevel, (() -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'B', fTime, fThreadId); - appendName(sb, label); - appendArgs(sb, args); - sb.append('}'); - return sb.toString(); - })); - // Add a flow event, either start or step in enclosing scope - fLogger.log(fLevel, (() -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, startFlow ? 's' : 't', fTime, fThreadId); - appendName(sb, label); - appendCategory(sb, category); - appendId(sb, fId); - appendArgs(sb, args); - sb.append('}'); - return sb.toString(); - })); + private FlowScopeLog(LogUtils.FlowScopeLog flowScopeLog) { + this.wrapped = flowScopeLog; } /** @@ -447,18 +290,7 @@ private FlowScopeLog(Logger log, Level level, String label, String category, int * the arguments to log */ public void step(String label, Object... args) { - long time = System.nanoTime(); - fLogger.log(fLevel, (() -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 't', time, fThreadId); - appendName(sb, label); - appendCategory(sb, fCategory); - appendId(sb, fId); - appendArgs(sb, args); - sb.append('}'); - return sb.toString(); - })); + wrapped.step(label, args); } /** @@ -476,32 +308,24 @@ public void step(String label, Object... args) { * The value of the field. */ public void addData(String name, Object value) { - fData.put(name, value); + wrapped.addData(name, value); } - /** - * Get the ID for this scope. The ID can be injected to other components - * that can use it for the scope loggers - * - * @return The ID of this scope - */ + @Override + public String getCategory() { + return String.valueOf(wrapped.getCategory()); + } + + @Override public int getId() { - return fId; + return wrapped.getId(); } @Override public void close() { - long time = System.nanoTime(); - fLogger.log(fLevel, (() -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'E', time, fThreadId); - appendArgs(sb, fData); - sb.append('}'); - return sb.toString(); - })); - TraceCompassMonitorManager.getInstance().update(fLabel, time - fTime); + wrapped.close(); } + } /** @@ -523,18 +347,7 @@ public void close() { * @return The unique ID of this object (there may be collisions) */ public static int traceObjectCreation(Logger logger, Level level, Object item) { - long time = System.nanoTime(); - long threadId = Thread.currentThread().getId(); - int identityHashCode = System.identityHashCode(item); - logger.log(level, () -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'N', time, threadId); - appendName(sb, item.getClass().getSimpleName()); - appendId(sb, identityHashCode); - return sb.append('}').toString(); - }); - return identityHashCode; + return LogUtils.traceObjectCreation(logger, level, item); } /** @@ -552,16 +365,7 @@ public static int traceObjectCreation(Logger logger, Level level, Object item) { * the Object to trace */ public static void traceObjectDestruction(Logger logger, Level level, Object item) { - long time = System.nanoTime(); - long threadId = Thread.currentThread().getId(); - logger.log(level, () -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'D', time, threadId); - appendName(sb, item.getClass().getSimpleName()); - appendId(sb, System.identityHashCode(item)); - return sb.append('}').toString(); - }); + LogUtils.traceObjectDestruction(logger, level, item); } /** @@ -580,16 +384,7 @@ public static void traceObjectDestruction(Logger logger, Level level, Object ite * The unique ID */ public static void traceObjectDestruction(Logger logger, Level level, Object item, int uniqueId) { - long time = System.nanoTime(); - long threadId = Thread.currentThread().getId(); - logger.log(level, () -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'D', time, threadId); - appendName(sb, item.getClass().getSimpleName()); - appendId(sb, uniqueId); - return sb.append('}').toString(); - }); + LogUtils.traceObjectDestruction(logger, level, item, uniqueId); } /** @@ -611,17 +406,7 @@ public static void traceObjectDestruction(Logger logger, Level level, Object ite * Additional arguments to log */ public static void traceAsyncStart(Logger logger, Level level, @Nullable String name, @Nullable String category, int id, Object... args) { - long time = System.nanoTime(); - long threadId = Thread.currentThread().getId(); - logger.log(level, () -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'b', time, threadId); - appendName(sb, name); - appendCategory(sb, category); - appendId(sb, id); - return appendArgs(sb, args).append('}').toString(); - }); + LogUtils.traceAsyncStart(logger, level, name, category, id, args); } /** @@ -643,17 +428,7 @@ public static void traceAsyncStart(Logger logger, Level level, @Nullable String * Additional arguments to log */ public static void traceAsyncNested(Logger logger, Level level, @Nullable String name, @Nullable String category, int id, Object... args) { - long time = System.nanoTime(); - long threadId = Thread.currentThread().getId(); - logger.log(level, () -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'n', time, threadId); - appendName(sb, name); - appendCategory(sb, category); - appendId(sb, id); - return appendArgs(sb, args).append('}').toString(); - }); + LogUtils.traceAsyncNested(logger, level, name, category, id, args); } /** @@ -675,17 +450,7 @@ public static void traceAsyncNested(Logger logger, Level level, @Nullable String * Additional arguments to log */ public static void traceAsyncEnd(Logger logger, Level level, @Nullable String name, @Nullable String category, int id, Object... args) { - long time = System.nanoTime(); - long threadId = Thread.currentThread().getId(); - logger.log(level, () -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'e', time, threadId); - appendName(sb, name); - appendCategory(sb, category); - appendId(sb, id); - return appendArgs(sb, args).append('}').toString(); - }); + LogUtils.traceAsyncEnd(logger, level, name, category, id, args); } /** @@ -706,15 +471,7 @@ public static void traceAsyncEnd(Logger logger, Level level, @Nullable String na * Additional arguments to log */ public static void traceInstant(Logger logger, Level level, String name, Object... args) { - long time = System.nanoTime(); - long threadId = Thread.currentThread().getId(); - logger.log(level, () -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'i', time, threadId); - appendName(sb, name); - return appendArgs(sb, args).append('}').toString(); - }); + LogUtils.traceInstant(logger, level, name, args); } /** @@ -731,15 +488,7 @@ public static void traceInstant(Logger logger, Level level, String name, Object. * The counters to log in the format : "title", value */ public static void traceCounter(Logger logger, Level level, @Nullable String name, Object... args) { - long time = System.nanoTime(); - long threadId = Thread.currentThread().getId(); - logger.log(level, () -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'C', time, threadId); - appendName(sb, name); - return appendArgs(sb, args).append('}').toString(); - }); + LogUtils.traceCounter(logger, level, name, args); } /** @@ -760,128 +509,7 @@ public static void traceCounter(Logger logger, Level level, @Nullable String nam * "color" and an rbga will be used */ public static void traceMarker(Logger logger, Level level, @Nullable String name, long duration, Object... args) { - long time = System.nanoTime(); - long threadId = Thread.currentThread().getId(); - logger.log(level, () -> { - StringBuilder sb = new StringBuilder(); - sb.append('{'); - appendCommon(sb, 'R', time, threadId); - appendName(sb, name); - sb.append(','); - writeObject(sb, "dur", duration); //$NON-NLS-1$ - return appendArgs(sb, args).append('}').toString(); - }); - } - - // ------------------------------------------------------------------------- - // Helpers - // ------------------------------------------------------------------------- - - /* - * USE ME FIRST - */ - private static StringBuilder appendCommon(StringBuilder appendTo, char phase, long time, long threadId) { - writeObject(appendTo, TIMESTAMP, FORMAT.format((double) time / 1000)).append(','); // $NON-NLS-1$ - writeObject(appendTo, PHASE, phase).append(','); - writeObject(appendTo, TID, threadId).append(','); - return writeObject(appendTo, PID, threadId); // $NON-NLS-1$ - } - - private static StringBuilder appendName(StringBuilder sb, @Nullable String name) { - if (name != null) { - sb.append(','); - writeObject(sb, NAME, name); - } - return sb; + LogUtils.traceMarker(logger, level, name, duration, args); } - private static StringBuilder appendCategory(StringBuilder sb, @Nullable String category) { - if (category != null) { - sb.append(','); - writeObject(sb, CATEGORY, category); - } - return sb; - } - - private static StringBuilder appendId(StringBuilder sb, int id) { - return sb.append(',') - .append('"') - .append(ID) - .append("\":\"0x") //$NON-NLS-1$ - .append(Integer.toHexString(id)) - .append('"'); - } - - private static StringBuilder appendArgs(StringBuilder sb, Map args) { - if (!args.isEmpty()) { - sb.append(',') - .append('"') - .append(ARGS) - .append('"') - .append(':'); - Object[] argsArray = new Object[2 * args.size()]; - Iterator> entryIter = args.entrySet().iterator(); - for (int i = 0; i < args.size(); i++) { - Entry entry = entryIter.next(); - argsArray[i] = entry.getKey(); - argsArray[i + 1] = entry.getValue(); - } - getArgs(sb, argsArray); - } - return sb; - } - - private static StringBuilder appendArgs(StringBuilder sb, Object... args) { - if (args.length > 0) { - sb.append(',') - .append('"') - .append(ARGS) - .append('"') - .append(':'); - getArgs(sb, args); - } - return sb; - } - - private static StringBuilder getArgs(StringBuilder appendTo, Object[] data) { - if (data.length == 0) { - return appendTo; - } - Set tester = new HashSet<>(); - appendTo.append('{'); - if (data.length == 1) { - // not in contract, but let's assume here that people are still new - // at this - appendTo.append("\"msg\":\"").append(data[0]).append('"'); //$NON-NLS-1$ - } else { - if (data.length % 2 != 0) { - throw new IllegalArgumentException( - ARGS_ERROR_MESSAGE + "an odd number of messages" + Arrays.asList(data).toString()); //$NON-NLS-1$ - } - for (int i = 0; i < data.length - 1; i += 2) { - Object value = data[i + 1]; - String keyVal = String.valueOf(data[i]); - if (tester.contains(keyVal)) { - throw new IllegalArgumentException(ARGS_ERROR_MESSAGE + "an duplicate field names : " + keyVal); //$NON-NLS-1$ - } - tester.add(keyVal); - if (i > 0) { - appendTo.append(','); - } - writeObject(appendTo, keyVal, value); - } - } - - return appendTo.append('}'); - } - - private static StringBuilder writeObject(StringBuilder appendTo, Object key, @Nullable Object value) { - appendTo.append('"').append(key).append('"').append(':'); - if (value instanceof Number) { - appendTo.append(value); - } else { - appendTo.append('"').append(String.valueOf(value)).append('"'); - } - return appendTo; - } } diff --git a/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/process/ProcessUtils.java b/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/process/ProcessUtils.java index 4f0069519e..467e185084 100644 --- a/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/process/ProcessUtils.java +++ b/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/process/ProcessUtils.java @@ -30,8 +30,8 @@ import org.eclipse.core.runtime.Status; 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.internal.common.core.Activator; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; /** * Common utility methods for launching external processes and retrieving their @@ -62,7 +62,7 @@ private ProcessUtils() {} * @since 5.0 */ public static @Nullable List getOutputFromCommand(List command, boolean orError) { - try (TraceCompassLogUtils.ScopeLog sl = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ProcessUtils#getOutputFromComment", "args", command)) { //$NON-NLS-1$ //$NON-NLS-2$ + try (ScopeLog sl = new ScopeLog(LOGGER, Level.FINER, "ProcessUtils#getOutputFromComment", "args", command)) { //$NON-NLS-1$ //$NON-NLS-2$ ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); @@ -162,7 +162,7 @@ public static List getOutputFromCommandCancellable(List command, CancellableRunnable cancellerRunnable = null; Thread cancellerThread = null; - try (TraceCompassLogUtils.ScopeLog sl = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ProcessUtils#getOutputFromCommandCancellable", "MainTaskName", mainTaskName, "args", command)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + try (ScopeLog sl = new ScopeLog(LOGGER, Level.FINER, "ProcessUtils#getOutputFromCommandCancellable", "MainTaskName", mainTaskName, "args", command)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ monitor.beginTask(mainTaskName, PROGRESS_DURATION); ProcessBuilder builder = new ProcessBuilder(command); diff --git a/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/xml/XmlUtils.java b/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/xml/XmlUtils.java index 5104ab2bca..938ba5a5ba 100644 --- a/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/xml/XmlUtils.java +++ b/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/common/core/xml/XmlUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2019 Ericsson + * Copyright (c) 2018, 2025 Ericsson * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -33,7 +33,7 @@ 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.trace_event_logger.LogUtils; import org.xml.sax.SAXException; import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; @@ -157,7 +157,7 @@ public static DocumentBuilderFactory newSafeDocumentBuilderFactory() { private static void logException(String feature, ParserConfigurationException e) { // This should catch a failed setFeature feature - TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "ParserConfigurationException", "feature", feature, "stack", e.getStackTrace()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + LogUtils.traceInstant(LOGGER, Level.WARNING, "ParserConfigurationException", "feature", feature, "stack", e.getStackTrace()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } /** diff --git a/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/internal/common/core/Activator.java b/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/internal/common/core/Activator.java index 4c04aae1cf..7a2ba6a234 100644 --- a/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/internal/common/core/Activator.java +++ b/common/org.eclipse.tracecompass.common.core/src/org/eclipse/tracecompass/internal/common/core/Activator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Ericsson + * Copyright (c) 2014, 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 @@ -21,7 +21,7 @@ import org.eclipse.tracecompass.common.core.TraceCompassActivator; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; /** * Plugin activator @@ -77,7 +77,7 @@ protected void startActions() { } long end = System.nanoTime(); long bogoMips = (long) (1e12 / (end - start)); - TraceCompassLogUtils.traceInstant(logger, Level.SEVERE, PLUGIN_ID, "HostName", hostName, "OS", os, "Nb Processors", nbCpus, "BogoMips", bogoMips, "Memory", memory); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + LogUtils.traceInstant(logger, Level.SEVERE, PLUGIN_ID, "HostName", hostName, "OS", os, "Nb Processors", nbCpus, "BogoMips", bogoMips, "Memory", memory); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } @Override diff --git a/jsontrace/org.eclipse.tracecompass.jsontrace.core/META-INF/MANIFEST.MF b/jsontrace/org.eclipse.tracecompass.jsontrace.core/META-INF/MANIFEST.MF index 2a63dbf2b4..4f4a05305a 100644 --- a/jsontrace/org.eclipse.tracecompass.jsontrace.core/META-INF/MANIFEST.MF +++ b/jsontrace/org.eclipse.tracecompass.jsontrace.core/META-INF/MANIFEST.MF @@ -16,4 +16,5 @@ Require-Bundle: org.eclipse.tracecompass.common.core, Export-Package: org.eclipse.tracecompass.internal.jsontrace.core;x-internal:=true, org.eclipse.tracecompass.internal.jsontrace.core.job;x-friends:="org.eclipse.tracecompass.jsontrace.core.tests", org.eclipse.tracecompass.internal.provisional.jsontrace.core.trace;x-friends:="org.eclipse.tracecompass.jsontrace.core.tests" +Import-Package: org.eclipse.tracecompass.trace_event_logger Bundle-Activator: org.eclipse.tracecompass.internal.jsontrace.core.Activator diff --git a/jsontrace/org.eclipse.tracecompass.jsontrace.core/src/org/eclipse/tracecompass/internal/jsontrace/core/job/SortingJob.java b/jsontrace/org.eclipse.tracecompass.jsontrace.core/src/org/eclipse/tracecompass/internal/jsontrace/core/job/SortingJob.java index 39433c2c2a..8c66caeae9 100644 --- a/jsontrace/org.eclipse.tracecompass.jsontrace.core/src/org/eclipse/tracecompass/internal/jsontrace/core/job/SortingJob.java +++ b/jsontrace/org.eclipse.tracecompass.jsontrace.core/src/org/eclipse/tracecompass/internal/jsontrace/core/job/SortingJob.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Ericsson + * Copyright (c) 2018, 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 @@ -33,12 +33,12 @@ import org.eclipse.jdt.annotation.NonNull; 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.internal.jsontrace.core.Activator; import org.eclipse.tracecompass.internal.jsontrace.core.Messages; import org.eclipse.tracecompass.internal.provisional.jsontrace.core.trace.JsonTrace; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; /** * On-disk sorting job. It splits a trace into tracelets. Each tracelet is @@ -269,7 +269,7 @@ protected IStatus run(IProgressMonitor monitor) { tmpParser.close(); } } catch (IOException e) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "IOException in sorting job", "trace", fPath, //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceInstant(LOGGER, Level.WARNING, "IOException in sorting job", "trace", fPath, //$NON-NLS-1$ //$NON-NLS-2$ "exception", e); //$NON-NLS-1$ return new Status(IStatus.WARNING, Activator.PLUGIN_ID, "IOException in sorting job for " + fPath, e); //$NON-NLS-1$ } finally { diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/META-INF/MANIFEST.MF b/lttng/org.eclipse.tracecompass.lttng2.ust.core/META-INF/MANIFEST.MF index d23eeabc0d..3daa41a21f 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.core/META-INF/MANIFEST.MF +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/META-INF/MANIFEST.MF @@ -44,5 +44,6 @@ Import-Package: com.google.common.annotations;version="15.0.0", com.google.common.collect, com.google.common.io, org.apache.commons.lang3, - org.apache.commons.lang3.builder + org.apache.commons.lang3.builder, + org.eclipse.tracecompass.trace_event_logger Automatic-Module-Name: org.eclipse.tracecompass.lttng2.ust.core diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/FileOffsetMapper.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/FileOffsetMapper.java index 9bfea169f2..e00312b1ba 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/FileOffsetMapper.java +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/FileOffsetMapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 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 @@ -26,10 +26,9 @@ import org.eclipse.jdt.annotation.NonNull; 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.common.core.log.TraceCompassLogUtils.ScopeLog; import org.eclipse.tracecompass.common.core.process.ProcessUtils; import org.eclipse.tracecompass.tmf.core.event.lookup.TmfCallsite; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; @@ -185,7 +184,7 @@ public String toString() { .build(new CacheLoader>() { @Override public @NonNull Iterable load(FileOffset fo) { - try (ScopeLog sl = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "FileOffsetMapper:CacheMiss", //$NON-NLS-1$ + try (ScopeLog sl = new ScopeLog(LOGGER, Level.FINER, "FileOffsetMapper:CacheMiss", //$NON-NLS-1$ "File", fo.fFilePath, //$NON-NLS-1$ "Offset", fo.fOffset, //$NON-NLS-1$ "Build id", fo.fBuildId)) { //$NON-NLS-1$ @@ -218,7 +217,7 @@ public String toString() { } private static @Nullable Iterable getAddr2lineInfo(File file, @Nullable String buildId, long offset) { - try (ScopeLog sl = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "FileOffsetMapper:Addr2lineInfo", //$NON-NLS-1$ + try (ScopeLog sl = new ScopeLog(LOGGER, Level.FINER, "FileOffsetMapper:Addr2lineInfo", //$NON-NLS-1$ "File", file, //$NON-NLS-1$ "Offset", offset, //$NON-NLS-1$ "Build id", buildId)) { //$NON-NLS-1$ diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/UstDebugInfoStateProvider.java b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/UstDebugInfoStateProvider.java index 643b42755b..b5d59dd1fb 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/UstDebugInfoStateProvider.java +++ b/lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/debuginfo/UstDebugInfoStateProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 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 @@ -29,7 +29,6 @@ import org.eclipse.jdt.annotation.Nullable; import org.eclipse.tracecompass.analysis.os.linux.core.event.aspect.LinuxPidAspect; 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.internal.lttng2.ust.core.trace.layout.LttngUst28EventLayout; import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace; @@ -45,6 +44,7 @@ import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; import org.eclipse.tracecompass.tmf.core.util.Pair; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; @@ -423,7 +423,7 @@ private void handleBinInfo(ITmfEvent event, final Integer vpid, hasBuildIdValue == null || hasDebugLinkValue == null || (statedump && isPicValue == null)) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "UstDebugInfoStateProvider:InvalidBinInfoEvent", "event", event); //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "UstDebugInfoStateProvider:InvalidBinInfoEvent", "event", event); //$NON-NLS-1$ //$NON-NLS-2$ return; } @@ -456,7 +456,7 @@ private void handleBuildId(ITmfEvent event, final Integer vpid, Long baddr = event.getContent().getFieldValue(Long.class, fLayout.fieldBaddr()); if (buildIdArray == null || baddr == null) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "UstDebugInfoStateProvider:InvalidBinIdEvent", "event", event); //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "UstDebugInfoStateProvider:InvalidBinIdEvent", "event", event); //$NON-NLS-1$ //$NON-NLS-2$ return; } @@ -487,7 +487,7 @@ private void handleDebugLink(ITmfEvent event, final Integer vpid, String debugLink = event.getContent().getFieldValue(String.class, fLayout.fieldDebugLinkFilename()); if (baddr == null || debugLink == null) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "UstDebugInfoStateProvider:InvalidDebugLinkEvent", "event", event); //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "UstDebugInfoStateProvider:InvalidDebugLinkEvent", "event", event); //$NON-NLS-1$ //$NON-NLS-2$ return; } @@ -511,7 +511,7 @@ private void handleClose(ITmfEvent event, final Integer vpid, final ITmfStateSys Long baddr = event.getContent().getFieldValue(Long.class, fLayout.fieldBaddr()); if (baddr == null) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "UstDebugInfoStateProvider:InvalidDlCloseEvent", "event", event); //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "UstDebugInfoStateProvider:InvalidDlCloseEvent", "event", event); //$NON-NLS-1$ //$NON-NLS-2$ return; } diff --git a/rcp/org.eclipse.tracecompass.rcp/feature.xml b/rcp/org.eclipse.tracecompass.rcp/feature.xml index 138b0e22cf..041b1fa5c7 100644 --- a/rcp/org.eclipse.tracecompass.rcp/feature.xml +++ b/rcp/org.eclipse.tracecompass.rcp/feature.xml @@ -441,4 +441,8 @@ id="org.apache.xmlgraphics" version="0.0.0"/> + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.20.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.20.target index ccb7525027..4e7f6a1a9b 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.20.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.20.target @@ -1,4 +1,4 @@ - + @@ -89,6 +89,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.21.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.21.target index 6396f61140..1df1437e25 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.21.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.21.target @@ -1,4 +1,4 @@ - + @@ -89,6 +89,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.22.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.22.target index b17bed9191..617156f4ae 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.22.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.22.target @@ -1,4 +1,4 @@ - + @@ -89,6 +89,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.23.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.23.target index f2eb2211e5..0056cc2a05 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.23.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.23.target @@ -1,4 +1,4 @@ - + @@ -89,6 +89,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.24.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.24.target index 61d8493bdc..306fd6644a 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.24.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.24.target @@ -1,4 +1,4 @@ - + @@ -90,6 +90,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.25.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.25.target index 10b11742f1..38cd0bb353 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.25.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.25.target @@ -1,4 +1,4 @@ - + @@ -90,6 +90,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.26.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.26.target index 126fbbe855..072170830a 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.26.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.26.target @@ -1,4 +1,4 @@ - + @@ -92,6 +92,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.27.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.27.target index 0841dd904a..fceb6b5d4d 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.27.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.27.target @@ -1,4 +1,4 @@ - + @@ -86,6 +86,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.28.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.28.target index 8d4dda68ef..6e151e3be9 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.28.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.28.target @@ -1,4 +1,4 @@ - + @@ -83,6 +83,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.29.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.29.target index fda7ac2432..78fc1cbe26 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.29.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.29.target @@ -1,4 +1,4 @@ - + @@ -86,6 +86,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.30.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.30.target index 8d4418819b..ca731a8b49 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.30.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.30.target @@ -1,4 +1,4 @@ - + @@ -87,6 +87,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.31.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.31.target index 0dca1940cb..456c7fb7f4 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.31.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.31.target @@ -1,4 +1,4 @@ - + @@ -90,6 +90,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.32.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.32.target index 38c692d956..135da343c6 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.32.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.32.target @@ -1,4 +1,4 @@ - + @@ -89,6 +89,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.33.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.33.target index da64ee1396..3733da968b 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.33.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.33.target @@ -1,4 +1,4 @@ - + @@ -89,6 +89,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.34.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.34.target index 01c80bf4fc..78ec7dfea1 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.34.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.34.target @@ -1,4 +1,4 @@ - + @@ -89,6 +89,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-e4.35.target b/releng/org.eclipse.tracecompass.target/tracecompass-e4.35.target index c2519b753c..c251b34953 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-e4.35.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-e4.35.target @@ -1,4 +1,4 @@ - + @@ -89,6 +89,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/releng/org.eclipse.tracecompass.target/tracecompass-eStaging.target b/releng/org.eclipse.tracecompass.target/tracecompass-eStaging.target index 214dddc934..8eab520798 100644 --- a/releng/org.eclipse.tracecompass.target/tracecompass-eStaging.target +++ b/releng/org.eclipse.tracecompass.target/tracecompass-eStaging.target @@ -1,4 +1,4 @@ - + @@ -89,6 +89,16 @@ + + + + org.eclipse.tracecompass + trace-event-logger + 0.1.0 + jar + + + diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/META-INF/MANIFEST.MF b/statesystem/org.eclipse.tracecompass.datastore.core/META-INF/MANIFEST.MF index 6ed3e639a5..78d9f7b4dc 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/META-INF/MANIFEST.MF +++ b/statesystem/org.eclipse.tracecompass.datastore.core/META-INF/MANIFEST.MF @@ -31,5 +31,6 @@ Export-Package: org.eclipse.tracecompass.datastore.core.encoding, Import-Package: com.google.common.annotations, com.google.common.base, com.google.common.cache, - com.google.common.collect + com.google.common.collect, + org.eclipse.tracecompass.trace_event_logger Automatic-Module-Name: org.eclipse.tracecompass.datastore.core diff --git a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/historytree/HtIo.java b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/historytree/HtIo.java index fdc6ce6b17..ad1ff8043d 100644 --- a/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/historytree/HtIo.java +++ b/statesystem/org.eclipse.tracecompass.datastore.core/src/org/eclipse/tracecompass/internal/datastore/core/historytree/HtIo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 École Polytechnique de Montréal and others + * Copyright (c) 2010, 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 @@ -26,13 +26,13 @@ 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.IHTInterval; import org.eclipse.tracecompass.datastore.core.interval.IHTIntervalReader; import org.eclipse.tracecompass.internal.datastore.core.Activator; import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.AbstractHistoryTree.IHTNodeFactory; import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.HTNode; import org.eclipse.tracecompass.internal.provisional.datastore.core.historytree.IHistoryTree; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; import com.google.common.annotations.VisibleForTesting; import com.google.common.cache.CacheBuilder; @@ -105,7 +105,7 @@ public HTNode 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); @@ -239,7 +239,7 @@ public HtIo(File stateHistoryFile, @SuppressWarnings("unchecked") public N 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((HtIo>) this, seqNumber); try { return (N) checkNotNull(NODE_CACHE.get(key)); diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/META-INF/MANIFEST.MF b/statesystem/org.eclipse.tracecompass.statesystem.core/META-INF/MANIFEST.MF index f9abd8da9e..3f854a3320 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/META-INF/MANIFEST.MF +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/META-INF/MANIFEST.MF @@ -32,5 +32,6 @@ Import-Package: com.google.common.annotations;version="15.0.0", com.google.gson, com.google.gson.annotations, com.google.gson.stream, - org.apache.commons.lang3.builder + org.apache.commons.lang3.builder, + org.eclipse.tracecompass.trace_event_logger Automatic-Module-Name: org.eclipse.tracecompass.statesystem.core diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java index 950592017b..1bfbc12cd5 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2017 Ericsson and others + * Copyright (c) 2012, 2025 Ericsson 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 @@ -32,8 +32,6 @@ import org.eclipse.jdt.annotation.NonNull; 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.common.core.log.TraceCompassLogUtils.ScopeLog; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.IntegerRangeCondition; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder; @@ -46,6 +44,7 @@ import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue; import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue.Type; import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import com.google.common.collect.ImmutableCollection.Builder; import com.google.common.collect.ImmutableSet; @@ -596,7 +595,7 @@ public ITmfStateInterval querySingleState(long t, int attributeQuark) if (isDisposed) { throw new StateSystemDisposedException(); } - try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "StateSystem:SingleQuery", //$NON-NLS-1$ + try (ScopeLog log = new ScopeLog(LOGGER, Level.FINER, "StateSystem:SingleQuery", //$NON-NLS-1$ "ssid", this.getSSID(), //$NON-NLS-1$ "ts", t, //$NON-NLS-1$ "attribute", attributeQuark)) { //$NON-NLS-1$ diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/TransientState.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/TransientState.java index f543e600b3..7b406698c0 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/TransientState.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/TransientState.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2016 Ericsson + * Copyright (c) 2012, 2025 Ericsson * Copyright (c) 2010, 2011 École Polytechnique de Montréal * Copyright (c) 2010, 2011 Alexandre Montplaisir * @@ -30,13 +30,13 @@ import org.eclipse.jdt.annotation.NonNullByDefault; 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.internal.provisional.datastore.core.condition.TimeRangeCondition; import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend; import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException; import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException; import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; import org.eclipse.tracecompass.statesystem.core.interval.TmfStateInterval; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; /** * The Transient State is used to build intervals from punctual state changes. @@ -401,7 +401,7 @@ public void doQuery(List<@Nullable ITmfStateInterval> stateInfo, long t) { */ public Iterable query2D(Collection quarks, TimeRangeCondition timeCondition) { fRWLock.readLock().lock(); - try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINEST, "TransientState:query2D", //$NON-NLS-1$ + try (ScopeLog log = new ScopeLog(LOGGER, Level.FINEST, "TransientState:query2D", //$NON-NLS-1$ "ssid", fBackend.getSSID(), //$NON-NLS-1$ "quarks", quarks, //$NON-NLS-1$ "time", timeCondition)) { //$NON-NLS-1$ diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/InMemoryBackend.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/InMemoryBackend.java index 813aab1694..40c2ac9f0f 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/InMemoryBackend.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/InMemoryBackend.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2016 Ericsson + * Copyright (c) 2013, 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 @@ -28,13 +28,14 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.IntegerRangeCondition; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition; import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend; import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException; import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; import org.eclipse.tracecompass.statesystem.core.interval.TmfStateInterval; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; + import com.google.common.collect.Iterables; /** @@ -214,7 +215,7 @@ public void dispose() { @Override public Iterable<@NonNull ITmfStateInterval> query2D(IntegerRangeCondition quarks, TimeRangeCondition times) throws TimeRangeException { - try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "InMemoryBackend:query2D", //$NON-NLS-1$ + try (ScopeLog log = new ScopeLog(LOGGER, Level.FINER, "InMemoryBackend:query2D", //$NON-NLS-1$ "ssid", getSSID(), //$NON-NLS-1$ "quarks", quarks, //$NON-NLS-1$ "times", times)) { //$NON-NLS-1$ diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HTNode.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HTNode.java index 548deba976..69a0549361 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HTNode.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HTNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2019 Ericsson, École Polytechnique de Montréal, and others + * Copyright (c) 2010, 2025 Ericsson, É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 @@ -31,13 +31,12 @@ import org.eclipse.jdt.annotation.NonNull; 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.provisional.datastore.core.condition.IntegerRangeCondition; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition; import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.IHistoryTree.IHTNodeFactory; import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException; import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; /** * The base class for all the types of nodes that go in the History Tree. @@ -472,7 +471,7 @@ public void writeInfoFromNode(List stateInfo, long t) */ public HTInterval getRelevantInterval(int key, long t) throws TimeRangeException { fRwl.readLock().lock(); - try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINEST, "HTNode:singleQuery", //$NON-NLS-1$ + try (ScopeLog log = new ScopeLog(LOGGER, Level.FINEST, "HTNode:singleQuery", //$NON-NLS-1$ "time", t, //$NON-NLS-1$ "attribute", key)) { //$NON-NLS-1$ for (int i = getStartIndexFor(t); i < fIntervals.size(); i++) { @@ -503,7 +502,7 @@ public HTInterval getRelevantInterval(int key, long t) throws TimeRangeException */ public Iterable<@NonNull HTInterval> iterable2D(IntegerRangeCondition quarks, TimeRangeCondition times) { fRwl.readLock().lock(); - try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINEST, "HTNode:query2D", //$NON-NLS-1$ + try (ScopeLog log = new ScopeLog(LOGGER, Level.FINEST, "HTNode:query2D", //$NON-NLS-1$ "quarks", quarks, //$NON-NLS-1$ "times", times)) { //$NON-NLS-1$ List<@NonNull HTInterval> intervals = new ArrayList<>(); diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java index 5b4690ddd7..a32b656938 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HT_IO.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2018 Ericsson + * Copyright (c) 2012, 2025 Ericsson * Copyright (c) 2010, 2011 École Polytechnique de Montréal * Copyright (c) 2010, 2011 Alexandre Montplaisir * @@ -32,9 +32,9 @@ import org.eclipse.jdt.annotation.NonNull; 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.internal.statesystem.core.Activator; import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.IHistoryTree.IHTNodeFactory; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; @@ -99,7 +99,7 @@ public HTNode load(CacheKey key) throws IOException { HT_IO io = key.fStateHistory; int seqNb = key.fSeqNumber; - TraceCompassLogUtils.traceInstant(LOGGER, Level.FINEST, "Ht_Io:CacheMiss", "seqNum", seqNb); //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceInstant(LOGGER, Level.FINEST, "Ht_Io:CacheMiss", "seqNum", seqNb); //$NON-NLS-1$ //$NON-NLS-2$ HTConfig config = io.fConfig; /* Allocate buffer */ @@ -201,7 +201,7 @@ public HT_IO(HTConfig config, boolean newFile, IHTNodeFactory nodeFactory) throw */ public @NonNull HTNode 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, "Ht_Io:CacheLookup", "seqNum", seqNumber); //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceInstant(LOGGER, Level.FINEST, "Ht_Io:CacheLookup", "seqNum", seqNumber); //$NON-NLS-1$ //$NON-NLS-2$ CacheKey key = new CacheKey(this, seqNumber); try { return Objects.requireNonNull(NODE_CACHE.get(key)); diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HistoryTreeBackend.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HistoryTreeBackend.java index dec91067d2..6b85788f00 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HistoryTreeBackend.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HistoryTreeBackend.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2016 Ericsson + * Copyright (c) 2012, 2025 Ericsson * Copyright (c) 2010, 2011 École Polytechnique de Montréal * Copyright (c) 2010, 2011 Alexandre Montplaisir * @@ -24,14 +24,12 @@ import java.util.ArrayDeque; import java.util.Deque; import java.util.List; +import java.util.Objects; import java.util.logging.Level; import java.util.logging.Logger; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.IntegerRangeCondition; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition; import org.eclipse.tracecompass.internal.statesystem.core.Activator; @@ -39,6 +37,9 @@ import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException; import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; import com.google.common.annotations.VisibleForTesting; @@ -174,7 +175,7 @@ public HistoryTreeBackend(@NonNull String ssid, @NonNull File existingStateFile, */ @VisibleForTesting protected @NonNull IHistoryTree initializeSHT(@NonNull HTConfig conf) throws IOException { - TraceCompassLogUtils.traceObjectCreation(LOGGER, Level.FINER, this); + LogUtils.traceObjectCreation(LOGGER, Level.FINER, this); return HistoryTreeFactory.createHistoryTree(conf); } @@ -262,8 +263,8 @@ public void removeFiles() { @Override public void dispose() { if (fFinishedBuilding) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, "HistoryTreeBackend:ClosingFile", "size", getSHT().getFileSize()); //$NON-NLS-1$ //$NON-NLS-2$ - TraceCompassLogUtils.traceObjectDestruction(LOGGER, Level.FINER, this); + LogUtils.traceInstant(LOGGER, Level.FINE, "HistoryTreeBackend:ClosingFile", "size", getSHT().getFileSize()); //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceObjectDestruction(LOGGER, Level.FINER, this); getSHT().closeFile(); } else { /* @@ -361,7 +362,7 @@ private HTInterval getRelevantInterval(long t, int key) "ssid", getSSID(), //$NON-NLS-1$ "quarks", quarks, //$NON-NLS-1$ "timeCondition", times).build()) { //$NON-NLS-1$ - return () -> new HistoryTreeBackendIterator(getSHT(), quarks, times, reverse, log); + return () -> new HistoryTreeBackendIterator(getSHT(), quarks, times, reverse, Objects.requireNonNull(log)); } } diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HistoryTreeBackendIterator.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HistoryTreeBackendIterator.java index 571c9d643b..02156af32e 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HistoryTreeBackendIterator.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HistoryTreeBackendIterator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2016, 2022 Ericsson + * Copyright (c) 2012, 2016, 2025 Ericsson * Copyright (c) 2010, 2011 École Polytechnique de Montréal * Copyright (c) 2010, 2011 Alexandre Montplaisir * @@ -28,11 +28,11 @@ import org.eclipse.jdt.annotation.NonNull; 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.provisional.datastore.core.condition.IntegerRangeCondition; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition; import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; class HistoryTreeBackendIterator implements Iterator<@NonNull ITmfStateInterval> { private static final @NonNull Logger LOGGER = TraceCompassLog.getLogger(HistoryTreeBackendIterator.class); diff --git a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/ThreadedHistoryTreeBackend.java b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/ThreadedHistoryTreeBackend.java index 92fbf2cc51..a2e725e28b 100644 --- a/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/ThreadedHistoryTreeBackend.java +++ b/statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/ThreadedHistoryTreeBackend.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2016 Ericsson + * Copyright (c) 2012, 2025 Ericsson * Copyright (c) 2010, 2011 École Polytechnique de Montréal * Copyright (c) 2010, 2011 Alexandre Montplaisir * @@ -25,7 +25,6 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.tracecompass.common.core.collect.BufferedBlockingQueue; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.IntegerRangeCondition; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition; import org.eclipse.tracecompass.internal.statesystem.core.Activator; @@ -33,6 +32,7 @@ import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException; import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import com.google.common.collect.Iterables; @@ -297,7 +297,7 @@ public ITmfStateInterval doSingularQuery(long t, int attributeQuark) @Override public Iterable<@NonNull ITmfStateInterval> query2D(IntegerRangeCondition quarks, TimeRangeCondition times, boolean reverse) throws TimeRangeException { - try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINEST, "ThreadedHistoryTreeBackend:query2D", //$NON-NLS-1$ + try (ScopeLog log = new ScopeLog(LOGGER, Level.FINEST, "ThreadedHistoryTreeBackend:query2D", //$NON-NLS-1$ "ssid", getSSID(), //$NON-NLS-1$ "quarks", quarks, //$NON-NLS-1$ "timeCondition", times)) { //$NON-NLS-1$ diff --git a/tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF b/tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF index 3a66c24d8f..6f9f90c77d 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF +++ b/tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF @@ -145,5 +145,6 @@ Import-Package: com.google.common.annotations, org.antlr.runtime, org.antlr.runtime.tree, org.apache.commons.io, - org.apache.commons.lang3 + org.apache.commons.lang3, + org.eclipse.tracecompass.trace_event_logger Automatic-Module-Name: org.eclipse.tracecompass.tmf.core diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/request/TmfRequestExecutor.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/request/TmfRequestExecutor.java index f0fecd7900..8ceec8f39f 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/request/TmfRequestExecutor.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/request/TmfRequestExecutor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2014 Ericsson + * Copyright (c) 2009, 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 @@ -30,12 +30,12 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder; import org.eclipse.tracecompass.internal.tmf.core.TmfCoreTracer; import org.eclipse.tracecompass.internal.tmf.core.component.TmfEventThread; import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; /** * The request scheduler works with 5 slots with a specific time. It has 4 slots @@ -138,7 +138,7 @@ public synchronized void execute(final Runnable command) { // We are expecting MyEventThread:s if (!(command instanceof TmfEventThread)) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "RequestExecutor:NotATmfEventThread", "cmd", command.toString()); //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceInstant(LOGGER, Level.WARNING, "RequestExecutor:NotATmfEventThread", "cmd", command.toString()); //$NON-NLS-1$ //$NON-NLS-2$ return; } diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/backends/partial/PartialInMemoryBackend.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/backends/partial/PartialInMemoryBackend.java index 55b6b9efb8..70e104bd24 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/backends/partial/PartialInMemoryBackend.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/backends/partial/PartialInMemoryBackend.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 École Polytechnique de Montréal + * 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 @@ -23,13 +23,14 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.IntegerRangeCondition; import org.eclipse.tracecompass.internal.provisional.datastore.core.condition.TimeRangeCondition; import org.eclipse.tracecompass.statesystem.core.backend.IPartialStateHistoryBackend; import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException; import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; import org.eclipse.tracecompass.statesystem.core.interval.TmfStateInterval; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; + import com.google.common.collect.Iterables; /** @@ -222,7 +223,7 @@ public void dispose() { @Override public Iterable<@NonNull ITmfStateInterval> query2D(IntegerRangeCondition quarks, TimeRangeCondition times) throws TimeRangeException { - try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "InMemoryBackend:query2D", //$NON-NLS-1$ + try (ScopeLog log = new ScopeLog(LOGGER, Level.FINER, "InMemoryBackend:query2D", //$NON-NLS-1$ "ssid", getSSID(), //$NON-NLS-1$ "quarks", quarks, //$NON-NLS-1$ "times", times)) { //$NON-NLS-1$ diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAbstractAnalysisModule.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAbstractAnalysisModule.java index aaae52efb2..7eaa802ec1 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAbstractAnalysisModule.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/analysis/TmfAbstractAnalysisModule.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2014 École Polytechnique de Montréal + * Copyright (c) 2013, 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 @@ -40,8 +40,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.FlowScopeLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder; import org.eclipse.tracecompass.internal.tmf.core.Activator; import org.eclipse.tracecompass.internal.tmf.core.TmfCoreTracer; import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement; @@ -54,6 +52,8 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; /** * Base class that analysis modules main class may extend. It provides default @@ -338,7 +338,7 @@ public int getDependencyLevel() { } private void execute(final ITmfTrace trace) { - try (FlowScopeLog analysisLog = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TmfAbstractAnalysis:scheduling", "name", getName()).setCategory(getId()).build()) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + try (FlowScopeLog analysisLog = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TmfAbstractAnalysis:scheduling", "name", getName()).setCategory(getId()).build()) { //$NON-NLS-1$ //$NON-NLS-2$ /* * TODO: The analysis in a job should be done at the analysis * manager level instead of depending on this abstract class diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/MultiAspect.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/MultiAspect.java index b13b904e50..5d26589df2 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/MultiAspect.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/MultiAspect.java @@ -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 @@ -22,9 +22,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.tmf.core.dataprovider.DataType; import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; import com.google.common.collect.Iterables; @@ -79,14 +79,14 @@ public class MultiAspect implements ITmfEventAspect { if (names.size() != 1) { StringJoiner sj = new StringJoiner(", "); //$NON-NLS-1$ names.forEach(sj::add); - TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "Aspects do not have the same name: ", sj.toString()); //$NON-NLS-1$ ); + LogUtils.traceInstant(LOGGER, Level.WARNING, "Aspects do not have the same name: ", sj.toString()); //$NON-NLS-1$ ); } // Ensure all aspects have the same data type if (dataTypes.size() != 1) { StringJoiner sj = new StringJoiner(", "); //$NON-NLS-1$ dataTypes.forEach(dt -> sj.add(dt.toString())); - TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "Aspects do not have the same data type: ", sj.toString()); //$NON-NLS-1$ + LogUtils.traceInstant(LOGGER, Level.WARNING, "Aspects do not have the same data type: ", sj.toString()); //$NON-NLS-1$ } return new MultiAspect<>(Iterables.get(names, 0), aspects); diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/timegraph/AbstractTimeGraphDataProvider.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/timegraph/AbstractTimeGraphDataProvider.java index 93f579ff98..b7e7d77f51 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/timegraph/AbstractTimeGraphDataProvider.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/timegraph/AbstractTimeGraphDataProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2019 Ericsson + * Copyright (c) 2018, 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 @@ -19,8 +19,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException; @@ -32,6 +30,8 @@ import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse; import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/AbstractTreeDataProvider.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/AbstractTreeDataProvider.java index 301c86ad01..bf32c56863 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/AbstractTreeDataProvider.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/tree/AbstractTreeDataProvider.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2017, 2020 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 @@ -25,8 +25,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.annotation.Nullable; 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.statesystem.core.ITmfStateSystem; import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; import org.eclipse.tracecompass.tmf.core.model.AbstractStateSystemAnalysisDataProvider; @@ -38,6 +36,8 @@ import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse; import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; import com.google.common.collect.BiMap; import com.google.common.collect.HashBasedTable; diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/xy/AbstractTreeCommonXDataProvider.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/xy/AbstractTreeCommonXDataProvider.java index 6a09b31913..c13db9e6bf 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/xy/AbstractTreeCommonXDataProvider.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/xy/AbstractTreeCommonXDataProvider.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2017 Ericsson + * Copyright (c) 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 @@ -18,8 +18,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder; import org.eclipse.tracecompass.internal.tmf.core.model.TmfXyResponseFactory; import org.eclipse.tracecompass.internal.tmf.core.model.filters.FetchParametersUtils; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; @@ -32,6 +30,8 @@ import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse; import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; import com.google.common.collect.ImmutableList; diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/AbstractTmfStateProvider.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/AbstractTmfStateProvider.java index 13828419fa..fa67e9fc66 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/AbstractTmfStateProvider.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/AbstractTmfStateProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2015 Ericsson + * Copyright (c) 2012, 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 @@ -15,6 +15,7 @@ package org.eclipse.tracecompass.tmf.core.statesystem; import java.util.Comparator; +import java.util.Objects; import java.util.PriorityQueue; import java.util.Queue; import java.util.logging.Level; @@ -25,8 +26,6 @@ import org.eclipse.jdt.annotation.Nullable; import org.eclipse.tracecompass.common.core.collect.BufferedBlockingQueue; 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.tmf.core.Activator; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder; @@ -34,6 +33,8 @@ import org.eclipse.tracecompass.tmf.core.event.TmfEvent; import org.eclipse.tracecompass.tmf.core.trace.ITmfContext; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; import com.google.common.annotations.VisibleForTesting; @@ -144,7 +145,7 @@ protected AbstractTmfStateProvider(ITmfTrace trace, String id, int queueSize, in // yet // started fSafeTime = trace.getStartTime().toNanos() - 1; - fEventHandlerThread = new Thread(() -> SafeRunner.run(new EventProcessor(log)), id + " Event Handler"); //$NON-NLS-1$ + fEventHandlerThread = new Thread(() -> SafeRunner.run(new EventProcessor(Objects.requireNonNull(log))), id + " Event Handler"); //$NON-NLS-1$ } } diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfStateSystemAnalysisModule.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfStateSystemAnalysisModule.java index f1684bdf4f..8b264f64c1 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfStateSystemAnalysisModule.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfStateSystemAnalysisModule.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2015 École Polytechnique de Montréal + * Copyright (c) 2013, 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 @@ -35,7 +35,6 @@ import org.eclipse.jdt.annotation.Nullable; import org.eclipse.tracecompass.common.core.NonNullUtils; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.ScopeLog; import org.eclipse.tracecompass.internal.tmf.core.Activator; import org.eclipse.tracecompass.internal.tmf.core.statesystem.backends.partial.PartialHistoryBackend; import org.eclipse.tracecompass.internal.tmf.core.statesystem.backends.partial.PartialInMemoryBackend; @@ -63,6 +62,7 @@ import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableMap; diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statistics/TmfStateStatistics.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statistics/TmfStateStatistics.java index c83c18cdf0..d0cafbcd97 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statistics/TmfStateStatistics.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statistics/TmfStateStatistics.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2018 Ericsson + * Copyright (c) 2012, 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 @@ -27,11 +27,11 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; 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.statesystem.core.ITmfStateSystem; import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; import com.google.common.collect.Lists; diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/SymbolProviderUtils.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/SymbolProviderUtils.java index 09859a6277..4b16179d0e 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/SymbolProviderUtils.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/symbols/SymbolProviderUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 École Polytechnique de Montréal + * Copyright (c) 2017, 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 @@ -18,7 +18,7 @@ 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.trace_event_logger.LogUtils; /** * Utility class to resolve symbols from providers @@ -75,7 +75,7 @@ private static String getSymbolText(Collection providers, Funct for (ISymbolProvider provider : providers) { TmfResolvedSymbol currentSymbol = func.apply(provider); if (currentSymbol != null) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.FINER, "Symbol found", "address", address, "provider", provider, "found symbol", currentSymbol); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ + LogUtils.traceInstant(LOGGER, Level.FINER, "Symbol found", "address", address, "provider", provider, "found symbol", currentSymbol); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ if (resolvedSymbol == null) { resolvedSymbol = currentSymbol; } else { @@ -84,7 +84,7 @@ private static String getSymbolText(Collection providers, Funct } } String symbolText = resolvedSymbol != null ? resolvedSymbol.getSymbolName() : "0x" + Long.toHexString(address);//$NON-NLS-1$ - TraceCompassLogUtils.traceInstant(LOGGER, Level.FINER, "Symbol returned", "address", address, "symbolText", symbolText); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + LogUtils.traceInstant(LOGGER, Level.FINER, "Symbol returned", "address", address, "symbolText", symbolText); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ return symbolText; } diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTraceManager.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTraceManager.java index 52db3d45e7..a47169b9e0 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTraceManager.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTraceManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2019 Ericsson and others + * Copyright (c) 2013, 2025 Ericsson 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 @@ -47,7 +47,6 @@ import org.eclipse.jdt.annotation.Nullable; 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.internal.tmf.core.Activator; import org.eclipse.tracecompass.tmf.core.TmfCommonConstants; import org.eclipse.tracecompass.tmf.core.signal.TmfEventFilterAppliedSignal; @@ -62,6 +61,7 @@ import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp; import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange; import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; import com.google.common.collect.HashMultiset; import com.google.common.collect.ImmutableSet; @@ -380,7 +380,7 @@ public static void deleteSupplementaryFiles(ITmfTrace trace) { String supplementaryFileDir = TmfTraceManager.getSupplementaryFileDir(trace); FileUtils.cleanDirectory(new File(supplementaryFileDir)); // Needed to audit for privacy concerns - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "deleteSupplementaryFiles", supplementaryFileDir); //$NON-NLS-1$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "deleteSupplementaryFiles", supplementaryFileDir); //$NON-NLS-1$ } catch (IOException e) { Activator.logError("Error deleting supplementary files for trace " + trace.getName(), e); //$NON-NLS-1$ } @@ -402,7 +402,7 @@ public static void deleteSupplementaryFolder(ITmfTrace trace) { String temporaryDirPath = getTemporaryDirPath(); deleteFolder(parent, temporaryDirPath); // Needed to audit for privacy concerns - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "deleteSupplementaryFolder", temporaryDirPath); //$NON-NLS-1$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "deleteSupplementaryFolder", temporaryDirPath); //$NON-NLS-1$ } catch (IOException e) { Activator.logError("Error deleting supplementary folder for trace " + trace.getName(), e); //$NON-NLS-1$ } diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java index 1f2829899e..946c970719 100644 --- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java +++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2016 Ericsson + * Copyright (c) 2012, 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 @@ -25,7 +25,6 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; import org.eclipse.tracecompass.internal.tmf.core.Activator; import org.eclipse.tracecompass.internal.tmf.core.Messages; import org.eclipse.tracecompass.internal.tmf.core.TmfCoreTracer; @@ -43,6 +42,7 @@ import org.eclipse.tracecompass.tmf.core.trace.ITmfTraceKnownSize; import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer; import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; /** * A simple indexer that manages the trace index as an array of trace @@ -388,7 +388,7 @@ protected IStatus run(final IProgressMonitor monitor) { setName(Messages.TmfCheckpointIndexer_Indexing + ' ' + fTrace.getName() + " (" + String.format("%,d", nbEvents) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // setName doesn't refresh the UI, setTaskName does long rate = (nbEvents - prevNbEvents) * 4; - TraceCompassLogUtils.traceCounter(LOGGER, Level.FINE, fTrace.getName(), "indexed", nbEvents - prevNbEvents); //$NON-NLS-1$ + LogUtils.traceCounter(LOGGER, Level.FINE, fTrace.getName(), "indexed", nbEvents - prevNbEvents); //$NON-NLS-1$ subMonitor.setTaskName(String.format("%,d", rate) + " " + Messages.TmfCheckpointIndexer_EventsPerSecond); //$NON-NLS-1$ //$NON-NLS-2$ } catch (final InterruptedException e) { return Status.OK_STATUS; diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF index 5d1fa6d9d1..67e6c818a9 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF +++ b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF @@ -150,5 +150,6 @@ Import-Package: com.google.common.annotations, org.apache.commons.compress.compressors.gzip, org.apache.commons.io, org.eclipse.emf.common.util, - org.eclipse.emf.ecore + org.eclipse.emf.ecore, + org.eclipse.tracecompass.trace_event_logger Automatic-Module-Name: org.eclipse.tracecompass.tmf.ui diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java index e2347aef6a..55857f6f46 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2018 Ericsson, École Polytechnique de Montréal + * Copyright (c) 2010, 2025 Ericsson, É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 @@ -49,7 +49,6 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.swt.graphics.Image; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; import org.eclipse.tracecompass.internal.tmf.ui.Activator; import org.eclipse.tracecompass.internal.tmf.ui.editors.ITmfEventsEditorConstants; import org.eclipse.tracecompass.tmf.core.TmfCommonConstants; @@ -58,6 +57,7 @@ import org.eclipse.tracecompass.tmf.core.project.model.TmfTraceType.TraceElementType; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; import org.eclipse.ui.IEditorReference; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; @@ -718,7 +718,7 @@ public void deleteSupplementaryResources(IResource[] resources) { try { resources[i].delete(true, new NullProgressMonitor()); // Needed to audit for privacy concerns - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "deleteSupplementaryResources", resources[i].getFullPath().toOSString() ); //$NON-NLS-1$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "deleteSupplementaryResources", resources[i].getFullPath().toOSString() ); //$NON-NLS-1$ } catch (CoreException e) { Activator.getDefault().logError("Error deleting supplementary resource " + resources[i], e); //$NON-NLS-1$ } diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java index cdc825ad9e..02913daafe 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2013, 2019 Ericsson, École Polytechnique de Montréal + * Copyright (c) 2013, 2025 Ericsson, É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 @@ -49,9 +49,6 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; 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.common.core.log.TraceCompassLogUtils.ScopeLog; import org.eclipse.tracecompass.internal.tmf.ui.Activator; import org.eclipse.tracecompass.internal.tmf.ui.project.model.TmfImportHelper; import org.eclipse.tracecompass.tmf.core.TmfCommonConstants; @@ -64,6 +61,9 @@ import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment; import org.eclipse.tracecompass.tmf.ui.editors.TmfEditorInput; import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorReference; diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/UpdateTraceBoundsJob.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/UpdateTraceBoundsJob.java index a58eafc5d1..063a087ccf 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/UpdateTraceBoundsJob.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/UpdateTraceBoundsJob.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 Ericsson and others + * Copyright (c) 2017, 2025 Ericsson 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 @@ -34,12 +34,12 @@ import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; import org.eclipse.tracecompass.internal.tmf.ui.Activator; import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException; import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp; import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; /** * Update traces bounds, by using supplementary files if they exist or by @@ -163,7 +163,7 @@ private static void extractBoundsFromTrace(TmfTraceElement traceElement) { */ traceElement.setStartTime(TmfTimestamp.BIG_BANG); traceElement.setEndTime(TmfTimestamp.BIG_BANG); - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "Failed to read time bounds", "trace", traceElement.getName()); //$NON-NLS-1$ //$NON-NLS-2$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "Failed to read time bounds", "trace", traceElement.getName()); //$NON-NLS-1$ //$NON-NLS-2$ } finally { /* * Leave the trace at the same initialization status as @@ -210,9 +210,9 @@ private static void tryWriteBoundsFile(IProgressMonitor monitor, TmfTraceElement */ newChild.subTask(""); //$NON-NLS-1$ } catch (IOException e) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "Failed to write time bounds to supplementary file", "trace", traceElement.getName(), "supplementary file", folder.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "Failed to write time bounds to supplementary file", "trace", traceElement.getName(), "supplementary file", folder.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } catch (CoreException e) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "Failed to refresh supplementary file", "trace", traceElement.getName(), "supplementary file", folder.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "Failed to refresh supplementary file", "trace", traceElement.getName(), "supplementary file", folder.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } @@ -253,7 +253,7 @@ private static void tryReadBoundsFile(TmfTraceElement traceElement, File boundsF } traceElement.refreshViewer(); } catch (IOException e) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.CONFIG, "Failed to read time bounds", "trace", traceElement.getName(), "bounds file", boundsFile.getAbsoluteFile()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + LogUtils.traceInstant(LOGGER, Level.CONFIG, "Failed to read time bounds", "trace", traceElement.getName(), "bounds file", boundsFile.getAbsoluteFile()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ if (!boundsFile.delete()) { Activator.getDefault().logError("Failed to delete " + boundsFile); //$NON-NLS-1$ } diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer2.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer2.java index bcab434038..8cbe0cf217 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer2.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer2.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2020 Ericsson, Draeger Auriga + * Copyright (c) 2017, 2025 Ericsson, Draeger Auriga * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License 2.0 which @@ -19,6 +19,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; @@ -48,8 +49,6 @@ import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeColumn; 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.tmf.core.model.filters.FetchParametersUtils; import org.eclipse.tracecompass.internal.tmf.ui.Activator; import org.eclipse.tracecompass.tmf.core.dataprovider.DataProviderManager; @@ -73,6 +72,8 @@ import org.eclipse.tracecompass.tmf.ui.viewers.ILegendImageProvider2; import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs.MultiTreePatternFilter; import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs.TriStateFilteredCheckboxTree; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; @@ -323,7 +324,7 @@ protected void contentChanged(ITmfTreeViewerEntry rootEntry) { } else { fCheckboxTree.setFilterText(""); //$NON-NLS-1$ } - refreshTree(refreshTree); + refreshTree(Objects.requireNonNull(refreshTree)); } } @@ -342,7 +343,7 @@ private void refreshTree(@NonNull FlowScopeLog parent) { protected void setCheckedElements(Object[] checkedElements) { try (FlowScopeLog checkedElementsFlow = new FlowScopeLogBuilder(LOGGER, Level.FINE, getClass().getSimpleName() + "#setCheckedElements()").setCategory("setChecked").build()) { //$NON-NLS-1$ //$NON-NLS-2$ internalSetCheckedElements(checkedElements); - refreshTree(checkedElementsFlow); + refreshTree(Objects.requireNonNull(checkedElementsFlow)); } } diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java index f2c2669728..27855551b8 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractTmfTreeViewer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2020 É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 @@ -57,7 +57,6 @@ import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.ScopeLog; import org.eclipse.tracecompass.internal.tmf.ui.viewers.tree.TreeUtil; import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel; import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler; @@ -65,6 +64,7 @@ import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; import org.eclipse.tracecompass.tmf.ui.viewers.TmfTimeViewer; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; /** * Abstract class for viewers who will display data using a TreeViewer. It diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xychart/linechart/TmfCommonXAxisChartViewer.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xychart/linechart/TmfCommonXAxisChartViewer.java index 2661d00707..fd763bc87a 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xychart/linechart/TmfCommonXAxisChartViewer.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/xychart/linechart/TmfCommonXAxisChartViewer.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2017, 2020 Ericsson, Draeger, Auriga and others + * Copyright (c) 2017, 2025 Ericsson, Draeger, Auriga 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 @@ -49,9 +49,6 @@ import org.eclipse.swtchart.Range; import org.eclipse.swtchart.model.DoubleArraySeriesModel; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder; import org.eclipse.tracecompass.internal.provisional.tmf.core.model.filters.TmfFilterAppliedSignal; import org.eclipse.tracecompass.internal.provisional.tmf.core.model.filters.TraceCompassFilter; import org.eclipse.tracecompass.internal.provisional.tmf.ui.viewers.xychart.BaseXYPresentationProvider; @@ -82,6 +79,9 @@ import org.eclipse.tracecompass.tmf.ui.viewers.xychart.AxisRange; import org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfChartTimeStampFormat; import org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; +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.ImmutableMap; @@ -299,7 +299,7 @@ protected void updateContent() { return; } try (FlowScopeLog scope = new FlowScopeLogBuilder(LOGGER, Level.FINE, "CommonXLineChart:CreatingUpdateThread").setParentScope(parentScope).build()) { //$NON-NLS-1$ - newUpdateThread(trace, scope); + newUpdateThread(trace, Objects.requireNonNull(scope)); } }); } @@ -338,7 +338,7 @@ public void run() { dataProvider = initializeDataProvider(fTrace); } if (dataProvider == null) { - TraceCompassLogUtils.traceInstant(LOGGER, Level.WARNING, "Data provider for this viewer is not available"); //$NON-NLS-1$ + LogUtils.traceInstant(LOGGER, Level.WARNING, "Data provider for this viewer is not available"); //$NON-NLS-1$ return; } try { @@ -362,7 +362,7 @@ public void run() { } public void cancel() { - TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, "CommonXLineChart:UpdateThreadCanceled"); //$NON-NLS-1$ + LogUtils.traceInstant(LOGGER, Level.FINE, "CommonXLineChart:UpdateThreadCanceled"); //$NON-NLS-1$ fMonitor.setCanceled(true); } @@ -395,7 +395,7 @@ private void updateData(@NonNull ITmfXYDataProvider dataProvider, @NonNull Map ent private void doZoom(final ITmfStateSystem ss, final List links, final List markers, long resolution, final @NonNull IProgressMonitor monitor, final long start, final long end, Sampling sampling, Iterable<@NonNull TimeGraphEntry> entries, @NonNull Map<@NonNull Integer, @NonNull Predicate<@NonNull Multimap<@NonNull String, @NonNull Object>>> predicates, Map> gaps) { queryFullStates(ss, start, end, resolution, monitor, (@NonNull List> fullStates, @Nullable List prevFullState) -> { - try (TraceCompassLogUtils.ScopeLog scope = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStates");) { //$NON-NLS-1$ + try (ScopeLog scope = new ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStates");) { //$NON-NLS-1$ for (TimeGraphEntry entry : entries) { if (!sampling.equals(entry.getSampling())) { @@ -215,11 +216,11 @@ private void doZoom(final ITmfStateSystem ss, final List links, fina } } /* Refresh the arrows when zooming */ - try (TraceCompassLogUtils.ScopeLog linksLogger1 = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingLinks")) { //$NON-NLS-1$ + try (ScopeLog linksLogger1 = new ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingLinks")) { //$NON-NLS-1$ links.addAll(getLinkList(ss, fullStates, prevFullState, monitor)); } /* Refresh the view-specific markers when zooming */ - try (TraceCompassLogUtils.ScopeLog linksLogger2 = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingMarkers")) { //$NON-NLS-1$ + try (ScopeLog linksLogger2 = new ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingMarkers")) { //$NON-NLS-1$ markers.addAll(getViewMarkerList(ss, fullStates, prevFullState, monitor)); } refresh(); @@ -263,7 +264,7 @@ private void zoom(@NonNull TimeGraphEntry entry, ITmfStateSystem ss, @NonNull Li private void doBgSearch(ITmfStateSystem ss, int resolution, @NonNull IProgressMonitor monitor, Map> gaps, @NonNull Map<@NonNull Integer, @NonNull Predicate<@NonNull Multimap<@NonNull String, @NonNull Object>>> predicates) { - try (TraceCompassLogUtils.ScopeLog poc = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINE, "TimegraphBgSearch")) { //$NON-NLS-1$ + try (ScopeLog poc = new ScopeLog(LOGGER, Level.FINE, "TimegraphBgSearch")) { //$NON-NLS-1$ ViewFilterDialog timeEventFilterDialog = getViewFilterDialog(); boolean hasActiveSavedFilters = timeEventFilterDialog.hasActiveSavedFilters(); diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java index e72c24eaa5..6e916f405b 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2021 Ericsson, École Polytechnique de Montréal and others + * Copyright (c) 2012, 2025 Ericsson, É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 @@ -100,9 +100,6 @@ import org.eclipse.swt.widgets.TreeColumn; 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.FlowScopeLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils.FlowScopeLogBuilder; import org.eclipse.tracecompass.internal.provisional.tmf.core.model.filter.parser.FilterCu; import org.eclipse.tracecompass.internal.provisional.tmf.core.model.filter.parser.IFilterStrings; import org.eclipse.tracecompass.internal.provisional.tmf.core.model.filters.TmfFilterAppliedSignal; @@ -179,6 +176,10 @@ import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl; import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils; import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils.TimeFormat; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IPartListener; import org.eclipse.ui.IPartListener2; @@ -707,7 +708,7 @@ public void doRun() { fEntries, entry -> !sampling.equals(entry.getSampling())))); List computedLinks; - try (TraceCompassLogUtils.ScopeLog linkLog = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingLinks")) { //$NON-NLS-1$ + try (ScopeLog linkLog = new ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingLinks")) { //$NON-NLS-1$ /* Refresh the arrows when zooming */ computedLinks = getLinkList(zoomStartTime, zoomEndTime, resolution, monitor); ViewFilterDialog filterDialog = getViewFilterDialog(); @@ -721,7 +722,7 @@ public void doRun() { } List links = computedLinks; /* Refresh the view-specific markers when zooming */ - try (TraceCompassLogUtils.ScopeLog markerLoglog = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingMarkers")) { //$NON-NLS-1$ + try (ScopeLog markerLoglog = new ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingMarkers")) { //$NON-NLS-1$ List newMarkers = new ArrayList<>(getViewMarkerList(incorrectSample, zoomStartTime, zoomEndTime, resolution, monitor)); /* Refresh the trace-specific markers when zooming */ newMarkers.addAll(getTraceMarkerList(zoomStartTime, zoomEndTime, resolution, monitor)); @@ -747,7 +748,7 @@ public void doRun() { }); } - try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStates")) { //$NON-NLS-1$ + try (ScopeLog log = new ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStates")) { //$NON-NLS-1$ getTimeGraphViewer().setTimeEventFilterApplied(isFilterActive); boolean hasSavedFilter = fTimeEventFilterDialog != null && fTimeEventFilterDialog.hasActiveSavedFilters(); @@ -764,7 +765,7 @@ public void doRun() { } if (isFilterActive && Thread.currentThread() == fZoomThread) { /* Do a full filter search as a second pass */ - try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStatesFullSearch")) { //$NON-NLS-1$ + try (ScopeLog log = new ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStatesFullSearch")) { //$NON-NLS-1$ for (TimeGraphEntry entry : fEntries) { if (monitor.isCanceled()) { return; @@ -1880,7 +1881,7 @@ private void loadTrace(final ITmfTrace trace) { } fTrace = trace; - TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, "TimeGraphView:LoadingTrace", "trace", trace.getName(), "viewId", getViewId()); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + LogUtils.traceInstant(LOGGER, Level.FINE, "TimeGraphView:LoadingTrace", "trace", trace.getName(), "viewId", getViewId()); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ restoreViewContext(); applyHideEmptyRowsFilterContext(); @@ -1936,7 +1937,7 @@ protected void rebuild() { Job buildJob = new Job(getTitle() + Messages.AbstractTimeGraphView_BuildJob) { @Override protected IStatus run(IProgressMonitor monitor) { - new BuildRunnable(trace, viewTrace, parentLogger).run(monitor); + new BuildRunnable(trace, viewTrace, Objects.requireNonNull(parentLogger)).run(monitor); monitor.done(); return Status.OK_STATUS; } diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TriStateFilteredCheckboxTree.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TriStateFilteredCheckboxTree.java index 9f11707896..892315ba9e 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TriStateFilteredCheckboxTree.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TriStateFilteredCheckboxTree.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2020 Ericsson + * Copyright (c) 2018, 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 @@ -27,9 +27,9 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.widgets.Composite; 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.common.core.log.TraceCompassLogUtils.ScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLog; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.FlowScopeLogBuilder; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import org.eclipse.ui.dialogs.PatternFilter; import org.eclipse.ui.progress.WorkbenchJob; diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java index 0564c6afc7..c3b5fbaf1e 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/TimeGraphEntry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2018 Ericsson, École Polytechnique de Montréal + * Copyright (c) 2012, 2025 Ericsson, É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 @@ -31,12 +31,12 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.swt.SWT; import org.eclipse.tracecompass.common.core.log.TraceCompassLog; -import org.eclipse.tracecompass.common.core.log.TraceCompassLogUtils; import org.eclipse.tracecompass.internal.tmf.ui.widgets.timegraph.model.TimeGraphLineEntry; import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver; import org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphEntryModel; import org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel; import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; @@ -403,7 +403,7 @@ public void addZoomedEvent(ITimeEvent event) { * @since 4.2 */ public void updateZoomedEvent(ITimeEvent event) { - try (TraceCompassLogUtils.ScopeLog poc = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINE, "UpdateZoomedEvent")) { //$NON-NLS-1$ + try (ScopeLog poc = new ScopeLog(LOGGER, Level.FINE, "UpdateZoomedEvent")) { //$NON-NLS-1$ long start = getStartTime(); long end = getEndTime(); diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java index 64360cce36..e255154dfd 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2007, 2024 Intel Corporation and others + * Copyright (c) 2007, 2025 Intel Corporation and others * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -90,8 +90,6 @@ import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeColumn; 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.common.core.math.SaturatedArithmetic; import org.eclipse.tracecompass.internal.provisional.tmf.ui.model.IStylePresentationProvider; import org.eclipse.tracecompass.internal.provisional.tmf.ui.widgets.timegraph.ITimeGraphStylePresentationProvider; @@ -141,6 +139,8 @@ import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry; import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.MarkerEvent; import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry; +import org.eclipse.tracecompass.trace_event_logger.LogUtils; +import org.eclipse.tracecompass.trace_event_logger.LogUtils.ScopeLog; import com.google.common.collect.Iterables; @@ -2254,7 +2254,7 @@ protected void drawMarkers(Rectangle bounds, ITimeDataProvider timeProvider, Lis } } gc.setClipping((Rectangle) null); - TraceCompassLogUtils.traceCounter(LOGGER, Level.FINER, fDrawMarkersCountLabel, size); + LogUtils.traceCounter(LOGGER, Level.FINER, fDrawMarkersCountLabel, size); } /** @@ -2390,7 +2390,7 @@ public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider, Item item = items[i]; drawItem(item, bounds, timeProvider, i, nameSpace, gc); } - TraceCompassLogUtils.traceCounter(LOGGER, Level.FINER, fDrawItemsCountLabel, bottomIndex - topIndex); + LogUtils.traceCounter(LOGGER, Level.FINER, fDrawItemsCountLabel, bottomIndex - topIndex); if (gc == null) { return; @@ -2610,7 +2610,7 @@ public void drawLinks(Rectangle bounds, ITimeDataProvider timeProvider, drawLink(event, bounds, timeProvider, nameSpace, gc); } gc.setClipping((Rectangle) null); - TraceCompassLogUtils.traceCounter(LOGGER, Level.FINER, fDrawLinksCountLabel, size); + LogUtils.traceCounter(LOGGER, Level.FINER, fDrawLinksCountLabel, size); } /**