ruby_memprofiler_pprof 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +4 -4
  2. data/ext/ruby_memprofiler_pprof_ext/collector.c +803 -0
  3. data/ext/ruby_memprofiler_pprof_ext/compat.c +184 -0
  4. data/ext/ruby_memprofiler_pprof_ext/compile_commands.json +1 -0
  5. data/ext/ruby_memprofiler_pprof_ext/extconf.rb +152 -0
  6. data/ext/ruby_memprofiler_pprof_ext/pprof.upb.c +199 -0
  7. data/ext/ruby_memprofiler_pprof_ext/pprof.upb.h +924 -0
  8. data/ext/ruby_memprofiler_pprof_ext/pprof_out.c +430 -0
  9. data/ext/ruby_memprofiler_pprof_ext/ruby_hacks.c +118 -0
  10. data/ext/ruby_memprofiler_pprof_ext/ruby_memprofiler_pprof.c +10 -0
  11. data/ext/ruby_memprofiler_pprof_ext/ruby_memprofiler_pprof.h +183 -0
  12. data/ext/ruby_memprofiler_pprof_ext/ruby_private/ruby26/gc_private.h +324 -0
  13. data/ext/ruby_memprofiler_pprof_ext/ruby_private/ruby27/gc_private.h +339 -0
  14. data/ext/ruby_memprofiler_pprof_ext/ruby_private/ruby30/gc_private.h +361 -0
  15. data/ext/ruby_memprofiler_pprof_ext/ruby_private/ruby31/gc_private.h +374 -0
  16. data/ext/ruby_memprofiler_pprof_ext/ruby_private.h +31 -0
  17. data/ext/ruby_memprofiler_pprof_ext/sample.c +43 -0
  18. data/ext/ruby_memprofiler_pprof_ext/vendor/backtracie/backtracie.h +268 -0
  19. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/BUILD +0 -0
  20. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/CONTRIBUTING.md +0 -0
  21. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/DESIGN.md +0 -0
  22. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/LICENSE +0 -0
  23. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/README.md +0 -0
  24. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/WORKSPACE +0 -0
  25. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/BUILD +0 -0
  26. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/amalgamate.py +0 -0
  27. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/build_defs.bzl +0 -0
  28. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/lua.BUILD +0 -0
  29. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/protobuf.patch +0 -0
  30. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/py_proto_library.bzl +0 -0
  31. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/python_downloads.bzl +0 -0
  32. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/system_python.bzl +0 -0
  33. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/upb_proto_library.bzl +0 -0
  34. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/bazel/workspace_deps.bzl +0 -0
  35. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/BUILD +0 -0
  36. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/BUILD.googleapis +0 -0
  37. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/benchmark.cc +0 -0
  38. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/build_defs.bzl +0 -0
  39. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/compare.py +0 -0
  40. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/descriptor.proto +0 -0
  41. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/descriptor_sv.proto +0 -0
  42. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/empty.proto +0 -0
  43. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/gen_protobuf_binary_cc.py +0 -0
  44. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/gen_synthetic_protos.py +0 -0
  45. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/benchmarks/gen_upb_binary_c.py +0 -0
  46. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/BUILD.bazel +0 -0
  47. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/README.md +0 -0
  48. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/build_defs.bzl +0 -0
  49. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/make_cmakelists.py +0 -0
  50. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/staleness_test.py +0 -0
  51. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/cmake/staleness_test_lib.py +0 -0
  52. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/docs/render.py +0 -0
  53. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/docs/style-guide.md +0 -0
  54. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/docs/vs-cpp-protos.md +0 -0
  55. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/docs/wrapping-upb.md +0 -0
  56. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/BUILD +0 -0
  57. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/convert.c +0 -0
  58. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/convert.h +0 -0
  59. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor.c +0 -0
  60. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor.h +0 -0
  61. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor_containers.c +0 -0
  62. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor_containers.h +0 -0
  63. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor_pool.c +0 -0
  64. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/descriptor_pool.h +0 -0
  65. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/dist/BUILD.bazel +0 -0
  66. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/dist/dist.bzl +0 -0
  67. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/extension_dict.c +0 -0
  68. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/extension_dict.h +0 -0
  69. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/map.c +0 -0
  70. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/map.h +0 -0
  71. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/message.c +0 -0
  72. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/message.h +0 -0
  73. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/minimal_test.py +0 -0
  74. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/BUILD +0 -0
  75. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/README.md +0 -0
  76. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/descriptor_database_test_wrapper.py +0 -0
  77. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/descriptor_pool_test_wrapper.py +0 -0
  78. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/descriptor_test_wrapper.py +0 -0
  79. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/generator_test_wrapper.py +0 -0
  80. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/json_format_test_wrapper.py +0 -0
  81. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/keywords_test_wrapper.py +0 -0
  82. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/message_factory_test_wrapper.py +0 -0
  83. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/message_test_wrapper.py +0 -0
  84. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/proto_builder_test_wrapper.py +0 -0
  85. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/pyproto_test_wrapper.bzl +0 -0
  86. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/reflection_test_wrapper.py +0 -0
  87. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/service_reflection_test_wrapper.py +0 -0
  88. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/symbol_database_test_wrapper.py +0 -0
  89. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/text_encoding_test_wrapper.py +0 -0
  90. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/text_format_test_wrapper.py +0 -0
  91. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/unknown_fields_test_wrapper.py +0 -0
  92. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/well_known_types_test_wrapper.py +0 -0
  93. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/pb_unit_tests/wire_format_test_wrapper.py +0 -0
  94. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/protobuf.c +0 -0
  95. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/protobuf.h +0 -0
  96. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/py_extension.bzl +0 -0
  97. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/python_api.h +0 -0
  98. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/repeated.c +0 -0
  99. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/repeated.h +0 -0
  100. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/unknown_fields.c +0 -0
  101. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/unknown_fields.h +0 -0
  102. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/python/version_script.lds +0 -0
  103. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/lunit/LICENSE +0 -0
  104. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/lunit/README.google +0 -0
  105. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/lunit/console.lua +0 -0
  106. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/lunit/lunit.lua +0 -0
  107. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/BUILD +0 -0
  108. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/LICENSE +0 -0
  109. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/naive.c +0 -0
  110. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/range2-neon.c +0 -0
  111. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/range2-sse.c +0 -0
  112. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/third_party/utf8_range/utf8_range.h +0 -0
  113. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/BUILD.bazel +0 -0
  114. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/README.md +0 -0
  115. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/def.c +0 -0
  116. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/lua_proto_library.bzl +0 -0
  117. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/main.c +0 -0
  118. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/msg.c +0 -0
  119. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/test.proto +0 -0
  120. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/test_upb.lua +0 -0
  121. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/upb.c +0 -0
  122. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/upb.h +0 -0
  123. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/upb.lua +0 -0
  124. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/bindings/lua/upbc.cc +0 -0
  125. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/collections.c +0 -0
  126. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/collections.h +0 -0
  127. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/conformance_upb.c +0 -0
  128. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/conformance_upb_failures.txt +0 -0
  129. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode.c +0 -0
  130. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode.h +0 -0
  131. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode_fast.c +0 -0
  132. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode_fast.h +0 -0
  133. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/decode_internal.h +0 -0
  134. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/def.c +0 -0
  135. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/def.h +0 -0
  136. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/def.hpp +0 -0
  137. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/empty.proto +0 -0
  138. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/encode.c +0 -0
  139. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/encode.h +0 -0
  140. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/fuzz/BUILD +0 -0
  141. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/fuzz/file_descriptor_parsenew_fuzzer.cc +0 -0
  142. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/json_decode.c +0 -0
  143. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/json_decode.h +0 -0
  144. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/json_encode.c +0 -0
  145. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/json_encode.h +0 -0
  146. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table.c +0 -0
  147. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table.h +0 -0
  148. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table.hpp +0 -0
  149. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_accessors.c +0 -0
  150. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_accessors.h +0 -0
  151. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_accessors_internal.h +0 -0
  152. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_accessors_test.cc +0 -0
  153. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/mini_table_test.cc +0 -0
  154. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg.c +0 -0
  155. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg.h +0 -0
  156. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg_internal.h +0 -0
  157. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg_test.cc +0 -0
  158. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/msg_test.proto +0 -0
  159. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/port_def.inc +0 -0
  160. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/port_undef.inc +0 -0
  161. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/reflection.c +0 -0
  162. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/reflection.h +0 -0
  163. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/reflection.hpp +0 -0
  164. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/table.c +0 -0
  165. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/table_internal.h +0 -0
  166. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test.proto +0 -0
  167. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test_cpp.cc +0 -0
  168. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test_cpp.proto +0 -0
  169. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test_generated_code.cc +0 -0
  170. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/test_table.cc +0 -0
  171. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/text_encode.c +0 -0
  172. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/text_encode.h +0 -0
  173. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/upb.c +0 -0
  174. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/upb.h +0 -0
  175. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/upb.hpp +0 -0
  176. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/upb_internal.h +0 -0
  177. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/BUILD +0 -0
  178. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/README.md +0 -0
  179. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/compare.c +0 -0
  180. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/compare.h +0 -0
  181. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/compare_test.cc +0 -0
  182. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto.c +0 -0
  183. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto.h +0 -0
  184. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_public_import_test.proto +0 -0
  185. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_regular_import_test.proto +0 -0
  186. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_test.cc +0 -0
  187. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_test.proto +0 -0
  188. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_weak_import_test.proto +0 -0
  189. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/def_to_proto_wweak_import_test.proto +0 -0
  190. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/required_fields.c +0 -0
  191. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/required_fields.h +0 -0
  192. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/required_fields_test.cc +0 -0
  193. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upb/util/required_fields_test.proto +0 -0
  194. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/BUILD +0 -0
  195. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/common.cc +0 -0
  196. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/common.h +0 -0
  197. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/protoc-gen-upb.cc +0 -0
  198. data/ext/{ruby_memprofiler_pprof → ruby_memprofiler_pprof_ext}/vendor/upb/upbc/protoc-gen-upbdefs.cc +0 -0
  199. data/lib/ruby_memprofiler_pprof/atfork.rb +1 -1
  200. data/lib/ruby_memprofiler_pprof/block_flusher.rb +48 -4
  201. data/lib/ruby_memprofiler_pprof/file_flusher.rb +13 -6
  202. data/lib/ruby_memprofiler_pprof/profile_app.rb +8 -12
  203. data/lib/ruby_memprofiler_pprof/profile_data.rb +7 -8
  204. data/lib/ruby_memprofiler_pprof/version.rb +1 -1
  205. data/lib/ruby_memprofiler_pprof.rb +5 -4
  206. data/libexec/ruby_memprofiler_pprof_profile +6 -6
  207. metadata +207 -200
  208. data/ext/ruby_memprofiler_pprof/backtrace.c +0 -429
  209. data/ext/ruby_memprofiler_pprof/collector.c +0 -1055
  210. data/ext/ruby_memprofiler_pprof/compat.c +0 -182
  211. data/ext/ruby_memprofiler_pprof/extconf.rb +0 -72
  212. data/ext/ruby_memprofiler_pprof/pprof.upb.c +0 -170
  213. data/ext/ruby_memprofiler_pprof/pprof.upb.h +0 -848
  214. data/ext/ruby_memprofiler_pprof/pprof_out.c +0 -285
  215. data/ext/ruby_memprofiler_pprof/ruby_memprofiler_pprof.c +0 -11
  216. data/ext/ruby_memprofiler_pprof/ruby_memprofiler_pprof.h +0 -301
  217. data/ext/ruby_memprofiler_pprof/strtab.c +0 -391
