Bill Allombert on Mon, 22 May 2023 08:52:36 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Intermediate time in MT environment


On Mon, May 22, 2023 at 12:46:59AM +0200, Jean-Luc Arnaud wrote:
> Hi all,
> 
> I'd like to know if there is a way to obtain intermediate CPU and real time
> in a MultiThreaded environment.
> 
> For example:
> 
> pareval([ ()->myfunc1;## , ()->myfunc2;## ])
> 
> I know this does not work, I tested it!

You should use getabstime and getwalltime

time()=[getabstime(),getwalltime()]
export(time);
{
  pareval([ ()->my(t=time());myfunc1;time()-t,
            ()->my(t=time());myfunc2;time()-t])
}

Cheers,
Bill.