TraceBegin

Description

Inserts an activity type value in the trace file indicating that logging has begun and then starts logging all the enabled application trace activities. Before calling TraceBegin, you must have opened the trace file using the TraceOpen function.

Syntax

TraceBegin ( identifier )

Argument

Description

identifier

A read-only string, logged to the trace file, used to identify a tracing block. If identifier is null, an empty string is placed in the trace file.

Returns

ErrorReturn. Returns one of the following values:

Usage

The TraceBegin call inserts an activity type value of ActBegin! in the trace file to indicate that logging has begun and then begins logging all the application activities you have selected for tracing.

TraceBegin can only be called following a TraceOpen call. And all activities to be logged must be enabled using the TraceEnableActivity function before calling TraceBegin.

If you want to generate a trace file for an entire application run, you typically include the TraceBegin function in your application’s open script. If you want to generate a trace file for only a portion of the application run, you typically include the TraceBegin function in the script that initiates the functionality on which you’re trying to collect data.

You can use the identifier argument to identify the tracing blocks within a trace file. A tracing block represents the data logged between calls to TraceBegin and TraceEnd. There may be multiple tracing blocks within a single trace file if you are tracing more than one portion of the application run.

Examples

Example 1

This example opens a trace file with the name you entered in a single line edit box and a timer kind selected from a drop-down list. It then begins logging the enabled activities for the first block of code to be traced:

TimerKind ltk_kind


CHOOSE CASE ddlb_timestamp.text

CASE "None"

      ltk_kind = TimerNone!

CASE "Clock"

      ltk_kind = Clock!

CASE "Process"

      ltk_kind = Process!

CASE "Thread"

      ltk_kind = Thread!

END CHOOSE


TraceOpen(sle_filename.text,ltk_kind)


TraceEnableActivity(ActESQL!)

TraceEnableActivity(ActGarbageCollect!)

TraceEnableActivity(ActObjectCreate!)

TraceEnableActivity(ActObjectDestroy!)


TraceBegin("Trace_block_1")

See also