@@ -0,0 +1,268 @@
1
+ // backtracie: Ruby gem for beautiful backtraces
2
+ // Copyright (C) 2021 Ivo Anjo <ivo@ivoanjo.me>
3
+ //
4
+ // This file is part of backtracie.
5
+ //
6
+ // backtracie is free software: you can redistribute it and/or modify
7
+ // it under the terms of the GNU Lesser General Public License as published by
8
+ // the Free Software Foundation, either version 3 of the License, or
9
+ // (at your option) any later version.
10
+ //
11
+ // backtracie is distributed in the hope that it will be useful,
12
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ // GNU Lesser General Public License for more details.
15
+ //
16
+ // You should have received a copy of the GNU Lesser General Public License
17
+ // along with backtracie. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ #ifndef BACKTRACIE_PUBLIC_H
20
+ #define BACKTRACIE_PUBLIC_H
21
+
22
+ #include <ruby.h>
23
+ #include <stdbool.h>
24
+ #include <stdint.h>
25
+
26
+ // clang-format off
27
+ #if defined(_WIN32) || defined(_WIN64)
28
+ # ifdef BACKTRACIE_EXPORTS
29
+ # define BACKTRACIE_API __declspec(dllexport)
30
+ # else
31
+ # define BACKTRACIE_API __declspec(dllimport)
32
+ # endif
33
+ #else
34
+ # define BACKTRACIE_API __attribute__((visibility("default")))
35
+ #endif
36
+ // clang-format on
37
+
38
+ typedef struct {
39
+ // The first element of this struct is a bitfield, comprised of uint32_t's.
40
+ // Ruby requires that VALUE be at least 32-bit but not necessarily 64-bit;
41
+ // using uint32_t for the bitfield ensures we have a minimum of pointless
42
+ // padding in this struct no matter the system.
43
+
44
+ // 1 -> ruby frame / 0 -> cfunc frame
45
+ uint32_t is_ruby_frame : 1;
46
+ // 1 means self really is the self object, 0 means it's the class of the self.
47
+ uint32_t self_is_real_self : 1;
48
+ // The iseq & cme; one, both, or neither might actually be available; if
49
+ // they're not, they will be Qnil. These need to be GC marked if you wish to
50
+ // keep the location alive.
51
+ VALUE iseq;
52
+ VALUE callable_method_entry;
53
+ // This is either self, or rb_class_of(self), depending on a few thing.
54
+ // It will be the actual self object for the frame if
55
+ // - self is the toplevel binding,
56
+ // - self is rb_mRubyVMFrozenCore,
57
+ // - self is a class or module
58
+ // Otherwise, it will be rb_class_of(self).
59
+ // This is done so that, should the caller decide to retain the raw_location
60
+ // instance for a while, GC mark its VALUEs, and stringify the backtrace
61
+ // later, we both:
62
+ // - retain enough information to actually produce a good name for the
63
+ // method,
64
+ // - but also don't hold onto random objects that would otherwise be GC'd
65
+ // just because they happened to be in a backtrace.
66
+ // This needs to be marked if you wish to keep the location alive
67
+ VALUE self_or_self_class;
68
+ // Raw PC pointer; not much use to callers, but saved so we can calculate the
69
+ // lineno later on.
70
+ const void *pc;
71
+ } raw_location;
72
+
73
+ // Returns the number of Ruby frames currently live on the thread; this
74
+ // can be used to judge how many times backtracie_capture_frame_for_thread()
75
+ // should be called to capture the actual frames.
76
+ BACKTRACIE_API int backtracie_frame_count_for_thread(VALUE thread);
77
+ // Fills in the raw_location struct with the details of the Ruby call stack
78
+ // frame on the given thread at the given index. The given index may or may not
79
+ // refer to a "valid" frame on the ruby stack; there are some entries on the
80
+ // Ruby stack which are not actually meaningful from a call-stack perspective.
81
+ //
82
+ // The maximum allowable value for i is
83
+ // (backtracie_frame_count_for_thread(thread) - 1). Any value higher than this
84
+ // will crash.
85
+
86
+ // If the given index DOES refer to a valid frame on the Ruby stack:
87
+ // - *loc will be filled in with details of the frame,
88
+ // - the return value will be true
89
+ // If the given index DOES NOT refer to a valid frame, then:
90
+ // - *loc will be totally untouched,
91
+ // - the return value will be false
92
+ //
93
+ // The intended usage of this API looks something like this:
94
+ //
95
+ // VALUE thread = rb_thread_current();
96
+ // int max_frame_count = backtracie_frame_count_for_thread(thread);
97
+ // raw_location *locs = xcalloc(frame_count ,sizeof(raw_location));
98
+ // int frame_counter = 0;
99
+ // for (int i = 0; i < max_frame_count; i++) {
100
+ // bool is_valid = backtracie_capture_frame_for_thread(thread, i,
101
+ // &locs[frame_counter]);
102
+ // if (is_valid) frame_counter++;
103
+ // }
104
+ BACKTRACIE_API
105
+ bool backtracie_capture_frame_for_thread(VALUE thread, int frame_index,
106
+ raw_location *loc);
107
+ // Get the "qualified method name" for the frame. This is a string that best
108
+ // describes what method is being called, intended for human interpretation.
109
+ // Writes a NULL-term'd string of at most buflen chars (including NULL
110
+ // terminator) to *buf. It returns the number of characters (NOT including NULL
111
+ // terminator) that would be required to store the full string (which might be >
112
+ // buflen, if it has been truncated). Essentially, has the same semantics as
113
+ // snprintf or strlcat.
114
+ BACKTRACIE_API
115
+ size_t backtracie_frame_name_cstr(const raw_location *loc, char *buf,
116
+ size_t buflen);
117
+ // Like backtracie_frame_name_cstr, but will allocate memory to ensure that
118
+ // there is no truncation of the method name; returns a Ruby string.
119
+ BACKTRACIE_API
120
+ VALUE backtracie_frame_name_rbstr(const raw_location *loc);
121
+ // Returns the filename of the source file for this backtrace location. Has the
122
+ // same string handling semantics as backtracie_frame_name_cstr.
123
+ //
124
+ // Pass true/false for absolute to get the full, realpath vs just the path.
125
+ //
126
+ // If loc is a cfunc, and therefore has no filename, 0 is returned (and no
127
+ // string is written to *buf)
128
+ BACKTRACIE_API
129
+ size_t backtracie_frame_filename_cstr(const raw_location *loc, bool absolute,
130
+ char *buf, size_t buflen);
131
+ // Like backtracie_frame_filename_cstr, but returns a Ruby string. Will allocate
132
+ // memory to ensure there is no truncation. Returns Qnil if there is no
133
+ // filename.
134
+ BACKTRACIE_API
135
+ VALUE backtracie_frame_filename_rbstr(const raw_location *loc, bool absolute);
136
+
137
+ // Returns the source line number of the given location, if it's a Ruby frame
138
+ // (otherwise, returns 0).
139
+ BACKTRACIE_API
140
+ int backtracie_frame_line_number(const raw_location *loc);
141
+ // Returns a string which would be like the "label" returned by
142
+ // rb_profile_frames or Thread#backtrace or similar.
143
+ BACKTRACIE_API
144
+ size_t backtracie_frame_label_cstr(const raw_location *loc, bool base,
145
+ char *buf, size_t buflen);
146
+ // Like backtracie_frame_label_cstr, but returns a ruby string.
147
+ BACKTRACIE_API
148
+ VALUE backtracie_frame_label_rbstr(const raw_location *loc, bool base);
149
+ // Returns a VALUE that can be passed into the rb_profile_frames family of
150
+ // methods
151
+ BACKTRACIE_API
152
+ VALUE backtracie_frame_for_rb_profile(const raw_location *loc);
153
+ // Marks the contained ruby objects; for use when you want to persist the
154
+ // raw_location object beyond the current call stack.
155
+ BACKTRACIE_API
156
+ void backtracie_frame_mark(const raw_location *loc);
157
+ // Like backtracie_frame_mark, but calls rb_gc_mark_movable if available.
158
+ BACKTRACIE_API
159
+ void backtracie_frame_mark_movable(const raw_location *loc);
160
+ // Updates *loc's VALUEs to point to possibly-moved locations
161
+ BACKTRACIE_API
162
+ void backtracie_frame_compact(raw_location *loc);
163
+
164
+ // This is an optional facility to create a VALUE containing an array of
165
+ // backtracie frames, which itself owns the process of marking them. When using
166
+ // this, you need only mark the wrapper, and the wrapper will take care of
167
+ // marking the individual frames. NOTE - if you keep a reference to this value
168
+ // on the stack, you _probably_ need to use RB_GC_GUARD() on it, because the
169
+ // Ruby GC cannot trace usage of the underlying pointer.
170
+ BACKTRACIE_API
171
+ VALUE backtracie_frame_wrapper_new(size_t capa);
172
+ // Returns the underying array of frames for use
173
+ BACKTRACIE_API
174
+ raw_location *backtracie_frame_wrapper_frames(VALUE wrapper);
175
+ // This returns a pointer to the len, so you can update the size of the
176
+ // contained list of frames (up to capa)
177
+ BACKTRACIE_API
178
+ int *backtracie_frame_wrapper_len(VALUE wrapper);
179
+
180
+ // ========= "Minimal" API ========
181
+ // This part of the API defines a "minimal" version of raw_location, called
182
+ // minimal_location_t. The problem this solves is that marking the iseq &
183
+ // callable method entry stored on the raw_location struct can actually mark a
184
+ // whole lot of memory, but only a small amount of those things are actually
185
+ // needed to compute the method name.
186
+
187
+ // These values define union descriminator values for minimal_location_t.
188
+ // It's tempting to make this an enum, but apparently an enum in a bitfield is
189
+ // implementation-defined behaviour.
190
+ // It would also be tempting to define these as "const uint16_t", but the
191
+ // ancient version of mingw used to build for Ruby 2.3 on Windows doesn't like
192
+ // using such a constant in a switch statement somehow (??).
193
+ // So... #define's it is.
194
+ #define BACKTRACIE_METHOD_QUALIFIER_CONTENTS_SELF 0u
195
+ #define BACKTRACIE_METHOD_QUALIFIER_CONTENTS_SELF_CLASS 1u
196
+ #define BACKTRACIE_METHOD_QUALIFIER_CONTENTS_CME_CLASS 2u
197
+ #define BACKTRACIE_METHOD_NAME_CONTENTS_CME_ID 0u
198
+ #define BACKTRACIE_METHOD_NAME_CONTENTS_BASE_LABEL 1u
199
+
200
+ typedef struct {
201
+ // 1 -> ruby frame / 0 -> cfunc frame
202
+ uint16_t is_ruby_frame : 1;
203
+ // What is in the method_qualifier field?
204
+ // 0 -> self
205
+ // 1 -> self_class
206
+ // 2 -> cme_defined_class
207
+ uint16_t method_qualifier_contents : 2;
208
+ // 0 -> cme_method_id
209
+ // 1 -> base_label
210
+ uint16_t method_name_contents : 1;
211
+ // 1 means iseq_type is populated
212
+ uint16_t has_iseq_type : 1;
213
+
214
+ // Comes from iseq->body->type; is an iseq_type enum.
215
+ // 5 bits is _way_ more than enough to store this enum.
216
+ uint16_t iseq_type : 5;
217
+
218
+ // We have six bits left over if someone can come up with a good use for them.
219
+ uint16_t reserved_bits : 6;
220
+
221
+ // Line number - we calculate this at capture time because it's fast, and it
222
+ // saves us from storing the iseq.
223
+ uint32_t line_number;
224
+
225
+ // Contains either the callable method entry ID or the iseq base label. The
226
+ // former if has_cme_method_id is set, the latter if not.
227
+ // If has_cme_method_id is set, this need not be marked, but if it is NOT set,
228
+ // then method_name.base_label needs to be marked.
229
+ union {
230
+ // Comes from callable_method_entry->called_id
231
+ ID cme_method_id;
232
+ // Comes from iseq->body->location.base_label
233
+ VALUE base_label;
234
+ } method_name;
235
+
236
+ // VALUE for the filename (abs), or Qnil
237
+ // Needs to be marked
238
+ VALUE filename;
239
+
240
+ // See method_qualifier_contents flag for possible values that can be in here.
241
+ // Needs to be marked
242
+ union {
243
+ VALUE self; // the VALUE the method was called on
244
+ VALUE self_class; // rb_class_of(the VALUE the method was called on)
245
+ VALUE cme_defined_class; // the class that the callable_method_entry is
246
+ // defined on
247
+ } method_qualifier;
248
+ } minimal_location_t;
249
+
250
+ // This is like backtracie_capture_frame_for_thread, but captures a
251
+ // minimal_location_t instead of a raw_location.
252
+ BACKTRACIE_API
253
+ bool backtracie_capture_minimal_frame_for_thread(VALUE thread, int frame_index,
254
+ minimal_location_t *loc);
255
+
256
+ // This is like backtracie_frame_name_cstr, but works on a minimal_location_t
257
+ // instead of a raw_location
258
+ BACKTRACIE_API
259
+ size_t backtracie_minimal_frame_name_cstr(const minimal_location_t *loc,
260
+ char *buf, size_t buflen);
261
+
262
+ // This is like backtracie_frame_filename_cstr, but works on a
263
+ // minimal_location_t instead of a raw_location. Note that this always returns
264
+ // the absolute filename.
265
+ BACKTRACIE_API
266
+ size_t backtracie_minimal_frame_filename_cstr(const minimal_location_t *loc,
267
+ char *buf, size_t buflen);
268
+ #endif