github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/examples/java/Main.java (about)

     1  class Main {
     2    public static int work(int n) {
     3      int i = 0;
     4      for (i = 0; i < n; i++) {}
     5      return i;
     6    }
     7  
     8    public static void fastFunction() {
     9      work(20000);
    10    }
    11  
    12    public static void slowFunction() {
    13      work(80000);
    14    }
    15  
    16    public static void main(String[] args) {
    17      int i = 0;
    18      while (true) {
    19        fastFunction();
    20        slowFunction();
    21        i++;
    22      }
    23    }
    24  }