Skip to content

Commit d24ff73

Browse files
committed
use unix line endings
1 parent f61ff1f commit d24ff73

File tree

9 files changed

+281
-281
lines changed

9 files changed

+281
-281
lines changed

.gitignore

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Ignore Gradle project-specific cache directory
2-
.gradle
3-
4-
# Ignore Gradle build output directory
5-
build
6-
out
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
6+
out
77
tracy-jni/build

README.md

+40-40
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
## TracyJavaBindings – Java bindings for the Tracy Profiler
2-
### Prerequisites
3-
- After cloning the repository, ensure that you have checked-out submodules with `git submodule update --init`.
4-
### Building
5-
#### JNI Bindings
6-
- You can build the JNI bindings with `gradlew jar`
7-
#### Tracy profiler GUI
8-
> _All commands need to be run in the `tracy-jni/tracy` subdirectory._
9-
- Create a new `build` folder under `tracy-jni/tracy/profiler`.
10-
- Configure the profiler using `cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release` (this only needs to be done once).
11-
- Build the profiler using `cmake --build profiler/build --parallel --config Release`.
12-
- The built `tracy-profiler` executable can be found in the `profiler/build/Release` directory.
13-
14-
### Integration
15-
- At runtime, the `java.library.path` system property should contain a path to the native JNI libraries found in `tracy-jni/build/lib/main/release`.
16-
### Usage Example
17-
```java
18-
import io.github.benjaminamos.tracy.Tracy;
19-
20-
public class TracyTest {
21-
public static void main(String[] args) {
22-
// Start profiling
23-
Tracy.startupProfiler();
24-
25-
// Allocate and begin zone
26-
long handle = Tracy.allocSourceLocation(0, "Test.java", "test()", "Test!", 0);
27-
Tracy.ZoneContext zoneContext = Tracy.zoneBegin(handle, 1);
28-
29-
// Do work...
30-
31-
// End zone
32-
Tracy.zoneEnd(zoneContext);
33-
34-
// Begin new frame
35-
Tracy.markFrame();
36-
37-
// Stop profiling
38-
Tracy.shutdownProfiler();
39-
}
40-
}
1+
## TracyJavaBindings – Java bindings for the Tracy Profiler
2+
### Prerequisites
3+
- After cloning the repository, ensure that you have checked-out submodules with `git submodule update --init`.
4+
### Building
5+
#### JNI Bindings
6+
- You can build the JNI bindings with `gradlew jar`
7+
#### Tracy profiler GUI
8+
> _All commands need to be run in the `tracy-jni/tracy` subdirectory._
9+
- Create a new `build` folder under `tracy-jni/tracy/profiler`.
10+
- Configure the profiler using `cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release` (this only needs to be done once).
11+
- Build the profiler using `cmake --build profiler/build --parallel --config Release`.
12+
- The built `tracy-profiler` executable can be found in the `profiler/build/Release` directory.
13+
14+
### Integration
15+
- At runtime, the `java.library.path` system property should contain a path to the native JNI libraries found in `tracy-jni/build/lib/main/release`.
16+
### Usage Example
17+
```java
18+
import io.github.benjaminamos.tracy.Tracy;
19+
20+
public class TracyTest {
21+
public static void main(String[] args) {
22+
// Start profiling
23+
Tracy.startupProfiler();
24+
25+
// Allocate and begin zone
26+
long handle = Tracy.allocSourceLocation(0, "Test.java", "test()", "Test!", 0);
27+
Tracy.ZoneContext zoneContext = Tracy.zoneBegin(handle, 1);
28+
29+
// Do work...
30+
31+
// End zone
32+
Tracy.zoneEnd(zoneContext);
33+
34+
// Begin new frame
35+
Tracy.markFrame();
36+
37+
// Stop profiling
38+
Tracy.shutdownProfiler();
39+
}
40+
}
4141
```

build.gradle

+58-58
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
1-
// Copyright 2024 The Terasology Foundation
2-
// SPDX-License-Identifier: Apache-2.0
3-
4-
plugins {
5-
id 'java-library'
6-
}
7-
8-
group 'io.github.benjaminamos.TracyJavaBindings'
9-
version '1.0-SNAPSHOT'
10-
11-
repositories {
12-
mavenCentral()
13-
}
14-
15-
dependencies {
16-
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
17-
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
18-
}
19-
20-
sourceSets {
21-
main
22-
}
23-
24-
tasks.withType(Jar).configureEach {
25-
def sharedLibraryTasks = project('tracy-jni').tasks.withType(LinkSharedLibrary)
26-
dependsOn sharedLibraryTasks
27-
def sharedLibraryOutputs = sharedLibraryTasks.find { task ->
28-
task.name.toLowerCase().contains("release")
29-
}.outputs.files.asFileTree.files
30-
from(sharedLibraryOutputs) {
31-
include("*.dll")
32-
into("windows")
33-
}
34-
from(sharedLibraryOutputs) {
35-
include("*.so")
36-
into("linux")
37-
}
38-
from(sharedLibraryOutputs) {
39-
include("*.dylib")
40-
into("macosx")
41-
}
42-
from (new File(project('tracy-jni').projectDir, "tracy")) {
43-
include("LICENSE")
44-
rename("LICENSE", "TRACY_LICENSE")
45-
}
46-
}
47-
48-
tasks.named("test", Test) {
49-
useJUnitPlatform()
50-
51-
maxHeapSize = "1G"
52-
53-
testLogging {
54-
events("passed")
55-
}
56-
57-
systemProperty "java.library.path", project(":tracy-jni").getLayout().getBuildDirectory().dir("lib/main/debug").get().asFile.absolutePath
58-
}
1+
// Copyright 2024 The Terasology Foundation
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
plugins {
5+
id 'java-library'
6+
}
7+
8+
group 'io.github.benjaminamos.TracyJavaBindings'
9+
version '1.0-SNAPSHOT'
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
17+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
18+
}
19+
20+
sourceSets {
21+
main
22+
}
23+
24+
tasks.withType(Jar).configureEach {
25+
def sharedLibraryTasks = project('tracy-jni').tasks.withType(LinkSharedLibrary)
26+
dependsOn sharedLibraryTasks
27+
def sharedLibraryOutputs = sharedLibraryTasks.find { task ->
28+
task.name.toLowerCase().contains("release")
29+
}.outputs.files.asFileTree.files
30+
from(sharedLibraryOutputs) {
31+
include("*.dll")
32+
into("windows")
33+
}
34+
from(sharedLibraryOutputs) {
35+
include("*.so")
36+
into("linux")
37+
}
38+
from(sharedLibraryOutputs) {
39+
include("*.dylib")
40+
into("macosx")
41+
}
42+
from (new File(project('tracy-jni').projectDir, "tracy")) {
43+
include("LICENSE")
44+
rename("LICENSE", "TRACY_LICENSE")
45+
}
46+
}
47+
48+
tasks.named("test", Test) {
49+
useJUnitPlatform()
50+
51+
maxHeapSize = "1G"
52+
53+
testLogging {
54+
events("passed")
55+
}
56+
57+
systemProperty "java.library.path", project(":tracy-jni").getLayout().getBuildDirectory().dir("lib/main/debug").get().asFile.absolutePath
58+
}

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

settings.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
rootProject.name = "TracyJavaBindings"
2-
1+
rootProject.name = "TracyJavaBindings"
2+
33
include 'tracy-jni'
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,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-
}
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

Comments
 (0)