FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: use PROFILER_STOP_COMMAND in Shutdown hook by maxday · Pull Request #537 · aws/aws-lambda-java-libs · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
    • PreMain.java
    • ShutdownHook.java
This file contains hidden or 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
Expand Up @@ -28,7 +28,7 @@ public static void premain(String agentArgs, Instrumentation inst) {
if(!createFileIfNotExist("/tmp/aws-lambda-java-profiler")) {
Logger.debug("starting the profiler for coldstart");
startProfiler();
registerShutdownHook(AsyncProfiler.getInstance());
registerShutdownHook();
try {
Integer port = Integer.parseInt(INTERNAL_COMMUNICATION_PORT);
Logger.debug("using profile communication port = " + port);
Expand Down Expand Up @@ -101,9 +101,9 @@ public static void startProfiler() {
}
}

public static void registerShutdownHook(AsyncProfiler profiler) {
public static void registerShutdownHook() {
Logger.debug("registering shutdown hook");
Thread shutdownHook = new Thread(new ShutdownHook(profiler));
Thread shutdownHook = new Thread(new ShutdownHook(PROFILER_STOP_COMMAND));
Runtime.getRuntime().addShutdownHook(shutdownHook);
}

Expand Down
This file contains hidden or 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
Expand Up @@ -6,10 +6,10 @@

public class ShutdownHook implements Runnable {

private AsyncProfiler profiler;
private String stopCommand;

public ShutdownHook(AsyncProfiler profiler) {
this.profiler = profiler;
public ShutdownHook(String stopCommand) {
this.stopCommand = stopCommand;
}

@Override
Expand All @@ -18,7 +18,7 @@ public void run() {
try {
final String fileName = "/tmp/profiling-data-shutdown.html";
Logger.debug("stopping the profiler");
AsyncProfiler.getInstance().execute(String.format("stop,file=%s,include=*AWSLambda.main,include=start_thread", fileName));
AsyncProfiler.getInstance().execute(String.format(this.stopCommand, fileName));
} catch (Exception e) {
Logger.error("could not stop the profiler");
}
Expand Down

Back | FazBrowse Home | New Git URL