CPROF(1)                                                 CPROF(1)

     NAME
          cprof - coverage profiling of limbo programs

     SYNOPSIS
          cprof [ -nfer ] [ -m modname ] ... [ cmd arg ...  ]

     DESCRIPTION
          Cprof is a coverage profiling tool which shows whether lines
          of limbo source have been executed or not. It can also show
          the number of times a line of code has been executed and can
          accumulate results over a series of runs if so desired. The
          source in question should be compiled with the -g flag so
          that the relevant symbol table files exist.

          The -n option lists the name of the file along with the line
          number.

          The -f option shows the number of times source code is exe-
          cuted rather than simply indicating coverage.

          The -r options indicates that the profiling results should
          be recorded. Any profiled dis file of the form <name>.dis
          will have the raw profiling results stored in a file named
          <name>.prf. If this file already existed before the run, the
          results will be added to this file. The profiling results
          are not shown when this option is given.

          The -m option lists the module names which are to be pro-
          filed. If none are given, all the modules loaded by the ker-
          nel will be profiled. The name may be the actual name of the
          module or its path name.

          The -e option profiles the module that is loaded first in
          any following command. In this case there is no need to give
          a -m option as this is added automatically.

          Any remaining arguments are assumed to specify a command and
          set of arguments to the command. If this is the case, cprof
          will automatically start profiling, run the command to com-
          pletion and then stop profiling before either recording the
          results or showing the profile statistics.

          If no command is given to profile, then cprof will show the
          profile statistics from any existing recorded results in
          .prf files instead.

          Cprof discriminates between different sections of code on
          the same line. A limbo for statement, for example, consist-
          ing of initialization, condition and step all on the same
          line of source code will be dealt with as three separate

     Page 1                       Plan 9            (printed 12/21/24)

     CPROF(1)                                                 CPROF(1)

          sections.

          Cprof displays the profile statistics as a list of the limbo
          source preceded by a line number and an indication of
          whether the line was executed or not. For each section of
          code on each line, a plus sign indicates that it was exe-
          cuted, a minus sign that it was not and a question mark
          indicates that some of the dis instructions associated with
          the section of code were executed but some were not. Lines
          with no associated dis code do not have an indication. Of
          course, given the -f option, the number of times each sec-
          tion is executed is shown instead.

     EXAMPLE
          To profile a particular command
               cprof /dis/math/sieve 100
          To profile the same command but restrict attention to its own module (Sieve).
               cprof -m Sieve /dis/math/sieve 100
          A shorter version of the above
               cprof -e /dis/math/sieve 100
          Make 3 runs recording results as we go
               cprof -e -r /dis/math/sieve 100
               cprof -e -r /dis/math/sieve 1000
               cprof -e -r /dis/math/sieve 10000
          Now look at the cumulative results
               cprof -m /dis/math/sieve.dis

     SOURCE
          /appl/cmd/cprof.b

     SEE ALSO
          prof(1), wm-cprof(1), prof(2), prof(3)

     BUGS
          Cprof cannot profile compiled limbo programs.

     Page 2                       Plan 9            (printed 12/21/24)