1 / 10

Memory Debugging and Profiling Techniques in Software Development

This comprehensive guide covers essential memory debugging and profiling techniques, emphasizing the importance of using tools like Valgrind and gdb. Learn how memory errors can affect program stability and the necessity of regular debugging. The discussion extends to profiling methodologies, highlighting the need to optimize program performance while balancing execution speed and quality of science. Key trade-offs between CPU efficiency and human cognitive processing are addressed, along with a reminder to measure before optimization. The guide includes practical examples and tools for effective profiling.

duy
Télécharger la présentation

Memory Debugging and Profiling Techniques in Software Development

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