-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jfr): fixes a parser regression introduced in 1.15.0 (#1050)
* chore: add a java-jfr example * use JFR * fixes a bug, adds tests * makes units and AggregationType proper types * moves adhoc-pull to a separate directory so that linters doesn't complain * fix * fixes * fix * fix Co-authored-by: Dmitry Filimonov <[email protected]>
- Loading branch information
1 parent
7d9aed5
commit 946468d
Showing
43 changed files
with
401 additions
and
106 deletions.
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM openjdk:17-slim-bullseye | ||
|
||
WORKDIR /opt/app | ||
|
||
RUN apt-get update && apt-get install ca-certificates -y && update-ca-certificates && apt-get install -y git | ||
RUN git clone https://github.com/pyroscope-io/pyroscope-java.git && \ | ||
cd pyroscope-java && \ | ||
git checkout v0.6.0 && \ | ||
./gradlew shadowJar && \ | ||
cp agent/build/libs/pyroscope.jar /opt/app/pyroscope.jar | ||
|
||
COPY Main.java ./ | ||
|
||
RUN javac Main.java | ||
|
||
ENV PYROSCOPE_APPLICATION_NAME=fibonacci.java.push.app | ||
ENV PYROSCOPE_FORMAT=jfr | ||
ENV PYROSCOPE_PROFILING_INTERVAL=10ms | ||
ENV PYROSCOPE_PROFILER_EVENT=cpu | ||
ENV PYROSCOPE_PROFILER_LOCK=1 | ||
ENV PYROSCOPE_PROFILER_ALLOC=1 | ||
ENV PYROSCOPE_UPLOAD_INTERVAL=10s | ||
ENV PYROSCOPE_LOG_LEVEL=debug | ||
ENV PYROSCOPE_SERVER_ADDRESS=http://localhost:4040 | ||
|
||
CMD ["java", "-XX:-Inline", "-javaagent:pyroscope.jar", "Main"] |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import java.util.concurrent.locks.Lock; | ||
import java.util.concurrent.locks.ReentrantLock; | ||
|
||
class MyRunnable implements Runnable { | ||
private Lock lock; | ||
|
||
public MyRunnable(Lock lock) { | ||
this.lock = lock; | ||
} | ||
|
||
public static long fib(long n) { | ||
if (n < 2) | ||
return n; | ||
return fib(n-1) + fib(n-2); | ||
} | ||
|
||
public void run() { | ||
while (true) { | ||
this.lock.lock(); | ||
try { | ||
fib(40); | ||
} finally { | ||
this.lock.unlock(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
class Main { | ||
public static long fib(long n) { | ||
if (n < 2) | ||
return n; | ||
return fib(n-1) + fib(n-2); | ||
} | ||
|
||
public static void main(String[] args) { | ||
Lock l = new ReentrantLock(); | ||
Runnable r = new MyRunnable(l); | ||
new Thread(r).start(); | ||
|
||
while (true) { | ||
l.lock(); | ||
try { | ||
fib(40); | ||
} finally { | ||
l.unlock(); | ||
} | ||
} | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
version: '3.9' | ||
services: | ||
pyroscope: | ||
image: 'pyroscope/pyroscope:latest' | ||
ports: | ||
- '4040:4040' | ||
command: | ||
- 'server' | ||
- '-no-self-profiling' | ||
app: | ||
build: . | ||
privileged: true | ||
environment: | ||
- 'PYROSCOPE_APPLICATION_NAME=fibonacci-java-lock-push' | ||
- 'PYROSCOPE_PROFILER_EVENT=lock' | ||
- 'PYROSCOPE_SERVER_ADDRESS=http://pyroscope:4040' | ||
- 'PYROSCOPE_FORMAT=jfr' | ||
- 'PYROSCOPE_PROFILER_LOCK=0' |
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
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
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
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
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
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
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.