Extracting information from the trace tree model
To extract information from a tree model, you can use the EntryList function
to create a list of top-level entries in the model and then loop
through the list, extracting information about each node. For each
node, determine its activity type using the TraceActivity enumerated
datatype, and then use the appropriate TraceTree object to extract
information.
Example: trace tree model
The following simple example extracts information from an
existing trace tree model and stores it in a structure:
|
1 |
TraceTreeNode ltctn_list[], ltctn_node<br>long ll_index, ll_limit<br>string ls_line <br>str_node lstr_node<br> <br>ltct_treemodel.EntryList(ltctn_list)<br>ll_limit = UpperBound(ltctn_list)<br>FOR ll_index = 1 to ll_limit   <br>   ltctn_node = ltctn_list[ll_index]<br>   of_dumpnode(ltctn_node, lstr_node)<br>   // insert code to handle display of<br>   // the information in the structure here<br>   ...<br>NEXT |
The of_dumpnode function takes
a TraceTreeNode object and a structure as arguments and populates
the structure with information about each node. The following code
shows part of the function:
|
1 |
string ls_exit, ls_label, ls_routinename<br>long ll_node_cnt<br>TraceTreeNode ltctn_list[]<br>errorreturn l_err<br> <br>astr_node.Children = FALSE<br>astr_node.Label = ''<br>IF NOT isvalid(atctn_node) THEN RETURN<br>CHOOSE CASE atctn_node.ActivityType<br>   CASE ActRoutine!<br>     TraceTreeRoutine ltctrt_routin   <br>     ltctrt_routine = atctn_node<br>     IF ltctrt_routine.Classname = '' THEN &<br>        ls_routinename = ltctrt_routine.ClassName + "."<br>     END IF   <br>     ls_routinename += ltctrt_routine.Name<br>     ltctrt_routine.GetChildrenList(ltctn_list)<br>     ll_node_cnt = UpperBound(ltctn_list)<br> <br>     ls_label = "Execute " + ls_routinename + ' :' + &<br>         space(ii_offset) + String(l_timescale * &<br>         (ltctrt_routine.ExitTimerValue - &<br>         ltctrt_routine.EnterTimerValue), '0.000000')<br>     astr_node.Children = (ll_node_cnt > 0)<br>     astr_node.Label = ls_label<br>     astr_node.Time = ltctrt_routine.EnterTimerValue<br>     RETURN<br>   CASE ActLine!<br>     TraceTreeLine tctln_treeLine   <br>     tctln_treeLine = atctn_node   <br>     ls_label = LINEPREFIX + &<br>        String(tctln_treeLine.LineNumber )<br>     astr_node.time = tctln_treeLine.Timervalue<br>     ...<br>     // CASE statements omitted<br>     ...<br>   CASE ELSE<br>     ls_label = "INVALID NODE"<br>   END CHOOSE<br> <br>   astr_node.label = ls_label<br>   RETURN |
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest