Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allocation profiler #42768

Merged
merged 112 commits into from
Jan 19, 2022
Merged

Commits on Jan 7, 2022

  1. alloc profiler

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    b49dd24 View commit details
    Browse the repository at this point in the history
  2. fix key

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    2fe1678 View commit details
    Browse the repository at this point in the history
  3. don't skip stdlib

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    c370f5a View commit details
    Browse the repository at this point in the history
  4. rename

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    b8cffd3 View commit details
    Browse the repository at this point in the history
  5. record freed values

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    c733cd6 View commit details
    Browse the repository at this point in the history
  6. print frees by type

    strangely empty
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    964a8a4 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    aed5f5d View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    665cacd View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    7ed832e View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    371bb96 View commit details
    Browse the repository at this point in the history
  11. delete destructors and constructors

    gonna try unique_ptr
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    c8452ce View commit details
    Browse the repository at this point in the history
  12. use unique_ptr

    not sure it's actually freeing, but at least it doesn't crash
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    2d9ec5b View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    5cd096a View commit details
    Browse the repository at this point in the history
  14. move more to the stdlib

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    04e2b17 View commit details
    Browse the repository at this point in the history
  15. start hacking on _reformat_bt

    adapted from Tim's PR
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    77ce036 View commit details
    Browse the repository at this point in the history
  16. fix decoding

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    33dde11 View commit details
    Browse the repository at this point in the history
  17. get alloc size and type address

    next up: load actual type
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    07d1009 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    6ec2fd0 View commit details
    Browse the repository at this point in the history
  19. send type names over to the Julia side

    kind of annoying, but it doesn't seem we can reliably load them from
    the addresses without segfaulting
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    f5f1be2 View commit details
    Browse the repository at this point in the history
  20. package up frees as well

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    9fe1ad2 View commit details
    Browse the repository at this point in the history
  21. try to fix

    but I think the problem is that the strings are being GC'd
    
    cuz they're not rooted
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    f768234 View commit details
    Browse the repository at this point in the history
  22. malloc strings so they're not junk by the time we look at them

    this works, but all the strings leak
    ugh C is hard
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    b11a0fe View commit details
    Browse the repository at this point in the history
  23. implement caching of stack trace lookups

    like the Profile does, and the C++ side did before
    
    wonder if we can move this into stacktraces.jl or something to
    dedup with Profile
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    c1faa44 View commit details
    Browse the repository at this point in the history
  24. add GC.@preserve, magically fixing segfaults (???)

    also change Julia representation of raw backtrace elements,
    thogh I'm not sure it was breaking anything
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    671b88e View commit details
    Browse the repository at this point in the history
  25. delete code to stringify type names on C++ side

    thanks to GC.@preserve <3
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    6932831 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    e164cc8 View commit details
    Browse the repository at this point in the history
  27. Mark the AllocProfile C code as JL_NOTSAFEPOINT

    TODO: is this correct!?
    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    c736dbc View commit details
    Browse the repository at this point in the history
  28. print incr. vs full

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    9407a91 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    f297d94 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    50dcb63 View commit details
    Browse the repository at this point in the history
  31. remove gc.preserve

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    976d2bc View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    e1b2221 View commit details
    Browse the repository at this point in the history
  33. clear after decoding

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    03a0102 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    7975c77 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    2c84bb9 View commit details
    Browse the repository at this point in the history
  36. tweaks

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    b49606d View commit details
    Browse the repository at this point in the history
  37. hold onto vectors

    d'oh
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    84745bf View commit details
    Browse the repository at this point in the history
  38. fix some compile errors

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    a03cfe3 View commit details
    Browse the repository at this point in the history
  39. Remove file println debugging

    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    79427ca View commit details
    Browse the repository at this point in the history
  40. Add precompile statements to AllocProfile package

    This _drastically_ speeds up the tests, for reasons I don't exactly
    understand.. I wonder if it was messing up some heuristics and deciding
    to interpret the code instead of compiling it, and had some weird
    corneer cases in the interpreted code or something? I dunno!
    
    But anyway, this drastically speeds it up, so 🤷 sounds like not our
    problem 😊
    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    9f63529 View commit details
    Browse the repository at this point in the history
  41. add comment about precompilation

    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    7d12971 View commit details
    Browse the repository at this point in the history
  42. Malloc right-sized buffers for backtraces.

    Instead of allocating a maximum-sized buffer for each backtrace, we keep
    a single max-sized buffer as a scratch space, write the backtrace to it,
    and then once we know the size, we allocate a right-sized buffer for the
    backtrace and copy it over.
    
    Benchmark results (measured time for profiling allocations on internal
    Arroyo benchmark, with `skip_every=0`):
    
    This only slightly improves the time to record an alloctions profile:
    - Before: 275.082525 seconds
    - After: 245.891006 seconds
    
    But it drastically improves the memory usage once the profiling is
    completed, according to System Activity Monitor:
    - Before: 17.35 GB
    - After: 6.92 GB
    - (Compared to 350 MB for the same task without profiling)
    
    We could probably slightly improve the time overhead still furthur by
    using a single big vector instead of a bunch of individual allocated
    buffers, but this is probably about the best we could do in terms of
    space usage. This would allow us to eliminate the redundant copying, and
    would also amortize away the allocations of the buffers, both of which
    should reduce the performance impact. But I'm guessing the time is
    mostly dominated by just how long the stack traces are, and there's no
    getting around that. At best, we could expect maybe like a 2x-3x
    improvement from those changes, I think.
    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    a26f375 View commit details
    Browse the repository at this point in the history
  43. test that we get a free

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    b5ab611 View commit details
    Browse the repository at this point in the history
  44. Configuration menu
    Copy the full SHA
    d53afa2 View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    9de01c6 View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    cdabd0e View commit details
    Browse the repository at this point in the history
  47. fix whitespace

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    ba3c0c8 View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    ddf945c View commit details
    Browse the repository at this point in the history
  49. remove debug logs

    I think these were added to find why it was slow, which was fixed by the
    __precompile__, so we don't need them anymore?
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    e2a8ba3 View commit details
    Browse the repository at this point in the history
  50. add multithreaded test

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    ad1b0e0 View commit details
    Browse the repository at this point in the history
  51. Configuration menu
    Copy the full SHA
    a712267 View commit details
    Browse the repository at this point in the history
  52. Configuration menu
    Copy the full SHA
    ec6cc6f View commit details
    Browse the repository at this point in the history
  53. Configuration menu
    Copy the full SHA
    83ef9ea View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    44073ef View commit details
    Browse the repository at this point in the history
  55. remove unused struct

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    b3e5102 View commit details
    Browse the repository at this point in the history
  56. remove unused profile function

    the macro is preferred
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    0fd988b View commit details
    Browse the repository at this point in the history
  57. first hack at fetch API

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    0119ce3 View commit details
    Browse the repository at this point in the history
  58. switch to uniform sampling with rand()

    instead of recording any N allocs
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    9d06356 View commit details
    Browse the repository at this point in the history
  59. small default sample rate

    Co-authored-by: Nathan Daly <NHDaly@gmail.com>
    vilterp and NHDaly committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    f0d7da4 View commit details
    Browse the repository at this point in the history
  60. update comment

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    cecf3a1 View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    545d06c View commit details
    Browse the repository at this point in the history
  62. Cleanups & comments & docstring

    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    e1f8684 View commit details
    Browse the repository at this point in the history
  63. Configuration menu
    Copy the full SHA
    7de1d5f View commit details
    Browse the repository at this point in the history
  64. Configuration menu
    Copy the full SHA
    7c862da View commit details
    Browse the repository at this point in the history
  65. remove pritnln

    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    2c271ab View commit details
    Browse the repository at this point in the history
  66. move structs to header

    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    2cb0a59 View commit details
    Browse the repository at this point in the history
  67. Configuration menu
    Copy the full SHA
    535c2fc View commit details
    Browse the repository at this point in the history
  68. Configuration menu
    Copy the full SHA
    af8931c View commit details
    Browse the repository at this point in the history
  69. Configuration menu
    Copy the full SHA
    f47253c View commit details
    Browse the repository at this point in the history
  70. remove garbage profile stuff

    the big dict is not worth the overhead for now
    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    423830d View commit details
    Browse the repository at this point in the history
  71. remove unordered_map

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    4a86866 View commit details
    Browse the repository at this point in the history
  72. Fix typo after merge

    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    d02a5b6 View commit details
    Browse the repository at this point in the history
  73. Finish comment

    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    bfd6210 View commit details
    Browse the repository at this point in the history
  74. fix typo

    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    ff00317 View commit details
    Browse the repository at this point in the history
  75. Configuration menu
    Copy the full SHA
    e07e67d View commit details
    Browse the repository at this point in the history
  76. Configuration menu
    Copy the full SHA
    ed4cb44 View commit details
    Browse the repository at this point in the history
  77. Configuration menu
    Copy the full SHA
    c27971b View commit details
    Browse the repository at this point in the history
  78. small test cleanups

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    48261b5 View commit details
    Browse the repository at this point in the history
  79. Configuration menu
    Copy the full SHA
    43276f4 View commit details
    Browse the repository at this point in the history
  80. Add test for start stop fetch clear

    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    8062b72 View commit details
    Browse the repository at this point in the history
  81. Configuration menu
    Copy the full SHA
    aeec3b6 View commit details
    Browse the repository at this point in the history
  82. print warning message

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    00bb947 View commit details
    Browse the repository at this point in the history
  83. Update stdlib/Profile/src/Allocs.jl

    Capitalization.
    NHDaly authored and vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    d3d868f View commit details
    Browse the repository at this point in the history
  84. Configuration menu
    Copy the full SHA
    d352a80 View commit details
    Browse the repository at this point in the history
  85. remove unordered_map import

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    3aaa9d9 View commit details
    Browse the repository at this point in the history
  86. first crack at docs

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    db64f63 View commit details
    Browse the repository at this point in the history
  87. add news

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    5c25bcd View commit details
    Browse the repository at this point in the history
  88. Apply suggestions from code review

    Fixup some small typos and formatting changes
    NHDaly authored Jan 7, 2022
    Configuration menu
    Copy the full SHA
    4fec8dd View commit details
    Browse the repository at this point in the history
  89. PR feedback

    vilterp committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    9a4b7fb View commit details
    Browse the repository at this point in the history
  90. Configuration menu
    Copy the full SHA
    5dc2beb View commit details
    Browse the repository at this point in the history
  91. Merge pull request #13 from vilterp/pv-alloc-profile-docs

    alloc profiler: add docs and news
    vilterp authored Jan 7, 2022
    Configuration menu
    Copy the full SHA
    830e2ad View commit details
    Browse the repository at this point in the history

