Next: , Previous: , Up: The c_trace backend   [Contents][Index]

c_trace tracing with curses

c_trace tracing with curses

The --curses option enables a more interactive tracing environment. Generated programs must be linked with the curses (or compatible, such as ncurses ) library. The resulting executable supports the following additional command-line options:

-D, --delay=number delay in milliseconds after each screen update (‘0’=no delay)

-M, --monitor=number processor number to monitor

-B, --breakpoint =number source line at which to enter single-stepping mode (‘-1’=none; ‘0’=first event)

When the program is run it brings up a screen like the following:

 1.  # Determine computational "noise"
 3.  Require language version "1.5".
 5.  accesses is "Number of data accesses to perform" and comes from
 6.    "--accesses" or "-a" with default 500000.
 8.  trials is "Number of timings to take" and comes from "--timings" or
 9.    "-t" with default 1000.
11.  For trials repetitions {
12.    all tasks reset their counters then
13.    all tasks touch a 1 word memory region accesses times with stride 0 w
14.    all tasks log a histogram of elapsed_usecs as "Actual time (usecs)"
15.  }

Phys: 0  Virt: 0  Action: RESET    Event:    1/3001

The program displays its source code (truncated vertically if too tall and truncated horizontally if too wide) at the top of the screen and a status bar at the bottom of the screen. As the program executes, a cursor indicates the line of source code that is currently executing. Likewise, the status bar updates dynamically to indicate the processor’s current task ID, action, and event number. In curses mode, the program’s standard output (see Writing to standard output) is suppressed so as not to disrupt the trace display.

Programs traced with c_trace and the --curses option are made interactive and support the following (case-insensitive) keyboard commands:


Enable single-stepping mode. While single-stepping mode is enabled the traced processor will execute only one event per keystroke from the user.


Disable single-stepping mode. The program executes without further user intervention.


Delete the breakpoint.


Quit the program. The log file will indicate that the program did not run to completion.

All other keystrokes cause the program to advance to the next event immediately.

A single breakpoint can be set using the program’s -B or --breakpoint command-line option. Whenever the monitored processor reaches the source-code line at which a breakpoint has been set, it enters single-stepping mode exactly as if S were pressed. Setting a breakpoint at line 0 tells the program to begin single-stepping as soon as the program begins. Note that only lines corresponding to coNCePTuaL events can support breakpoints.

Next: , Previous: , Up: The c_trace backend   [Contents][Index]

Scott Pakin,