jruby-async-profiler 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.gitmodules +3 -0
  4. data/Gemfile +4 -0
  5. data/README.md +35 -0
  6. data/Rakefile +2 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +8 -0
  9. data/ext/Rakefile +6 -0
  10. data/ext/async-profiler/.gitattributes +1 -0
  11. data/ext/async-profiler/.gitignore +6 -0
  12. data/ext/async-profiler/.travis.yml +11 -0
  13. data/ext/async-profiler/CHANGELOG.md +107 -0
  14. data/ext/async-profiler/JavaHome.class +0 -0
  15. data/ext/async-profiler/LICENSE +201 -0
  16. data/ext/async-profiler/Makefile +66 -0
  17. data/ext/async-profiler/README.md +487 -0
  18. data/ext/async-profiler/demo/SwingSet2.svg +2247 -0
  19. data/ext/async-profiler/docs/cddl1.txt +358 -0
  20. data/ext/async-profiler/profiler.sh +240 -0
  21. data/ext/async-profiler/src/allocTracer.cpp +155 -0
  22. data/ext/async-profiler/src/allocTracer.h +74 -0
  23. data/ext/async-profiler/src/arch.h +69 -0
  24. data/ext/async-profiler/src/arguments.cpp +265 -0
  25. data/ext/async-profiler/src/arguments.h +152 -0
  26. data/ext/async-profiler/src/codeCache.cpp +128 -0
  27. data/ext/async-profiler/src/codeCache.h +99 -0
  28. data/ext/async-profiler/src/engine.cpp +50 -0
  29. data/ext/async-profiler/src/engine.h +38 -0
  30. data/ext/async-profiler/src/flameGraph.cpp +770 -0
  31. data/ext/async-profiler/src/flameGraph.h +118 -0
  32. data/ext/async-profiler/src/flightRecorder.cpp +727 -0
  33. data/ext/async-profiler/src/flightRecorder.h +39 -0
  34. data/ext/async-profiler/src/frameName.cpp +189 -0
  35. data/ext/async-profiler/src/frameName.h +56 -0
  36. data/ext/async-profiler/src/itimer.cpp +49 -0
  37. data/ext/async-profiler/src/itimer.h +43 -0
  38. data/ext/async-profiler/src/jattach/jattach.c +437 -0
  39. data/ext/async-profiler/src/java/one/profiler/AsyncProfiler.java +160 -0
  40. data/ext/async-profiler/src/java/one/profiler/AsyncProfilerMXBean.java +43 -0
  41. data/ext/async-profiler/src/java/one/profiler/Counter.java +25 -0
  42. data/ext/async-profiler/src/java/one/profiler/Events.java +28 -0
  43. data/ext/async-profiler/src/javaApi.cpp +124 -0
  44. data/ext/async-profiler/src/lockTracer.cpp +161 -0
  45. data/ext/async-profiler/src/lockTracer.h +55 -0
  46. data/ext/async-profiler/src/mutex.cpp +33 -0
  47. data/ext/async-profiler/src/mutex.h +49 -0
  48. data/ext/async-profiler/src/os.h +45 -0
  49. data/ext/async-profiler/src/os_linux.cpp +129 -0
  50. data/ext/async-profiler/src/os_macos.cpp +115 -0
  51. data/ext/async-profiler/src/perfEvents.h +60 -0
  52. data/ext/async-profiler/src/perfEvents_linux.cpp +550 -0
  53. data/ext/async-profiler/src/perfEvents_macos.cpp +64 -0
  54. data/ext/async-profiler/src/profiler.cpp +952 -0
  55. data/ext/async-profiler/src/profiler.h +238 -0
  56. data/ext/async-profiler/src/spinLock.h +66 -0
  57. data/ext/async-profiler/src/stackFrame.h +57 -0
  58. data/ext/async-profiler/src/stackFrame_aarch64.cpp +75 -0
  59. data/ext/async-profiler/src/stackFrame_arm.cpp +58 -0
  60. data/ext/async-profiler/src/stackFrame_i386.cpp +82 -0
  61. data/ext/async-profiler/src/stackFrame_x64.cpp +113 -0
  62. data/ext/async-profiler/src/symbols.h +37 -0
  63. data/ext/async-profiler/src/symbols_linux.cpp +354 -0
  64. data/ext/async-profiler/src/symbols_macos.cpp +156 -0
  65. data/ext/async-profiler/src/vmEntry.cpp +173 -0
  66. data/ext/async-profiler/src/vmEntry.h +105 -0
  67. data/ext/async-profiler/src/vmStructs.cpp +104 -0
  68. data/ext/async-profiler/src/vmStructs.h +112 -0
  69. data/ext/async-profiler/src/wallClock.cpp +96 -0
  70. data/ext/async-profiler/src/wallClock.h +56 -0
  71. data/ext/async-profiler/test/AllocatingTarget.java +26 -0
  72. data/ext/async-profiler/test/LoadLibraryTest.java +21 -0
  73. data/ext/async-profiler/test/Target.java +31 -0
  74. data/ext/async-profiler/test/ThreadsTarget.java +35 -0
  75. data/ext/async-profiler/test/alloc-smoke-test.sh +36 -0
  76. data/ext/async-profiler/test/load-library-test.sh +35 -0
  77. data/ext/async-profiler/test/smoke-test.sh +37 -0
  78. data/ext/async-profiler/test/thread-smoke-test.sh +32 -0
  79. data/jruby-async-profiler.gemspec +32 -0
  80. data/lib/jruby/async/profiler.rb +10 -0
  81. data/lib/jruby/async/profiler/version.rb +7 -0
  82. metadata +155 -0
