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 |
Profiling lpro_model<br>lpro_model = CREATE Profiling<br>ib_cancel = FALSE<br>lpro_model.SetTraceFileName(is_fileName )<br> <br>open(w_progress)<br>// call the of_init window function to initialize<br>// the w_progress window<br>w_progress.of_init(lpro_model.numberofactivities, &<br>   'Building Model', this, 'ue_cancel')<br> <br>// Build the call graph model<br>lpro_model.BuildModel(this, 'ue_progress', 5)<br> <br>// clicking the cancel button in w_progress<br>// sets ib_cancel to TRUE and<br>// returns FALSE to ue_progress<br>IF ib_cancel THEN &<br>   close(w_progress)<br>   RETURN -1<br>END IF |