Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Khouzam2019-03-06 16:25:48 +0000
committerMatthew Khouzam2019-03-06 20:25:59 +0000
commit0cedb2f8aa84b82a96455697e42a4d231945006d (patch)
treebf4e7c03b87cc3a05b0ba25978e2ff13e3735e33
parente60382033442784362912545e42c61553ba68ecc (diff)
downloadorg.eclipse.tracecompass.incubator-0cedb2f8aa84b82a96455697e42a4d231945006d.tar.gz
org.eclipse.tracecompass.incubator-0cedb2f8aa84b82a96455697e42a4d231945006d.tar.xz
org.eclipse.tracecompass.incubator-0cedb2f8aa84b82a96455697e42a4d231945006d.zip
opentracing: avoid making a string several times in getSpanName
Just seek the third '/' in getSpanName Change-Id: I239ef01d7f4c6c789559b3f953ecd46edc422171 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/138201 Tested-by: CI Bot Reviewed-by: Simon Delisle <simon.delisle@ericsson.com> Tested-by: Simon Delisle <simon.delisle@ericsson.com>
-rw-r--r--tracetypes/org.eclipse.tracecompass.incubator.opentracing.core/src/org/eclipse/tracecompass/incubator/internal/opentracing/core/analysis/spanlife/SpanLifeDataProvider.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/tracetypes/org.eclipse.tracecompass.incubator.opentracing.core/src/org/eclipse/tracecompass/incubator/internal/opentracing/core/analysis/spanlife/SpanLifeDataProvider.java b/tracetypes/org.eclipse.tracecompass.incubator.opentracing.core/src/org/eclipse/tracecompass/incubator/internal/opentracing/core/analysis/spanlife/SpanLifeDataProvider.java
index 75b4d345a..7ba5b0154 100644
--- a/tracetypes/org.eclipse.tracecompass.incubator.opentracing.core/src/org/eclipse/tracecompass/incubator/internal/opentracing/core/analysis/spanlife/SpanLifeDataProvider.java
+++ b/tracetypes/org.eclipse.tracecompass.incubator.opentracing.core/src/org/eclipse/tracecompass/incubator/internal/opentracing/core/analysis/spanlife/SpanLifeDataProvider.java
@@ -286,9 +286,10 @@ public class SpanLifeDataProvider extends AbstractTimeGraphDataProvider<@NonNull
}
private static String getSpanName(String attributeName) {
- String spanNameAndId = attributeName.substring(0, attributeName.lastIndexOf('/'));
- spanNameAndId = attributeName.substring(0, spanNameAndId.lastIndexOf('/'));
- return spanNameAndId.substring(0, spanNameAndId.lastIndexOf('/'));
+ int slashPos = attributeName.lastIndexOf('/');
+ slashPos = attributeName.lastIndexOf('/', slashPos);
+ slashPos = attributeName.lastIndexOf('/', slashPos);
+ return attributeName.substring(0, Math.max(0, slashPos));
}
private static String getSpanId(String attributeName) {

Back to the top