1 / 10

Memory debugging Recipe profiling

Memory debugging Recipe profiling. Jonas M. Larsen. Memory debugging valgrind. > valgrind a.out. Memory debugging valgrind. Memory errors sometimes make programs crash. Other times they don't!. Use a memory debugger regularly (valgrind, gdb, ...). Profiling. Reasons to optimize

duy
Télécharger la présentation

Memory debugging Recipe profiling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Memory debuggingRecipe profiling Jonas M. Larsen

  2. Memory debuggingvalgrind • > valgrind a.out

  3. Memory debuggingvalgrind • Memory errors sometimes make programs crash. Other times they don't! Use a memory debugger regularly (valgrind, gdb, ...)

  4. Profiling • Reasons to optimize • The pipeline must process at about the same speed as observations are performed • Trade-off: Science quality vs. execution speed • Reasons not to optimize • “slow” can be “fast enough” • Trade-off: CPU cycles vs. human brain cycles • Trade-off: Design vs. speed • Measure before you optimize!

  5. Profilingprofile_build • > profile_build -qfitssrc=~/qfits-6.2.0 -cplsrc=~/cpl-3.1.0 -esorexsrc=~/esorex-3.6.1 -iiinstrumentsrc=~/xshp -builddir=~/BUILD -iiinstrumentlib=xsh xsh_mbias • > ~/BUILD/bin/esorex xsh_mbias xsh_mbias.sof • > gprof ~/BUILD/bin/esorex • > gcov my_source_file.c

  6. ProfilingGCC gprof • GCC gprof

  7. ProfilingGCC gcov • GCC gcov Use profiling tools (gprof, gcov, Shark, ...)

  8. ProfilingAsymptotic time complexity • Example: Looping through a FITS header O(n^3) O(n^2) O(n)

  9. Profiling • Constant factor optimization • Measure before you optimize!

  10. Profiling • If n is large, be careful about... • Reference: http://www.eso.org/~jmlarsen/pipeline

More Related