|
1 | | -// Copyright 2024 The Terasology Foundation |
2 | | -// SPDX-License-Identifier: Apache-2.0 |
3 | | - |
4 | | -package io.github.benjaminamos.tracy; |
5 | | - |
6 | | -import java.io.File; |
7 | | - |
8 | | -public final class Tracy { |
9 | | - private Tracy() { |
10 | | - } |
11 | | - |
12 | | - static { |
13 | | - String libraryPath = System.getProperty("org.terasology.librarypath"); |
14 | | - if (libraryPath == null) { |
15 | | - System.loadLibrary("tracy-jni-" + System.getProperty("os.arch")); |
16 | | - } else { |
17 | | - File libraryDirectory = new File(libraryPath); |
18 | | - if (libraryDirectory.exists() && libraryDirectory.isDirectory()) { |
19 | | - String architecture = System.getProperty("os.arch"); |
20 | | - for (File file : libraryDirectory.listFiles()) { |
21 | | - if (file.getName().startsWith("tracy-jni-" + architecture) || file.getName().startsWith("libtracy-jni-" + architecture)) { |
22 | | - System.load(file.getPath()); |
23 | | - } |
24 | | - } |
25 | | - } |
26 | | - } |
27 | | - } |
28 | | - |
29 | | - public static native void startupProfiler(); |
30 | | - public static native void shutdownProfiler(); |
31 | | - public static native boolean isConnected(); |
32 | | - public static native void markFrame(); |
33 | | - public static native long allocSourceLocation(int line, String source, String function, String name, int colour); |
34 | | - public static native ZoneContext zoneBegin(long sourceLocation, int active); |
35 | | - public static native void zoneEnd(ZoneContext zoneContext); |
36 | | - |
37 | | - public static final class ZoneContext { |
38 | | - public final int id; |
39 | | - public final int active; |
40 | | - |
41 | | - public ZoneContext(int id, int active) { |
42 | | - this.id = id; |
43 | | - this.active = active; |
44 | | - } |
45 | | - } |
46 | | -} |
| 1 | +// Copyright 2024 The Terasology Foundation |
| 2 | +// SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +package io.github.benjaminamos.tracy; |
| 5 | + |
| 6 | +import java.io.File; |
| 7 | + |
| 8 | +public final class Tracy { |
| 9 | + private Tracy() { |
| 10 | + } |
| 11 | + |
| 12 | + static { |
| 13 | + String libraryPath = System.getProperty("org.terasology.librarypath"); |
| 14 | + if (libraryPath == null) { |
| 15 | + System.loadLibrary("tracy-jni-" + System.getProperty("os.arch")); |
| 16 | + } else { |
| 17 | + File libraryDirectory = new File(libraryPath); |
| 18 | + if (libraryDirectory.exists() && libraryDirectory.isDirectory()) { |
| 19 | + String architecture = System.getProperty("os.arch"); |
| 20 | + for (File file : libraryDirectory.listFiles()) { |
| 21 | + if (file.getName().startsWith("tracy-jni-" + architecture) || file.getName().startsWith("libtracy-jni-" + architecture)) { |
| 22 | + System.load(file.getPath()); |
| 23 | + } |
| 24 | + } |
| 25 | + } |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | + public static native void startupProfiler(); |
| 30 | + public static native void shutdownProfiler(); |
| 31 | + public static native boolean isConnected(); |
| 32 | + public static native void markFrame(); |
| 33 | + public static native long allocSourceLocation(int line, String source, String function, String name, int colour); |
| 34 | + public static native ZoneContext zoneBegin(long sourceLocation, int active); |
| 35 | + public static native void zoneEnd(ZoneContext zoneContext); |
| 36 | + |
| 37 | + public static final class ZoneContext { |
| 38 | + public final int id; |
| 39 | + public final int active; |
| 40 | + |
| 41 | + public ZoneContext(int id, int active) { |
| 42 | + this.id = id; |
| 43 | + this.active = active; |
| 44 | + } |
| 45 | + } |
| 46 | +} |
0 commit comments