Using the BuildModel function to build a call graph
model
The call graph model that you create with the BuildModel
function contains all the routines in the trace file and can take a
long time to build. If you want to monitor the progress of the build
or you want to be able to interrupt it while the model is being
built, you can pass optional arguments to BuildModel.
BuildModel arguments
BuildModel takes three arguments: the name of an object of
type PowerObject, the name of a user event, and a long value
representing how often the user event should be triggered as a
percentage of the build completed.
The user event returns a boolean value and has two arguments:
the number of the current activity, and the total number of
activities in the trace file.
Destroying existing
models
Before you call BuildModel, you can call DestroyModel to clean
up any objects remaining from an existing model.
Example: building a call graph
model
In the following example, the user event argument to
BuildModel is called ue_progress and is triggered each time five
percent of the activities have been processed. The progress of the
build is shown in a window called w_progress that has a cancel
button.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Profiling lpro_model lpro_model = CREATE Profiling ib_cancel = FALSE lpro_model.SetTraceFileName(is_fileName ) open(w_progress) // call the of_init window function to initialize // the w_progress window w_progress.of_init(lpro_model.numberofactivities, & 'Building Model', this, 'ue_cancel') // Build the call graph model lpro_model.BuildModel(this, 'ue_progress', 5) // clicking the cancel button in w_progress // sets ib_cancel to TRUE and // returns FALSE to ue_progress IF ib_cancel THEN & close(w_progress) RETURN -1 END IF |