0

I need a full bytecode-level execution trace of the entire Java program.

I found the JVM TI with the SingleStep event which allosw me to WRITE an agent which will produce the trace. But surely there is a ready-made JVM option somewhere?

EboMike
  • 76,846
  • 14
  • 164
  • 167
Y A
  • 1
  • 1
  • 1
    An application can execute billions of instructions per second. How do you intend to record and analyse this data? – Peter Lawrey Jul 02 '11 at 14:08
  • See comment below. Originally i was thinking of only tracing specific classes.. But in any case if u remove startup code, memory stalls, i/o and other crap, i think there are plenty of interesting algorithms that will give a trace of 100 millions instructions which is manageable – Y A Jul 02 '11 at 23:03

2 Answers2

2

Use a debug build of the Hotspot JVM and run it with the -XX:+TraceBytecodes flag. See Trace java bytecode stream for how to build this debug JVM.

Martin Monperrus
  • 1,845
  • 2
  • 19
  • 28
int3
  • 12,861
  • 8
  • 51
  • 80
0

A full Java bytecode trace? That sounds incredibly slow. HotSpot does not support this functionality using any options and I think your demands are a little crazy. Perhaps think of an alternate means of achieving your ultimate goal that isn't quite as naive.

obataku
  • 29,212
  • 3
  • 44
  • 57
  • If the tracing can be turned on and off dynamically, then an "interesting" code region will log a few million instructions which is reasonable... In retrospect, i agree some sort of dynamic control is required. – Y A Jul 02 '11 at 22:58