title: Julia: How to profile parallel code
body: <p>Whats an appropriate way to profile parallel code in julia? When I run </p>
  
  <pre><code>@profile foo(...) 
  </code></pre>
  
  <p>where foo is my function, I get</p>
  
  <pre><code>julia&gt; Profile.print()
  1234 task.jl; anonymous; line: 23
   4    multi.jl; remotecall_fetch; line: 695
    2 multi.jl; send_msg_; line: 172
     2 serialize.jl; serialize; line: 74
      2 serialize.jl; serialize; line: 299
       2 serialize.jl; serialize; line: 130
        2 serialize.jl; serialize; line: 299
         1 dict.jl; serialize; line: 369
          1 serialize.jl; serialize_type; line: 278
         1 serialize.jl; serialize; line: 199
          1 serialize.jl; serialize; line: 227
           1 serialize.jl; serialize; line: 160
            1 serialize.jl; serialize; line: 160
             1 serialize.jl; serialize; line: 299
              1 serialize.jl; serialize; line: 294
               1 io.jl; write; line: 47
                1 ./iobuffer.jl; write; line: 234
                 1 ./iobuffer.jl; ensureroom; line: 151
                  1 ./array.jl; resize!; line: 503
    2 multi.jl; send_msg_; line: 178
     2 stream.jl; write; line: 724
   1230 multi.jl; remotecall_fetch; line: 696
    1230 ./multi.jl; wait_full; line: 595
     1230 ./task.jl; wait; line: 189
      1229 ./task.jl; wait; line: 269
       1229 ./stream.jl; process_events; line: 529
      1    ./task.jl; wait; line: 282
       1 ./stream.jl; process_events; line: 529
  402  task.jl; anonymous; line: 95
   402 REPL.jl; eval_user_input; line: 53
    401 profile.jl; anonymous; line: 14
     401 ...mba/src/model/mcmc.jl; mcmc; line: 314
      401 ./task.jl; sync_end; line: 306
       401 task.jl; wait; line: 48
        401 ./task.jl; wait; line: 189
         401 ./task.jl; wait; line: 269
          401 ./stream.jl; process_events; line: 529
    1   profile.jl; anonymous; line: 16
  217  task.jl; task_done_hook; line: 83
   217 ./task.jl; wait; line: 269
    217 ./stream.jl; process_events; line: 529
  </code></pre>