I'm not sure there's currently a way to get CPU time directly, although it's 
just a couple ccalls so it wouldn't be hard to implement.

Out of curiosity, why do you want it? CPU time is often quite misleading; for 
a multithreaded operation, it sums all the time used by all the cores. 
Consequently, taking it at face value can lead you to think that your fast, 
multithreaded calculation takes _longer_ than a slower single-threaded 
implementation. I've encountered quite a few Matlab users who think repmat is 
faster than bsxfun simply because the profiler told them that was true.

Following a dim memory, I see that I seem to have found this important enough 
that I memorialized it in my startup.m file, for which the entire contents are:

    if exist('distinguishable_colors','file')
      set(0,'DefaultAxesColorOrder',distinguishable_colors(20));
    end
    % Put the profiler into a mode where it uses elapsed time rather than CPU
    % time (which is messed up for multicore machines)
    profile -timer real

Best,
--Tim

On Wednesday, February 03, 2016 12:28:28 PM Lytu wrote:
> Hello Julia users,
> 
> Can someone tell me what's the equivalent of matlab elapsed cputime in Julia
> 
> For example i Matlab, we can do this:
> 
>    t = cputime;
>    x=4;
> 
>    iter = 1;
> 
>    z = ones(1,4);
> 
>    y=x*2*z;
> 
> e = cputime-t
> 
> 
> But in Julia i don't seem to find how to do this. I thought i can use
> 
>    t=time()
> 
>    x=4;
> 
>    iter = 1;
> 
>    z = ones(1,4);
> 
>    y=x*2*z;
> 
>    e=time()-t
> 
> 
> But time() in Julia is not the elapsed CPU time, it's a wall clock time.
> 
> 
> Can someone help me?
> 
> 
> Thank you

Reply via email to