timholy / IProfile.jl

Profilers for Julia
MIT License
18 stars 15 forks source link

ERROR: max: argument is empty #11

Closed diegozea closed 11 years ago

diegozea commented 11 years ago

I don't know if I'm doing something wrong or if this is a bug:

julia> compare([g,h],1000)
2x4 DataFrame:
            Function   Elapsed Relative Replications
[1,]    "# function"  0.041733  2.69598         1000
[2,]    "# function" 0.0154797      1.0         1000

julia> using SProfile

julia> @sprofile g()
0.5021

julia> sprofile_tree()
ERROR: max: argument is empty
 in max at abstractarray.jl:1346
 in sprof_tree_format at /home/dzea/.julia/Profile/src/sprofile.jl:190
 in sprof_tree_format at /home/dzea/.julia/Profile/src/sprofile.jl:223
 in sprofile_tree at /home/dzea/.julia/Profile/src/sprofile.jl:265
 in sprofile_tree at /home/dzea/.julia/Profile/src/sprofile.jl:286
 in sprofile_tree at /home/dzea/.julia/Profile/src/sprofile.jl:288
 in sprofile_tree at /home/dzea/.julia/Profile/src/sprofile.jl:291

julia> versioninfo(true)
Julia Version 0.2.0-714.r1840
Commit 184054dcde 2013-03-24 16:23:04
Platform Info:
  OS_NAME: Linux
           Ubuntu 12.10
  uname: Linux 3.5.0-26-generic #42-Ubuntu SMP Fri Mar 8 23:18:20 UTC 2013 x86_64 x86_64
Memory: 15.638431549072266 GB (11301.98046875 MB free)
Uptime: 58356.806359009 sec
Load Avg:  0.224609  0.210449  0.150391
Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz: 
       speed         user         nice          sys         idle          irq
#1  3300 MHz     223610 s       1298 s      56153 s    5494683 s          2 s
#2  1600 MHz     229801 s        857 s      60786 s    5488029 s          0 s
#3  1600 MHz     223176 s        943 s      51371 s    5508143 s          0 s
#4  1600 MHz     216520 s        848 s      50901 s    5515401 s          0 s
#5  3401 MHz      58545 s         80 s      12117 s    5757773 s          0 s
#6  1600 MHz      56604 s        210 s       7480 s    5767208 s          0 s
#7  1600 MHz      55184 s        142 s       7990 s    5767063 s          0 s
#8  1600 MHz      52450 s        188 s       7566 s    5770703 s          0 s
Using: (64-bit interface)
  Blas: libopenblas
  Lapack: libopenblas
  Libm: libopenlibm
Environment:
  TERM = xterm
  LIBRARY_PATH = :/opt/AMDAPP/lib/x86_64/
  LD_LIBRARY_PATH = :/opt/AMDAPP/lib/x86_64/
  LIBGL_DRIVERS_PATH = /usr/lib/fglrx/dri:/usr/lib32/fglrx/dri
  XDG_SESSION_PATH = /org/freedesktop/DisplayManager/Session0
  XDG_SEAT_PATH = /org/freedesktop/DisplayManager/Seat0
  DEFAULTS_PATH = /usr/share/gconf/ubuntu.default.path
  PATH = /home/dzea/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/dzea/bin:/home/dzea/bin/scripts:/home/dzea/bin/mi_soft/bin:/home/dzea/bin/stride
  C_INCLUDE_PATH = :/opt/AMDAPP/include/
  MANDATORY_PATH = /usr/share/gconf/ubuntu.mandatory.path
  HOME = /home/dzea
  COMPIZ_BIN_PATH = /usr/bin/
  PROFILEHOME = 

Packages Installed:
Benchmark        0.0.0
BioSeq           0.0.0 (dirty)
DataFrames       0.2.0
GZip             0.0.0
Gadfly           0.0.0
Profile          0.2.0
Options          0.2.0
Stats            0.2.0
ArgParse         0.2.0
Codecs           0.0.0
Compose          0.0.0
Distributions    0.0.0
Iterators        0.0.0
JSON             0.0.0
TextWrap         0.0.0
Cairo            0.0.0
Mustache         0.0.0
BinDeps          0.0.0
Color            0.0.0
timholy commented 11 years ago

Definitely a bug, fixed in cd999d0de4831a14ee4820bb03699bd8f39a690e

However, all this fix does is explain what happened: your function g() presumably runs very quickly. The sampling profiler by default takes a sample once per millisecond; if your running time is shorter than that, it does not capture any samples. This error was triggered when there were no samples. You can fix this with something like

@sprofile for i = 1:10000; g(); end
diegozea commented 11 years ago

Thanks Tim!!! I didn't know that.