mirror of https://github.com/mchr3k/org.intrace
Fix fast network trace output, cleanup build xml
Warning - code appears to be a bit broken
This commit is contained in:
parent
6e32c185ae
commit
15e1585b9b
|
|
@ -7,10 +7,9 @@
|
|||
<classpathentry kind="lib" path="lib/easymockclassextension-2.5.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/easymock-2.5.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/cglib-nodep-2.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/asm-3.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/asm-commons-3.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/asm-util-3.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/swt-windows-3.5.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/miglayout-3.7-swt.jar"/>
|
||||
<classpathentry kind="con" path="SWT_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/asm-debug-all-3.3.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,58 @@
|
|||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="jar" description="Create Jars" depends="build" >
|
||||
|
||||
<mkdir dir="./build/jars/" />
|
||||
|
||||
<!-- Trace Agent -->
|
||||
<jarjar jarfile="./build/jars/traceagent.jar" compress="false" manifest="conf/META-INF/MANIFEST.MF">
|
||||
<fileset dir="./build/classes" includes="**/agent/**/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/output/**/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/shared/*.class" />
|
||||
<zipfileset src="./lib/asm-debug-all-3.3.jar"/>
|
||||
<rule pattern="org.objectweb.asm.**" result="org.intrace.internal.objectweb.asm.@1"/>
|
||||
</jarjar>
|
||||
|
||||
<!-- Test Trace Agent -->
|
||||
<jar destfile="./build/jars/traceagent_test.jar" compress="false" manifest="conf/META-INF/MANIFEST.MF">
|
||||
</jar>
|
||||
|
||||
<!-- CUI Trace Client -->
|
||||
<jar destfile="./build/jars/cuitraceclient.jar" compress="false">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="org.intrace.client.cui.TraceClient" />
|
||||
<attribute name="Class-Path" value="." />
|
||||
</manifest>
|
||||
<fileset dir="./build/classes" includes="**/shared/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/client/cui/*.class" />
|
||||
</jar>
|
||||
|
||||
<!-- GUI Trace Client - Windows -->
|
||||
<jar destfile="./build/jars/guitraceclient-win.jar" filesetmanifest="mergewithoutmain">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="org.intrace.client.gui.TraceClient" />
|
||||
<attribute name="Class-Path" value="." />
|
||||
</manifest>
|
||||
<fileset dir="./build/classes" includes="**/shared/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/client/gui/**/*.class" />
|
||||
<zipfileset excludes="META-INF/*.MF" src="lib/swt-windows-3.5.2.jar" />
|
||||
<zipfileset excludes="META-INF/*.MF" src="lib/miglayout-3.7-swt.jar" />
|
||||
</jar>
|
||||
|
||||
<!-- GUI Trace Client - Linux -->
|
||||
<jar destfile="./build/jars/guitraceclient-linux.jar" filesetmanifest="mergewithoutmain">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="org.intrace.client.gui.TraceClient" />
|
||||
<attribute name="Class-Path" value="." />
|
||||
</manifest>
|
||||
<fileset dir="./build/classes" includes="**/shared/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/client/gui/**/*.class" />
|
||||
<zipfileset excludes="META-INF/*.MF" src="lib/swt-linux-3.5.2.jar" />
|
||||
<zipfileset excludes="META-INF/*.MF" src="lib/miglayout-3.7-swt.jar" />
|
||||
</jar>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="test" description="Run Tests" depends="build" >
|
||||
<property name="emma.enabled" value="true" />
|
||||
|
|
@ -122,77 +173,8 @@
|
|||
</emma>
|
||||
</target>
|
||||
|
||||
<target name="jar" description="Create Jars" depends="build, test, onlyjar" >
|
||||
</target>
|
||||
|
||||
<target name="onlyjar" depends="build" >
|
||||
|
||||
<mkdir dir="./build/jars/" />
|
||||
|
||||
<!-- Trace Agent -->
|
||||
<jarjar jarfile="./build/jars/traceagent.jar" compress="false" manifest="conf/META-INF/MANIFEST.MF">
|
||||
<fileset dir="./build/classes" includes="**/agent/**/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/output/**/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/shared/*.class" />
|
||||
<zipfileset src="./lib/asm-3.2.jar"/>
|
||||
<zipfileset src="./lib/asm-commons-3.2.jar"/>
|
||||
<zipfileset src="./lib/asm-util-3.2.jar"/>
|
||||
<rule pattern="org.objectweb.asm.**" result="org.intrace.internal.objectweb.asm.@1"/>
|
||||
</jarjar>
|
||||
|
||||
<!-- Test Trace Agent -->
|
||||
<jar destfile="./build/jars/traceagent_test.jar" compress="false" manifest="conf/META-INF/MANIFEST.MF">
|
||||
</jar>
|
||||
|
||||
<!-- CUI Trace Client -->
|
||||
<jar destfile="./build/jars/cuitraceclient.jar" compress="false">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="org.intrace.client.cui.TraceClient" />
|
||||
<attribute name="Class-Path" value="." />
|
||||
</manifest>
|
||||
<fileset dir="./build/classes" includes="**/shared/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/client/cui/*.class" />
|
||||
</jar>
|
||||
|
||||
<!-- GUI Trace Client - Windows -->
|
||||
<jar destfile="./build/jars/guitraceclient-win.jar" filesetmanifest="mergewithoutmain">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="org.intrace.client.gui.TraceClient" />
|
||||
<attribute name="Class-Path" value="." />
|
||||
</manifest>
|
||||
<fileset dir="./build/classes" includes="**/shared/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/client/gui/**/*.class" />
|
||||
<zipfileset excludes="META-INF/*.MF" src="lib/swt-windows-3.5.2.jar" />
|
||||
<zipfileset excludes="META-INF/*.MF" src="lib/miglayout-3.7-swt.jar" />
|
||||
</jar>
|
||||
|
||||
<!-- GUI Trace Client - Linux -->
|
||||
<jar destfile="./build/jars/guitraceclient-linux.jar" filesetmanifest="mergewithoutmain">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="org.intrace.client.gui.TraceClient" />
|
||||
<attribute name="Class-Path" value="." />
|
||||
</manifest>
|
||||
<fileset dir="./build/classes" includes="**/shared/*.class" />
|
||||
<fileset dir="./build/classes" includes="**/client/gui/**/*.class" />
|
||||
<zipfileset excludes="META-INF/*.MF" src="lib/swt-linux-3.5.2.jar" />
|
||||
<zipfileset excludes="META-INF/*.MF" src="lib/miglayout-3.7-swt.jar" />
|
||||
</jar>
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
<target name="example" depends="jar">
|
||||
<java classname="example.TraceExample" fork="true">
|
||||
<arg value="" />
|
||||
<classpath>
|
||||
<pathelement path="./build/test" />
|
||||
</classpath>
|
||||
<jvmarg value="-javaagent:build/jars/traceagent.jar=[instru-true" />
|
||||
</java>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="findbugs" depends="jar">
|
||||
<target name="findbugs" depends="build">
|
||||
|
||||
<mkdir dir="./reports/findbugs" />
|
||||
|
||||
|
|
@ -217,4 +199,28 @@
|
|||
|
||||
</target>
|
||||
|
||||
<target name="release" description="Build jars and run all automated tests" depends="jar, test, findbugs" >
|
||||
</target>
|
||||
|
||||
|
||||
<target name="example" depends="jar">
|
||||
<java classname="example.TraceExample" fork="true">
|
||||
<arg value="5000" />
|
||||
<classpath>
|
||||
<pathelement path="./build/test" />
|
||||
</classpath>
|
||||
<jvmarg value="-javaagent:build/jars/traceagent.jar=[instru-true" />
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="fastexample" depends="jar">
|
||||
<java classname="example.TraceExample" fork="true">
|
||||
<arg value="0" />
|
||||
<classpath>
|
||||
<pathelement path="./build/test" />
|
||||
</classpath>
|
||||
<jvmarg value="-javaagent:build/jars/traceagent.jar=[instru-true" />
|
||||
</java>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<FindBugsFilter>
|
||||
// Ignore infinite loop
|
||||
// Ignore infinite loop
|
||||
<Match>
|
||||
<Class name="org.intrace.agent.server.AgentClientConnection" />
|
||||
<Or>
|
||||
<Method name="run" />
|
||||
</Or>
|
||||
<Bug code="IL" />
|
||||
</Match>
|
||||
|
||||
</Match>
|
||||
|
||||
// Ignore infinite loop
|
||||
<Match>
|
||||
<Class name="org.intrace.agent.server.AgentServer" />
|
||||
|
|
@ -15,14 +15,14 @@
|
|||
<Method name="run" />
|
||||
</Or>
|
||||
<Bug code="IL" />
|
||||
</Match>
|
||||
|
||||
</Match>
|
||||
|
||||
// Ignore return value warnings in this method
|
||||
<Match>
|
||||
<Class name="org.intrace.output.OutputSettings" />
|
||||
<Match>
|
||||
<Class name="org.intrace.output.trace.TraceSettings" />
|
||||
<Or>
|
||||
<Method name="resetFile" />
|
||||
</Or>
|
||||
<Bug code="RV" />
|
||||
</Match>
|
||||
</Match>
|
||||
</FindBugsFilter>
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -177,7 +177,8 @@ public class ClassTransformer implements ClassFileTransformer
|
|||
}
|
||||
|
||||
// Don't modify a class from a JAR file unless this is allowed
|
||||
CodeSource codeSource = protectionDomain.getCodeSource();
|
||||
CodeSource codeSource = ((protectionDomain != null) ?
|
||||
protectionDomain.getCodeSource() : null);
|
||||
if (!settings.allowJarsToBeTraced() && (codeSource != null)
|
||||
&& codeSource.getLocation().getPath().endsWith(".jar"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -688,7 +688,7 @@ public class TraceWindow
|
|||
{
|
||||
if (sWindow.isDisposed())
|
||||
return;
|
||||
sWindow.getDisplay().asyncExec(new Runnable()
|
||||
sWindow.getDisplay().syncExec(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
|
|
@ -703,7 +703,7 @@ public class TraceWindow
|
|||
{
|
||||
if (sWindow.isDisposed())
|
||||
return;
|
||||
sWindow.getDisplay().asyncExec(new Runnable()
|
||||
sWindow.getDisplay().syncExec(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
|
|
@ -897,8 +897,7 @@ public class TraceWindow
|
|||
catch (IOException ex)
|
||||
{
|
||||
textOutputTab.filterThread
|
||||
.addTraceLine(TraceFilterThread.SYSTEM_TRACE_PREFIX
|
||||
+ " Failed to setup network trace: "
|
||||
.addSystemTraceLine("Failed to setup network trace: "
|
||||
+ ex.toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -935,8 +934,7 @@ public class TraceWindow
|
|||
if (modifiedClasses.length() <= 2)
|
||||
{
|
||||
textOutputTab.filterThread
|
||||
.addTraceLine(TraceFilterThread.SYSTEM_TRACE_PREFIX
|
||||
+ " No modified classes");
|
||||
.addSystemTraceLine("No modified classes");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -947,8 +945,7 @@ public class TraceWindow
|
|||
if (modifiedClasses.indexOf(",") == -1)
|
||||
{
|
||||
textOutputTab.filterThread
|
||||
.addTraceLine(TraceFilterThread.SYSTEM_TRACE_PREFIX
|
||||
+ " Modified: "
|
||||
.addSystemTraceLine("Modified: "
|
||||
+ modifiedClasses);
|
||||
}
|
||||
else
|
||||
|
|
@ -957,8 +954,7 @@ public class TraceWindow
|
|||
for (String className : classNames)
|
||||
{
|
||||
textOutputTab.filterThread
|
||||
.addTraceLine(TraceFilterThread.SYSTEM_TRACE_PREFIX
|
||||
+ " Modified: "
|
||||
.addSystemTraceLine("Modified: "
|
||||
+ (className != null ? className
|
||||
.trim()
|
||||
: "null"));
|
||||
|
|
@ -1165,8 +1161,7 @@ public class TraceWindow
|
|||
public void run()
|
||||
{
|
||||
textOutputTab.filterThread
|
||||
.addTraceLine(TraceFilterThread.SYSTEM_TRACE_PREFIX
|
||||
+ " Latest Settings Received");
|
||||
.addSystemTraceLine("Latest Settings Received");
|
||||
settingsData = new ParsedSettingsData(settingsMap);
|
||||
connectionState = ConnectState.CONNECTED;
|
||||
updateUIStateSameThread();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
|
|
@ -34,6 +35,11 @@ public class TraceFilterThread implements Runnable
|
|||
* Queue of new unprocessed trace lines
|
||||
*/
|
||||
private final BlockingQueue<String> newTraceLines = new LinkedBlockingQueue<String>();
|
||||
|
||||
/**
|
||||
* Semaphore controlling how many trace line can be added
|
||||
*/
|
||||
private final Semaphore traceLineSemaphore = new Semaphore(5);
|
||||
|
||||
/**
|
||||
* List of trace lines saved by this thread from the newTraceLines
|
||||
|
|
@ -74,7 +80,7 @@ public class TraceFilterThread implements Runnable
|
|||
/**
|
||||
* System trace is never filtered out
|
||||
*/
|
||||
public static final String SYSTEM_TRACE_PREFIX = "***";
|
||||
private static final String SYSTEM_TRACE_PREFIX = "***";
|
||||
|
||||
/**
|
||||
* cTor
|
||||
|
|
@ -94,57 +100,103 @@ public class TraceFilterThread implements Runnable
|
|||
|
||||
public void addTraceLine(String traceLine)
|
||||
{
|
||||
newTraceLines.add(traceLine + "\r\n");
|
||||
try
|
||||
{
|
||||
traceLineSemaphore.acquire();
|
||||
newTraceLines.add(traceLine + "\r\n");
|
||||
} catch (InterruptedException e)
|
||||
{
|
||||
// Throw away
|
||||
}
|
||||
// We don't release the semaphore - the thread does so
|
||||
// once it is happy to allow more trace lines in
|
||||
}
|
||||
|
||||
public void addSystemTraceLine(String traceLine)
|
||||
{
|
||||
newTraceLines.add(SYSTEM_TRACE_PREFIX + " " + traceLine + "\r\n");
|
||||
}
|
||||
|
||||
public void applyFilter(Pattern filter,
|
||||
TraceFilterProgressHandler progressCallback)
|
||||
{
|
||||
this.progressCallback = progressCallback;
|
||||
tracePattern = filter;
|
||||
setTracePattern(filter);
|
||||
thisThread.interrupt();
|
||||
}
|
||||
|
||||
|
||||
private synchronized void setTracePattern(Pattern filter)
|
||||
{
|
||||
tracePattern = filter;
|
||||
}
|
||||
|
||||
private synchronized Pattern getTracePattern()
|
||||
{
|
||||
return tracePattern;
|
||||
}
|
||||
|
||||
public void clearTrace()
|
||||
{
|
||||
clearTrace = true;
|
||||
setClearTrace();
|
||||
thisThread.interrupt();
|
||||
}
|
||||
|
||||
private synchronized void setClearTrace()
|
||||
{
|
||||
clearTrace = true;
|
||||
}
|
||||
|
||||
private synchronized boolean getClearTrace()
|
||||
{
|
||||
return clearTrace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
boolean doClearTrace = false;
|
||||
Pattern applyPattern = null;
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
Pattern pattern = tracePattern;
|
||||
if (pattern != null)
|
||||
if (applyPattern != null)
|
||||
{
|
||||
applyPattern(applyPattern);
|
||||
applyPattern = null;
|
||||
tracePattern = null;
|
||||
applyPattern(pattern);
|
||||
}
|
||||
|
||||
if (clearTrace)
|
||||
if (doClearTrace)
|
||||
{
|
||||
doClearTrace = false;
|
||||
clearTrace = false;
|
||||
traceLines.clear();
|
||||
callback.setText("");
|
||||
}
|
||||
|
||||
String newTraceLine = newTraceLines.take();
|
||||
|
||||
if (!newTraceLine.startsWith(SYSTEM_TRACE_PREFIX))
|
||||
{
|
||||
traceLineSemaphore.release();
|
||||
}
|
||||
|
||||
traceLines.add(newTraceLine);
|
||||
if (newTraceLine.startsWith("***") || (tracePattern == null)
|
||||
|| tracePattern.matcher(newTraceLine).matches())
|
||||
if (newTraceLine.startsWith(SYSTEM_TRACE_PREFIX) ||
|
||||
(tracePattern == null) ||
|
||||
tracePattern.matcher(newTraceLine).matches())
|
||||
{
|
||||
callback.appendText(newTraceLine);
|
||||
}
|
||||
}
|
||||
catch (InterruptedException ex)
|
||||
{
|
||||
if ((tracePattern == null) && !clearTrace)
|
||||
doClearTrace = getClearTrace();
|
||||
applyPattern = getTracePattern();
|
||||
if ((applyPattern == null) && !doClearTrace)
|
||||
{
|
||||
// Time to quit
|
||||
break;
|
||||
|
|
@ -152,10 +204,11 @@ public class TraceFilterThread implements Runnable
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Throwable ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
System.out.println("Filter thread quitting");
|
||||
}
|
||||
|
||||
private void applyPattern(Pattern pattern)
|
||||
|
|
|
|||
|
|
@ -11,10 +11,11 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
public class NetworkDataSenderThread implements Runnable
|
||||
{
|
||||
private boolean alive = true;
|
||||
private final ServerSocket networkSocket;
|
||||
private Socket traceSendingSocket = null;
|
||||
private final BlockingQueue<Object> outgoingData = new LinkedBlockingQueue<Object>(
|
||||
100);
|
||||
5);
|
||||
private Set<NetworkDataSenderThread> set;
|
||||
|
||||
public NetworkDataSenderThread(ServerSocket networkSocket)
|
||||
|
|
@ -28,7 +29,7 @@ public class NetworkDataSenderThread implements Runnable
|
|||
|
||||
Thread networkThread = new Thread(this);
|
||||
networkThread.setDaemon(true);
|
||||
networkThread.setName("Network Data Sender");
|
||||
networkThread.setName(Thread.currentThread().getName() + " - Network Data Sender");
|
||||
networkThread.start();
|
||||
}
|
||||
|
||||
|
|
@ -36,6 +37,7 @@ public class NetworkDataSenderThread implements Runnable
|
|||
{
|
||||
try
|
||||
{
|
||||
alive = false;
|
||||
networkSocket.close();
|
||||
if (traceSendingSocket != null)
|
||||
{
|
||||
|
|
@ -54,7 +56,10 @@ public class NetworkDataSenderThread implements Runnable
|
|||
{
|
||||
try
|
||||
{
|
||||
outgoingData.put(data);
|
||||
while (alive && !outgoingData.offer(data, 1, TimeUnit.SECONDS))
|
||||
{
|
||||
// Do nothing - work is done above
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
private boolean branchTrace = false;
|
||||
private boolean argTrace = false;
|
||||
|
||||
private static boolean stdOut = true;
|
||||
private static boolean fileOut = false;
|
||||
private static boolean netOut = false;
|
||||
private boolean stdOut = true;
|
||||
private boolean fileOut = false;
|
||||
private boolean netOut = false;
|
||||
|
||||
private static final TraceSettings traceSettings = new TraceSettings("");
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + byteArg);
|
||||
}
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + Arrays.toString(byteArrayArg));
|
||||
}
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + shortArg);
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + Arrays.toString(shortArrayArg));
|
||||
}
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + intArg);
|
||||
}
|
||||
}
|
||||
|
|
@ -119,7 +119,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + Arrays.toString(intArrayArg));
|
||||
}
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + longArg);
|
||||
}
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + Arrays.toString(longArrayArg));
|
||||
}
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + floatArg);
|
||||
}
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + Arrays.toString(floatArrayArg));
|
||||
}
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + doubleArg);
|
||||
}
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + Arrays.toString(doubleArrayArg));
|
||||
}
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + boolArg);
|
||||
}
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + Arrays.toString(boolArrayArg));
|
||||
}
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + charArg);
|
||||
}
|
||||
}
|
||||
|
|
@ -227,7 +227,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + Arrays.toString(charArrayArg));
|
||||
}
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
String objStr = Arrays.deepToString(new Object[]
|
||||
{ objArg });
|
||||
objStr = objStr.substring(1, objStr.length() - 1);
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + objStr);
|
||||
}
|
||||
}
|
||||
|
|
@ -254,7 +254,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (argTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
writeTraceOutput(className + ":" + methodName + ": " + desc
|
||||
+ ": " + Arrays.deepToString(objArrayArg));
|
||||
}
|
||||
}
|
||||
|
|
@ -264,7 +264,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (branchTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": /:"
|
||||
writeTraceOutput(className + ":" + methodName + ": /:"
|
||||
+ lineNo);
|
||||
}
|
||||
}
|
||||
|
|
@ -274,7 +274,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (branchTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName
|
||||
writeTraceOutput(className + ":" + methodName
|
||||
+ ":CaughtException:" + lineNo + ": "
|
||||
+ throwableToString(throwable));
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (entryExitTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": {:"
|
||||
writeTraceOutput(className + ":" + methodName + ": {:"
|
||||
+ lineNo);
|
||||
}
|
||||
}
|
||||
|
|
@ -312,7 +312,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
{
|
||||
if (entryExitTrace)
|
||||
{
|
||||
TraceHandler.writeTraceOutput(className + ":" + methodName + ": }:"
|
||||
writeTraceOutput(className + ":" + methodName + ": }:"
|
||||
+ lineNo);
|
||||
}
|
||||
}
|
||||
|
|
@ -327,7 +327,7 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
*
|
||||
* @param xiOutput
|
||||
*/
|
||||
public static void writeTraceOutput(String xiOutput)
|
||||
public void writeTraceOutput(String xiOutput)
|
||||
{
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yy/MM/dd HH:mm:ss");
|
||||
long threadID = Thread.currentThread().getId();
|
||||
|
|
@ -345,11 +345,15 @@ public class TraceHandler implements IInstrumentationHandler
|
|||
|
||||
if (netOut)
|
||||
{
|
||||
if (System.getProperty("NET") != null)
|
||||
{
|
||||
System.err.println("NETOUT");
|
||||
}
|
||||
AgentHelper.writeDataOutput(traceString);
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void writeFileTrace(String traceString)
|
||||
public synchronized void writeFileTrace(String traceString)
|
||||
{
|
||||
PrintWriter outputWriter;
|
||||
outputWriter = traceSettings.getFileTraceWriter();
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ public class TraceSettings
|
|||
}
|
||||
else if (arg.equals(TraceConfigConstants.NET_OUT + "false"))
|
||||
{
|
||||
System.setProperty("NET", "OFF");
|
||||
netTraceOutputEnabled = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ public class TraceExample
|
|||
*/
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
otherMain("123");
|
||||
otherMain(args[0]);
|
||||
}
|
||||
|
||||
public static void otherMain(String arg) throws Exception
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Thread.sleep(1000 * 5);
|
||||
Thread.sleep(Long.parseLong(arg));
|
||||
InnerTestClass.foo();
|
||||
workMethod("foobar");
|
||||
}
|
||||
|
|
@ -28,8 +28,8 @@ public class TraceExample
|
|||
{
|
||||
long currentTime = System.currentTimeMillis();
|
||||
System.setProperty("a", foo);
|
||||
System.out.println(exceptionMethod());
|
||||
System.out.println(intArrayMethod(new int[]
|
||||
System.setProperty("foo", exceptionMethod());
|
||||
System.setProperty("foo", ": " + intArrayMethod(new int[]
|
||||
{ 1, 2, 3 }));
|
||||
if ((currentTime % 2) == 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue