-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Counts source locations for JSP files
- Loading branch information
Steve Salas
committed
Jun 28, 2018
1 parent
b8e2bdc
commit 0a45fdc
Showing
20 changed files
with
241 additions
and
36 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
31 changes: 31 additions & 0 deletions
31
agent/src/main/java/com/codedx/codepulse/agent/trace/InstrumentationClassVisitor.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,31 @@ | ||
package com.codedx.codepulse.agent.trace; | ||
|
||
import org.objectweb.asm.ClassVisitor; | ||
import org.objectweb.asm.MethodVisitor; | ||
import org.objectweb.asm.Opcodes; | ||
|
||
import java.util.BitSet; | ||
import java.util.LinkedList; | ||
|
||
public class InstrumentationClassVisitor extends ClassVisitor { | ||
|
||
private LinkedList<InstrumentationMethodVisitor> inspectors = new LinkedList<>(); | ||
|
||
public InstrumentationClassVisitor() { | ||
super(Opcodes.ASM5); | ||
} | ||
|
||
public BitSet getLineNumbers() { | ||
BitSet lineNumbers = new BitSet(); | ||
for (InstrumentationMethodVisitor visitor : inspectors) { | ||
lineNumbers.or(visitor.getLineNumbers()); | ||
} | ||
return lineNumbers; | ||
} | ||
|
||
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { | ||
InstrumentationMethodVisitor visitor = new InstrumentationMethodVisitor(); | ||
inspectors.add(visitor); | ||
return visitor; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
agent/src/main/java/com/codedx/codepulse/agent/trace/InstrumentationMethodVisitor.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,31 @@ | ||
package com.codedx.codepulse.agent.trace; | ||
|
||
import org.objectweb.asm.Label; | ||
import org.objectweb.asm.MethodVisitor; | ||
import org.objectweb.asm.Opcodes; | ||
|
||
import java.util.BitSet; | ||
|
||
public class InstrumentationMethodVisitor extends MethodVisitor { | ||
|
||
private BitSet lineNumbers = new BitSet(); | ||
|
||
public InstrumentationMethodVisitor() | ||
{ | ||
super(Opcodes.ASM5); | ||
} | ||
|
||
public BitSet getLineNumbers() { return lineNumbers; } | ||
|
||
@Override | ||
public void visitCode() { | ||
lineNumbers.clear(); | ||
} | ||
|
||
@Override | ||
public void visitLineNumber(int line, Label start) | ||
{ | ||
int lineNumberVisited = line; // line numbers are 1-based | ||
lineNumbers.set(lineNumberVisited); | ||
} | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.