Pike v8.1 release 6

Method trace()


Method trace

int trace(int level, void|string facility, void|int all_threads)

Description

This function changes the trace level for the subsystem identified by facility to level. If facility is zero or left out, it changes the global trace level which affects all subsystems.

Enabling tracing causes messages to be printed to stderr. A higher trace level includes the output from all lower levels. The lowest level is zero which disables all trace messages.

See the -t command-line option for more information.

Parameter level

If facility is specified then there is typically only one trace level for it, i.e. it's an on-or-off toggle. The global trace levels, when facility isn't specified, are:

1

Trace calls to Pike functions and garbage collector runs.

2

Trace calls to builtin functions.

3

Trace every interpreted opcode.

4

Also trace the opcode arguments.

Parameter facility

Valid facilities are:

"gc"

Trace the doings of the garbage collector. The setting is never thread local. level has two different meanings:

1..2

Trace the start and end of each gc run.

3..

Additionally show info about the collected garbage, to aid hunting down garbage problems. This currently shows gc'd trampolines. Note that the output can be very bulky and is somewhat low-level technical. Also note that pike currently has to be configured with --with-rtldebug to enable this.

Parameter all_threads

Trace levels are normally thread local, so changes affect only the current thread. To change the level in all threads, pass a nonzero value in this argument.

Returns

The old trace level in the current thread is returned.