FunctionPackage: profToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Minimally revised from 8.2.
8.2 version

disassemble-profile

Arguments: name &key current-profile verbose start end

This function prints to *standard-output* a disassembly of the function denoted by name. In the disassembly, each instruction is annotated with actual hits on that instruction, plus a percentage of the total hits in the function. Since the hits are from a statistical sampling, an estimate can be made as to where in the function time is being spent (the more hits, the better the estimate).

A hit that occurs just after (we define just after for various platforms below) an instruction that does a call probably means that the function was not itself executing but had called another function at the time of the hit. A hit that occurs any other place means the function was actually executing at the time.

By just after above, we mean different things for different architectures:

On Windows, the hit is on the instruction after the jsr, call, or bctrl instruction, respectively.

On Sparcs, the hit occurs exactly at the jmpl instruction.

As an example, consider the foo function defined in the example in Examples section in runtime-analyzer.htm. In this case, we are running on a Sparc. The output of disassemble-profile is:

cl-user(20): (prof:disassemble-profile #'foo)
Disassembly of foo collected by the time profiler
;; disassembly of #<Function foo>
;; formals: x
;; constant vector:
0: fact
1: bar

;; code start: #x63c2b4c:
                   0: 9de3bf98     save	%o6, #x-68, %o6
                   4: 80a0e001     cmp	%g3, #x1
                   8: 93d02010     tne	%icc,%g0, #x10
                  12: 81100001     taddcctv	%g0, %g1, %g0
                  16: c4076022     ld	[%i5 + 34], %g2	; fact
                  20: 90100018     mov	%i0, %o0
     1 ( 50%)     24: 9fc1200b     jmpl	%g4 + 11, %o7
                  28: 86182001     xor	%g0, #x1, %g3
                  32: c4076026     ld	[%i5 + 38], %g2	; bar
                  36: 90100018     mov	%i0, %o0
     1 ( 50%)     40: 9fc1200b     jmpl	%g4 + 11, %o7
                  44: 86182001     xor	%g0, #x1, %g3
                  48: 81c7e008     jmp	%i7 + 8
                  52: 91ea0000     restore	%o0, %g0, %o0

number of hits 2
cl-user(21): 

There are two hits, both occurring at jumps. The function foo is defined as:

(defun foo (x) 
  (fact x)
  (bar x))

so all it does it call two other functions, so the dissassembly is what we would expect in this case.

name must evaluate to a symbol or a compiled function object or a string. A symbol or compiled function object identifies a Lisp function. A string identifies a C function. The disassembler will disassemble C functions on most platforms. Note that you must use the string that appears in a runtime analyzer output (such as a call graph or a flat profile).

The current-profile keyword argument specifies the runtime analyzer data to be disassembled. If no value is specified, data from the last-run runtime analysis will be used. If a value is specified, it must be a profile saved with save-current-profile, in which case data from that runtime analysis will be used.

The verbose keyword argument controls whether or not messages about the progress of the analysis are printed to *standard-output*. The messages will be printed if the value is true and they will not be printed if the value is nil. The value defaults to nil. (Note that in the default, both the messages and the result are printed to *standard-output* so if you rebind *standard-output* to be a stream open to a file, the messages will be printed to the file as well.)

The start and end keyword arguments are passed to cl:disassemble. Allegro CL enhances cl:disassemble by adding these arguments, which resemble the start and end arguments to sequence functions. Both values, if specified, should be non-negative integers indicating the pc-offset where printing of disassembled code should start and stop, but there are many details. See the description of the Allegro CL implementation of cl:disassemble in Extensions to cl:make-package, cl:disassemble, cl:open, cl:apropos in implementation.htm.

This function returns nil.

See runtime-analyzer.htm for general information on the runtime analyzer.


Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page has had minimal revisions compared to the 8.2 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Minimally revised from 8.2.
8.2 version