-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix flamegraph file extension #151
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 7 additions & 31 deletions
38
...n/kotlin/com/atlassian/performance/tools/infrastructure/api/profiler/WallClockProfiler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,13 @@ | ||
package com.atlassian.performance.tools.infrastructure.api.profiler | ||
|
||
import com.atlassian.performance.tools.infrastructure.api.process.RemoteMonitoringProcess | ||
import com.atlassian.performance.tools.ssh.api.SshConnection | ||
import java.time.Duration | ||
|
||
/** | ||
* A profiler to sample all threads equally every given period of time regardless of thread status. | ||
*/ | ||
class WallClockProfiler : Profiler { | ||
override fun install(ssh: SshConnection) { | ||
ssh.execute("wget -q https://github.com/jvm-profiling-tools/async-profiler/releases/download/v1.5/async-profiler-1.5-linux-x64.tar.gz") | ||
ssh.execute("mkdir async-profiler") | ||
ssh.execute("tar -xzf async-profiler-1.5-linux-x64.tar.gz -C async-profiler") | ||
ssh.execute("sudo sh -c 'echo 1 > /proc/sys/kernel/perf_event_paranoid'") | ||
ssh.execute("sudo sh -c 'echo 0 > /proc/sys/kernel/kptr_restrict'") | ||
} | ||
|
||
override fun start( | ||
ssh: SshConnection, | ||
pid: Int | ||
): RemoteMonitoringProcess { | ||
ssh.execute("./async-profiler/profiler.sh -e wall -i 9ms -b 160000000 start $pid") | ||
return ProfilerProcess(pid) | ||
} | ||
|
||
private class ProfilerProcess(private val pid: Int) : RemoteMonitoringProcess { | ||
private val flameGraphFile = "wall-clock-flamegraph.svg" | ||
|
||
override fun stop(ssh: SshConnection) { | ||
ssh.execute("./async-profiler/profiler.sh stop $pid -o svg > $flameGraphFile") | ||
} | ||
|
||
override fun getResultPath(): String { | ||
return flameGraphFile | ||
} | ||
} | ||
} | ||
@Deprecated("Use AsyncProfiler.Builder instead") | ||
class WallClockProfiler : Profiler by AsyncProfiler.Builder() | ||
.wallClockMode() | ||
.interval(Duration.ofMillis(9)) | ||
.outputFile("wall-clock-flamegraph.html") | ||
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should make the
Builder
reusable 👍There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch BTW