blob: 4d62ed3f5d4af363d550be813f2f3facac3a2e04 [file] [log] [blame]
Alex Light49948e92016-08-11 15:35:28 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17public class Main {
18 public static void main(String[] args) {
19 System.out.println("Hello, world!");
Andreas Gampef37e3022017-01-13 17:54:46 -080020
Andreas Gampe96eca782017-01-19 19:45:30 -080021 if (checkLivePhase()) {
22 System.out.println("Agent in live phase.");
23 }
24
Andreas Gampef37e3022017-01-13 17:54:46 -080025 set(0); // OTHER
26 set(1); // GC
27 set(2); // CLASS
28 set(4); // JNI
29 set(8); // Error.
Alex Light49948e92016-08-11 15:35:28 -070030 }
Andreas Gampef37e3022017-01-13 17:54:46 -080031
32 private static void set(int i) {
33 System.out.println(i);
34 try {
35 setVerboseFlag(i, true);
36 setVerboseFlag(i, false);
37 } catch (RuntimeException e) {
38 System.out.println(e.getMessage());
39 }
40 }
41
Andreas Gampe96eca782017-01-19 19:45:30 -080042 private static native boolean checkLivePhase();
Andreas Gampef37e3022017-01-13 17:54:46 -080043 private static native void setVerboseFlag(int flag, boolean value);
Alex Light49948e92016-08-11 15:35:28 -070044}