@@ -0,0 +1,37 @@
1
+ #!/bin/bash
2
+
3
+ set -e # exit on any failure
4
+ set -x # print all executed lines
5
+
6
+ if [ -z "${JAVA_HOME}" ]; then
7
+ echo "JAVA_HOME is not set"
8
+ exit 1
9
+ fi
10
+
11
+ (
12
+ cd $(dirname $0)
13
+
14
+ if [ "Target.class" -ot "Target.java" ]; then
15
+ ${JAVA_HOME}/bin/javac Target.java
16
+ fi
17
+
18
+ ${JAVA_HOME}/bin/java Target &
19
+
20
+ FILENAME=/tmp/java.trace
21
+ JAVAPID=$!
22
+
23
+ sleep 1 # allow the Java runtime to initialize
24
+ ../profiler.sh -f $FILENAME -o collapsed -d 5 $JAVAPID
25
+
26
+ kill $JAVAPID
27
+
28
+ function assert_string() {
29
+ if ! grep -q "$1" $FILENAME; then
30
+ exit 1
31
+ fi
32
+ }
33
+
34
+ assert_string "Target.main;Target.method1 "
35
+ assert_string "Target.main;Target.method2 "
36
+ assert_string "Target.main;Target.method3;java/io/File"
37
+ )
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+
3
+ set -e # exit on any failure
4
+ set -x # print all executed lines
5
+
6
+ if [ -z "${JAVA_HOME}" ]; then
7
+ echo "JAVA_HOME is not set"
8
+ exit 1
9
+ fi
10
+
11
+ (
12
+ cd $(dirname $0)
13
+
14
+ if [ "ThreadsTarget.class" -ot "ThreadsTarget.java" ]; then
15
+ ${JAVA_HOME}/bin/javac ThreadsTarget.java
16
+ fi
17
+
18
+ FILENAME=/tmp/java.trace
19
+
20
+ ${JAVA_HOME}/bin/java -agentpath:../build/libasyncProfiler.so=start,collapsed,threads,file=$FILENAME ThreadsTarget
21
+
22
+ # wait for normal termination
23
+
24
+ function assert_string() {
25
+ if ! grep -q "$1" $FILENAME; then
26
+ exit 1
27
+ fi
28
+ }
29
+
30
+ assert_string "\[ThreadEarlyEnd tid=[0-9]\+\];.*ThreadsTarget.methodForThreadEarlyEnd;.*"
31
+ assert_string "\[RenamedThread tid=[0-9]\+\];.*ThreadsTarget.methodForRenamedThread;.*"
32
+ )
@@ -0,0 +1,32 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "jruby/async/profiler/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "jruby-async-profiler"
7
+ spec.version = Jruby::Async::Profiler::VERSION
8
+ spec.authors = ["Charles Oliver Nutter"]
9
+ spec.email = ["headius@headius.com"]
10
+
11
+ spec.summary = "Installer for the JVM async-profiler to use with JRuby"
12
+ spec.description = "This gem contains the sources and build scripts to build the async-profiler JVM plugin. This can be used with JRuby to profile CPU, memory, and lock contention."
13
+ spec.homepage = "https://github.com/jruby/jruby-async-profiler"
14
+
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/jruby/jruby-async-profiler"
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ `git ls-files -z --recurse-submodules`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+
28
+ spec.extensions = ['ext/Rakefile']
29
+
30
+ spec.add_development_dependency "bundler", "~> 2.0"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ end
@@ -0,0 +1,10 @@
1
+ require "jruby/async/profiler/version"
2
+
3
+ module Jruby
4
+ module Async
5
+ module Profiler
6
+ class Error < StandardError; end
7
+ # Your code goes here...
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module Jruby
2
+ module Async
3
+ module Profiler
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jruby-async-profiler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Charles Oliver Nutter
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-11-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: This gem contains the sources and build scripts to build the async-profiler
42
+ JVM plugin. This can be used with JRuby to profile CPU, memory, and lock contention.
43
+ email:
44
+ - headius@headius.com
45
+ executables: []
46
+ extensions:
47
+ - ext/Rakefile
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - ".gitmodules"
52
+ - Gemfile
53
+ - README.md
54
+ - Rakefile
55
+ - bin/console
56
+ - bin/setup
57
+ - ext/Rakefile
58
+ - ext/async-profiler/.gitattributes
59
+ - ext/async-profiler/.gitignore
60
+ - ext/async-profiler/.travis.yml
61
+ - ext/async-profiler/CHANGELOG.md
62
+ - ext/async-profiler/JavaHome.class
63
+ - ext/async-profiler/LICENSE
64
+ - ext/async-profiler/Makefile
65
+ - ext/async-profiler/README.md
66
+ - ext/async-profiler/demo/SwingSet2.svg
67
+ - ext/async-profiler/docs/cddl1.txt
68
+ - ext/async-profiler/profiler.sh
69
+ - ext/async-profiler/src/allocTracer.cpp
70
+ - ext/async-profiler/src/allocTracer.h
71
+ - ext/async-profiler/src/arch.h
72
+ - ext/async-profiler/src/arguments.cpp
73
+ - ext/async-profiler/src/arguments.h
74
+ - ext/async-profiler/src/codeCache.cpp
75
+ - ext/async-profiler/src/codeCache.h
76
+ - ext/async-profiler/src/engine.cpp
77
+ - ext/async-profiler/src/engine.h
78
+ - ext/async-profiler/src/flameGraph.cpp
79
+ - ext/async-profiler/src/flameGraph.h
80
+ - ext/async-profiler/src/flightRecorder.cpp
81
+ - ext/async-profiler/src/flightRecorder.h
82
+ - ext/async-profiler/src/frameName.cpp
83
+ - ext/async-profiler/src/frameName.h
84
+ - ext/async-profiler/src/itimer.cpp
85
+ - ext/async-profiler/src/itimer.h
86
+ - ext/async-profiler/src/jattach/jattach.c
87
+ - ext/async-profiler/src/java/one/profiler/AsyncProfiler.java
88
+ - ext/async-profiler/src/java/one/profiler/AsyncProfilerMXBean.java
89
+ - ext/async-profiler/src/java/one/profiler/Counter.java
90
+ - ext/async-profiler/src/java/one/profiler/Events.java
91
+ - ext/async-profiler/src/javaApi.cpp
92
+ - ext/async-profiler/src/lockTracer.cpp
93
+ - ext/async-profiler/src/lockTracer.h
94
+ - ext/async-profiler/src/mutex.cpp
95
+ - ext/async-profiler/src/mutex.h
96
+ - ext/async-profiler/src/os.h
97
+ - ext/async-profiler/src/os_linux.cpp
98
+ - ext/async-profiler/src/os_macos.cpp
99
+ - ext/async-profiler/src/perfEvents.h
100
+ - ext/async-profiler/src/perfEvents_linux.cpp
101
+ - ext/async-profiler/src/perfEvents_macos.cpp
102
+ - ext/async-profiler/src/profiler.cpp
103
+ - ext/async-profiler/src/profiler.h
104
+ - ext/async-profiler/src/spinLock.h
105
+ - ext/async-profiler/src/stackFrame.h
106
+ - ext/async-profiler/src/stackFrame_aarch64.cpp
107
+ - ext/async-profiler/src/stackFrame_arm.cpp
108
+ - ext/async-profiler/src/stackFrame_i386.cpp
109
+ - ext/async-profiler/src/stackFrame_x64.cpp
110
+ - ext/async-profiler/src/symbols.h
111
+ - ext/async-profiler/src/symbols_linux.cpp
112
+ - ext/async-profiler/src/symbols_macos.cpp
113
+ - ext/async-profiler/src/vmEntry.cpp
114
+ - ext/async-profiler/src/vmEntry.h
115
+ - ext/async-profiler/src/vmStructs.cpp
116
+ - ext/async-profiler/src/vmStructs.h
117
+ - ext/async-profiler/src/wallClock.cpp
118
+ - ext/async-profiler/src/wallClock.h
119
+ - ext/async-profiler/test/AllocatingTarget.java
120
+ - ext/async-profiler/test/LoadLibraryTest.java
121
+ - ext/async-profiler/test/Target.java
122
+ - ext/async-profiler/test/ThreadsTarget.java
123
+ - ext/async-profiler/test/alloc-smoke-test.sh
124
+ - ext/async-profiler/test/load-library-test.sh
125
+ - ext/async-profiler/test/smoke-test.sh
126
+ - ext/async-profiler/test/thread-smoke-test.sh
127
+ - jruby-async-profiler.gemspec
128
+ - lib/jruby/async/profiler.rb
129
+ - lib/jruby/async/profiler/version.rb
130
+ homepage: https://github.com/jruby/jruby-async-profiler
131
+ licenses: []
132
+ metadata:
133
+ homepage_uri: https://github.com/jruby/jruby-async-profiler
134
+ source_code_uri: https://github.com/jruby/jruby-async-profiler
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.5.2.3
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: Installer for the JVM async-profiler to use with JRuby
155
+ test_files: []