Thanks, Tim. The reason I can't run specific lines from the test file is 
that the test needs to call module B first to get something which will be 
passed as argument to a function in module A and it is this function that 
I'm testing. Here is what it looks like:

Module A:
module A
import B
    function f(p)
        ...
        B.g()
        ...
    end
end



Module B:
module B
    function g()
        ...
        return p
    end
end

test file:

import A, B
p = B.g()
A.f(p)


I want to see how many times B.g() is called by A only or how much the 
computation of B.g() is triggered by module A/A.f() only, instead of by A 
and the test. Hope that I have made my point clear.




On Tuesday, July 5, 2016 at 3:43:16 PM UTC+1, Tim Holy wrote:
>
> Ah. Can't you just run specific lines from that test file? You could even 
> copy 
> it and then delete the irrelevant lines using an editor, if you need to 
> run 
> many tests. 
>
> --Tim 
>
> On Tuesday, July 5, 2016 7:03:07 AM CDT [email protected] <javascript:> 
> wrote: 
> > Tim, Thanks. 
> > 
> > The problem is this: I wrote a module A and made a test to test module 
> A. 
> > But both of module A and the test itself need to call another module B 
> > frequently. I want to see how A is calling B and don't care how the test 
> is 
> > calling B. That's why I want to separate the profiling of module A from 
> > that of both. This way I can easily the profiling via 
> > 
> > julia> Profile.print(format=:flat, sortedby=:count) 
> > 
> > Sorry for my dumb question. 
> > 
> > On Tuesday, July 5, 2016 at 12:49:37 PM UTC+1, Tim Holy wrote: 
> > > I don't know what "profiling a module" means. You profile running 
> code, 
> > > wherever 
> > > that code happens to live---and that's all there is to say. To profile 
> the 
> > > code 
> > > in a module, you just have to write code that exercises the functions 
> in 
> > > the 
> > > module. 
> > > 
> > > The meaning of the numbers is described here: 
> > > http://docs.julialang.org/en/stable/manual/profile/#basic-usage 
> > > The key words are "sampling profiler," the meaning of which is 
> described 
> > > at the 
> > > top of that page (and see the wikipedia link). The number of samples 
> is 
> > > approximately proportional to the cost of the line (or its 
> descendents). 
> > > 
> > > Best, 
> > > --Tim 
> > > 
> > > On Tuesday, July 5, 2016 4:40:32 AM CDT [email protected] 
> <javascript:> 
> > > 
> > > wrote: 
> > > > Bump up. 
> > > > 
> > > > On Monday, July 4, 2016 at 4:33:53 PM UTC+1, [email protected] 
> wrote: 
> > > > > I want to profile a module which is tested by a test. Following 
> the 
> > > > > documentation ( 
> > > 
> > > 
> http://docs.julialang.org/en/release-0.4/manual/profile/#options-for-contr 
> > > 
> > > > > olling-the-display-of-profile-results), I know how to profile them 
> > > 
> > > (module 
> > > 
> > > > > + test) together: 
> > > > > 
> > > > > @profile include("test.jl") 
> > > > > 
> > > > > 
> > > > > But I have no idea for how to do the profiling only for the 
> module. 
> > > > > 
> > > > > A second question is about the first number of each line in 
> profiler's 
> > > > > output. For example, the output from Julia Documentation: 
> > > > > 
> > > > > julia> Profile.print() 
> > > > > 
> > > > >       23 client.jl; _start; line: 373 
> > > > >       
> > > > >         23 client.jl; run_repl; line: 166 
> > > > >         
> > > > >            23 client.jl; eval_user_input; line: 91 
> > > > >             
> > > > >               23 profile.jl; anonymous; line: 14 
> > > > >               
> > > > >                  8  none; myfunc; line: 2 
> > > > >                   
> > > > >                   8 dSFMT.jl; dsfmt_gv_fill_array_close_open!; 
> line: 
> > > 128 
> > > 
> > > > >                  15 none; myfunc; line: 3 
> > > > >                   
> > > > >                   2  reduce.jl; max; line: 35 
> > > > >                   2  reduce.jl; max; line: 36 
> > > > >                   11 reduce.jl; max; line: 37 
> > > > > 
> > > > > Is it appropriate to interpret the numbers 23, 8, 15, etc as the 
> > > 
> > > number of 
> > > 
> > > > > times the line is run or the time has been spent (relatively) on 
> that 
> > > > > line? 
> > > > > 
> > > > > 
> > > > > I searched the group and there is no threads with a similar topic. 
> Any 
> > > > > comments? Thanks! 
>
>
>

Reply via email to