Commits on Jan 11, 2022

  1. Configuration menu
    Copy the full SHA
    cd14357 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #16 from vilterp/pv-alloc-profile-style-renames

    alloc profiler: rename structs to match Julia C style
    vilterp authored Jan 11, 2022
    Configuration menu
    Copy the full SHA
    0f39d48 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e98589b View commit details
    Browse the repository at this point in the history
  4. remove some debug printlns

    vilterp committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    107ece0 View commit details
    Browse the repository at this point in the history
  5. PR feedback

    Co-Authored-By: NHDaly@gmail.com
    vilterp committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    c4bebea View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    f4f1a62 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    452c7cd View commit details
    Browse the repository at this point in the history
  8. remove @shows

    vilterp committed Jan 11, 2022
    Configuration menu
    Copy the full SHA
    3f219c7 View commit details
    Browse the repository at this point in the history
  9. Merge pull request #15 from vilterp/pv-alloc-profile-allocs-missed

    alloc profile: print percentage of allocs missed
    vilterp authored Jan 11, 2022
    Configuration menu
    Copy the full SHA
    b25005a View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2022

  1. record string allocs

    vilterp committed Jan 12, 2022
    Configuration menu
    Copy the full SHA
    bf08801 View commit details
    Browse the repository at this point in the history
  2. add string test

    vilterp committed Jan 12, 2022
    Configuration menu
    Copy the full SHA
    8ec194b View commit details
    Browse the repository at this point in the history
  3. Merge pull request #18 from vilterp/pv-alloc-profile-record-strings

    alloc profile: record string allocs
    vilterp authored Jan 12, 2022
    Configuration menu
    Copy the full SHA
    41f169c View commit details
    Browse the repository at this point in the history
  4. alloc profiler: avoid divide-by-zero errors (#19)

    * avoid divide-by-zero errors when printing error message
    vilterp authored Jan 12, 2022
    Configuration menu
    Copy the full SHA
    3fc80ac View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2022

  1. add paragraph about missed allocations

    Co-authored-by: Nathan Daly <NHDaly@gmail.com>
    vilterp and NHDaly authored Jan 13, 2022
    Configuration menu
    Copy the full SHA
    9465507 View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2022

  1. use !!! note style in comment

    vilterp committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    76ad6f0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    dd693cc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4deaf6c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    13a85de View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    68e1a15 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b5f636a View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2022

  1. remove superfluous whitespace

    vilterp committed Jan 19, 2022
    Configuration menu
    Copy the full SHA
    b16b610 View commit details
    Browse the repository at this point in the history