TraceBegin PowerScript function
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
|
1 |
<span>TraceBegin</span> ( <span>identifier</span> ) |
|
Argument |
Description |
|---|---|
|
identifier |
A read-only string, logged to the trace |
Return Values
ErrorReturn. Returns one of the following values:
-
Success! – The function
succeeded -
FileNotOpenError! – TraceOpen has not been
called yet -
TraceStartedError! – TraceBegin has already
been called
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
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:
|
1 |
TimerKind ltk_kind |
|
1 |
|
1 |
CHOOSE CASE ddlb_timestamp.text |
|
1 |
CASE "None" |
|
1 |
ltk_kind = TimerNone! |
|
1 |
CASE "Clock" |
|
1 |
ltk_kind = Clock! |
|
1 |
CASE "Process" |
|
1 |
ltk_kind = Process! |
|
1 |
CASE "Thread" |
|
1 |
ltk_kind = Thread! |
|
1 |
END CHOOSE |
|
1 |
|
1 |
TraceOpen(sle_filename.text,ltk_kind) |
|
1 |
TraceEnableActivity(ActESQL!) |
|
1 |
TraceEnableActivity(ActGarbageCollect!) |
|
1 |
TraceEnableActivity(ActObjectCreate!) |
|
1 |
TraceEnableActivity(ActObjectDestroy!) |
|
1 |
|
1 |
<span>TraceBegin</span>("Trace_block_1") |