It looks like the btrace java agent opens a socket on port 2020. Running two JVMs causes a port conflict and the agent doesn't initialize in the second or third JVMs. You can specify a port on the second JVM to avoid these conflicts using something like this:
-javaagent:/Users/bnewport/Development/btrace-bin/build/btrace-agent.jar=script=AgentServerTimer.class,port=2021
Just make sure each JVM uses a different port. Another issue is the agent writes the script logs to a file named after the agent. If two JVMs use the same script then you get both processes trying to open the same file and that won't work. For now, I'm not hitting this as I use one script for the client JVM (measuring calls to invoke agents) and another with a different name on the server JVM to measure the times to invoke the actual agents.
Client script: Download AgentTimer
Server script: Download AgentServerTimer
This lets me see the time on the client versus the actual time to run the agent server side. But, it will only work on a single client/single server JVM on a single box for now. You can work around this by copying the scripts around or using multiple boxes but maybe they should include the pid or port number in the file name.
Comments