github.com/grafana/pyroscope@v1.18.0/examples/grafana-alloy-auto-instrumentation/java/docker/FastSlow.java (about)

     1  import java.util.concurrent.*;
     2  
     3  public class FastSlow {
     4  
     5      public static long fib(int n) {
     6          if (n < 2) {
     7              return n;
     8          }
     9          return fib(n - 1) + fib(n - 2);
    10      }
    11  
    12      public static void main(String[] args) throws ExecutionException, InterruptedException {
    13          ExecutorService e = Executors.newSingleThreadExecutor();
    14          e.submit(() -> {
    15              while (true) {
    16                  fib(26);
    17                  fib(24);
    18              }
    19          });
    20      }
    21  }