-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve symbols for diff flame graph so that it works on function nam…
…es rather than pointers Signed-off-by: Matthew Khouzam <[email protected]> Change-Id: I17bf17de4bc7210ea291da9d749360d76965333c
- Loading branch information
1 parent
35f968d
commit 6b6c6de
Showing
2 changed files
with
101 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...rg/eclipse/tracecompass/incubator/internal/executioncomparison/core/ResolvedFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Ericsson | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License 2.0 which | ||
* accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.tracecompass.incubator.internal.executioncomparison.core; | ||
|
||
import java.util.Collection; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.tracecompass.analysis.profiling.core.base.ICallStackSymbol; | ||
import org.eclipse.tracecompass.internal.analysis.profiling.core.callgraph2.AggregatedCalledFunction; | ||
import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider; | ||
|
||
/** | ||
* A pre-resolved function. Basically has an overridden equals on the name | ||
*/ | ||
@SuppressWarnings("restriction") | ||
public final class ResolvedFunction extends AggregatedCalledFunction { | ||
private static class CSS implements ICallStackSymbol { | ||
private String fLabel; | ||
|
||
public CSS(String label) { | ||
fLabel = label; | ||
} | ||
|
||
@Override | ||
public String resolve(Collection<ISymbolProvider> providers) { | ||
return fLabel; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(fLabel); | ||
} | ||
|
||
@Override | ||
public boolean equals(@Nullable Object obj) { | ||
if (this == obj) { | ||
return true; | ||
} | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
CSS other = (CSS) obj; | ||
return Objects.equals(fLabel, other.fLabel); | ||
} | ||
|
||
} | ||
|
||
private final String fLabel; | ||
|
||
ResolvedFunction(String label, AggregatedCalledFunction toCopy) { | ||
super(toCopy); | ||
fLabel = label; | ||
} | ||
|
||
@Override | ||
public ICallStackSymbol getObject() { | ||
return new CSS(fLabel); | ||
} | ||
} |