An improved method, apparatus, and computer instructions for compressing trace data. An instruction stream is identified, and in response to identifying the instruction stream, the instruction addresses in the instruction stream are replaced with a stream identifier to form compressed trace data. Data addresses may be related to instructions in the instruction stream to generate a data trace component in the compressed trace data.
A microprocessor a microprocessor includes: a processor module executing an instruction to generate trace information including the information of the kind and the length of the instruction; an application processing circuit operating in cooperation with the processor module to process a specific application; an address calculating circuit calculating an execution address for executing the instruction based on the information of the instruction length; a data obtaining circuit obtaining data from the application processing circuit when the calculated execution address is located within a range of a designated address; and a trace memory in which the obtained data is stored together with the trace information.