Mary Aranda Cabezas wrote:
Even nonencounter way to measure the time correctly, since {Property.get ' time.total'} or not to take care it or also is inconsistent. Somebody can explain to me that it really measures the time shown in the Oz explorer.

I am not sure to understand your English, but here is my guess.

{Property.get 'time.total'} is not a faithful way to measure the time for some computation. If you have several processes running in your operating system, this time will increase, even if the time spend by the processor on your program does not change. Moreover, if your program uses much memory, it may cause some virtual memory swapping by the system, which of course takes time.

In order to reflect the time spend by the processor on your program, you should consider the 'user' time, and the 'system' time. The time given by the Explorer is probably the sum of both. Here is how I usually measure performance in my programs:

local T0 T1 in
   T0={Property.get time}
   ...                        % your computation here
   T1={Property.get time}
   {Show (T1.user+T1.system)-(T0.user+T0.system)}
end

Another point is that Mozart is concurrent. When your program runs, there may be many threads involved. And the order in which they are scheduled can make performance vary a bit. That is why you should always average your measurements.

{Explorer.object add(statistics
                     proc {$ I R}
                        {Inspector.inspect {Record.subtractList R [start shape 
b]}}
                        T = {Record.subtractList R [start shape b]}
                        Li = {Record.toList T}
                        Ch = {List.nth Li 1}
                        Depth = {List.nth Li 2}
                        Fa = {List.nth Li 3}
                        Su = {List.nth Li 4}
                        F={New Open.file
                           init(name:'ours.txt'
                                flags:[write text append]
                                mode:mode(owner:[read write]
                                          group:[read write]))}
                        {F 
write(vs:'\n'#Ch#'\t\t'#Fa#'\t\t'#Su#'\t\t'#Depth#'\n')}
                        {F close}
                     end
                     label: 'ESCRIBIR')}

Two comments: (1) you have to learn how to use records, and (2) the procedure above can only run once, because the variables in it are not local! This one will work better:

{Explorer.object
 add(statistics
     proc {$ I R}
        F={New Open.file
           init(name:'ours.txt'
                flags:[write text append]
                mode:mode(owner:[read write] group:[read write]))}
        Ch = R.c       % select number of choice nodes
        Fa = R.f       % select number of failed nodes
        Su = R.s       % select number of solved nodes
        De = R.depth   % select depth of current subtree
     in
        {F write(vs:'\n'#Ch#'\t\t'#Fa#'\t\t'#Su#'\t\t'#De#'\n')}
        {F close}
     end
     label: 'ESCRIBIR')}

Cheers,
raph

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to