Skip to content

Commit

Permalink
Merge branch 'main' into jb/j9_versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jbachorik authored Feb 18, 2025
2 parents c8e0e50 + 32742e0 commit 996507e
Show file tree
Hide file tree
Showing 55 changed files with 1,369 additions and 667 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/approve-trivial.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Auto-Approve Trivial PRs

on:
pull_request_target:
types: [labeled]

permissions:
pull-requests: write
contents: read

jobs:
auto-approve:
if: contains(github.event.pull_request.labels.*.name, 'trivial')
runs-on: ubuntu-latest
steps:
- name: Auto-approve PR if labeled 'trivial'
uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
export LIBC=glibc
export SANITIZER=${{ matrix.config }}
./gradlew -PkeepJFRs :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs
./gradlew -PCI -PkeepJFRs :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
}')
export JAVA_VERSION
./gradlew -PkeepJFRs :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs
./gradlew -PCI -PkeepJFRs :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
export LIBC=glibc
export SANITIZER=${{ matrix.config }}
./gradlew -PkeepJFRs :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs
./gradlew -PCI -PkeepJFRs :ddprof-test:test${{ matrix.config }} --no-daemon --parallel --build-cache --no-watch-fs
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {
version = "1.21.0"

apply plugin: "com.dipien.semantic-version"
version = project.hasProperty("ddprof_version") ? project.ddprof_version : version
version = project.findProperty("ddprof_version") ?: version

allprojects {
repositories {
Expand Down
60 changes: 29 additions & 31 deletions ddprof-lib/gtest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,42 @@ tasks.withType(StripSymbols).configureEach { task ->
}
}

def buildResourcesTask = tasks.register("buildResources", Exec) {
def buildNativeLibsTask = tasks.register("buildNativeLibs") {
group = 'build'
description = "Build the resources for the Google Tests"
description = "Build the native libs for the Google Tests"

onlyIf {
hasGtest && !project.hasProperty('skip-native') && os().isLinux()
hasGtest && !project.hasProperty('skip-native') && !project.hasProperty('skip-gtest') && os().isLinux()
}

def targetDir = project(':ddprof-lib').file('build/test/resources/unresolved-functions')

commandLine "sh", "-c", "cd ${project(':ddprof-lib').projectDir}/src/test/resources/unresolved-functions && make TARGET_DIR=${targetDir}"

inputs.files project(':ddprof-lib').files('src/test/resources/unresolved-functions')
outputs.file "${targetDir}/main"
}

def buildSmallLibTask = tasks.register("buildSmallLib", Exec) {
group = 'build'
description = "Build the small-lib shared library for the Google Tests"

onlyIf {
hasGtest && !project.hasProperty('skip-native') && os().isLinux()
def srcDir = project(':ddprof-lib').file('src/test/resources/native-libs')
def targetDir = project(':ddprof-lib').file('build/test/resources/native-libs/')

// Move the exec calls to the execution phase
doLast {
srcDir.eachDir { dir ->
def libName = dir.name
def libDir = file("${targetDir}/${libName}")
def libSrcDir = file("${srcDir}/${libName}")

exec {
commandLine "sh", "-c", """
echo "Processing library: ${libName} @ ${libSrcDir}"
mkdir -p ${libDir}
cd ${libSrcDir}
make TARGET_DIR=${libDir}
"""
}
}
}

def sourceDir = project(':ddprof-lib').file('src/test/resources/small-lib')
def targetDir = project(':ddprof-lib').file('build/test/resources/small-lib')

commandLine "sh", "-c", """
mkdir -p ${targetDir}
cd ${sourceDir} && g++ -fPIC -shared -o ${targetDir}/libsmall-lib.so *.cpp
"""

inputs.files fileTree(sourceDir) {
include '**/*.cpp'
}
outputs.file "${targetDir}/libsmall-lib.so"
inputs.files project(':ddprof-lib').files('src/test/resources/native-libs/**/*')
outputs.dir "${targetDir}"
}

def gtestAll = tasks.register("gtest") {
onlyIf {
hasGtest && !project.hasProperty('skip-tests') && !project.hasProperty('skip-native')
hasGtest && !project.hasProperty('skip-tests') && !project.hasProperty('skip-native') && !project.hasProperty('skip-gtest')
}
group = 'verification'
description = "Run all Google Tests for all build configurations of the library"
Expand All @@ -99,6 +94,7 @@ tasks.whenTaskAdded { task ->
def gtestCompileTask = tasks.register("compileGtest${config.name.capitalize()}_${testName}", CppCompile) {
onlyIf {
config.active && hasGtest && !project.hasProperty('skip-tests') && !project.hasProperty('skip-native')
&& !project.hasProperty('skip-gtest')
}
group = 'build'
description = "Compile the Google Test ${testName} for the ${config.name} build of the library"
Expand Down Expand Up @@ -156,6 +152,7 @@ tasks.whenTaskAdded { task ->
def gtestLinkTask = tasks.register("linkGtest${config.name.capitalize()}_${testName}", LinkExecutable) {
onlyIf {
config.active && hasGtest && !project.hasProperty('skip-tests') && !project.hasProperty('skip-native')
&& !project.hasProperty('skip-gtest')
}
group = 'build'
description = "Link the Google Test for the ${config.name} build of the library"
Expand All @@ -180,6 +177,7 @@ tasks.whenTaskAdded { task ->
def gtestExecuteTask = tasks.register("gtest${config.name.capitalize()}_${testName}", Exec) {
onlyIf {
config.active && hasGtest && !project.hasProperty('skip-tests') && !project.hasProperty('skip-native')
&& !project.hasProperty('skip-gtest')
}
group = 'verification'
description = "Run the Google Test ${testName} for the ${config.name} build of the library"
Expand All @@ -201,7 +199,7 @@ tasks.whenTaskAdded { task ->
gtestTask.get().dependsOn gtestExecuteTask.get()
if (os().isLinux()) {
// custom binaries for tests are built only on linux
gtestExecuteTask.get().dependsOn(buildResourcesTask, buildSmallLibTask)
gtestExecuteTask.get().dependsOn(buildNativeLibs)
}
gtestAll.get().dependsOn gtestExecuteTask.get()
}
Expand Down
22 changes: 9 additions & 13 deletions ddprof-lib/src/main/cpp/arch.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
/*
* Copyright 2017 Andrei Pangin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright The async-profiler authors
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef _ARCH_H
#define _ARCH_H

#include <stddef.h>

#ifndef unlikely
# define unlikely(x) (__builtin_expect(!!(x), 0))
#endif

#define callerPC() __builtin_return_address(0)

#ifdef _LP64
# define LP64_ONLY(code) code
#else // !_LP64
# define LP64_ONLY(code)
#endif // _LP64


typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
Expand Down
21 changes: 9 additions & 12 deletions ddprof-lib/src/main/cpp/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,21 +279,18 @@ Error Arguments::parse(const char *args) {

CASE("cstack")
if (value != NULL) {
switch (value[0]) {
case 'n':
_cstack = CSTACK_NO;
break;
case 'd':
if (strcmp(value, "fp") == 0) {
_cstack = CSTACK_FP;
} else if (strcmp(value, "dwarf") == 0) {
_cstack = CSTACK_DWARF;
break;
case 'l':
} else if (strcmp(value, "lbr") == 0) {
_cstack = CSTACK_LBR;
break;
case 'v':
} else if (strcmp(value, "vm") == 0) {
_cstack = CSTACK_VM;
break;
default:
_cstack = CSTACK_FP;
} else if (strcmp(value, "vmx") == 0) {
_cstack = CSTACK_VMX;
} else {
_cstack = CSTACK_NO;
}
}

Expand Down
13 changes: 7 additions & 6 deletions ddprof-lib/src/main/cpp/arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ enum Style {
};

enum CStack {
CSTACK_DEFAULT,
CSTACK_NO,
CSTACK_FP,
CSTACK_DWARF,
CSTACK_LBR,
CSTACK_VM
CSTACK_DEFAULT, // use perf_event_open stack if available or Frame Pointer links otherwise
CSTACK_NO, // do not collect native frames
CSTACK_FP, // walk stack using Frame Pointer links
CSTACK_DWARF, // use DWARF unwinding info from .eh_frame section
CSTACK_LBR, // Last Branch Record hardware capability
CSTACK_VM, // unwind using HotSpot VMStructs
CSTACK_VMX // same as CSTACK_VM but with intermediate native frames
};

enum Output { OUTPUT_NONE, OUTPUT_COLLAPSED, OUTPUT_JFR };
Expand Down
15 changes: 2 additions & 13 deletions ddprof-lib/src/main/cpp/callTraceStorage.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
/*
* Copyright 2020 Andrei Pangin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright The async-profiler authors
* SPDX-License-Identifier: Apache-2.0
*/

#include "callTraceStorage.h"
Expand Down
Loading

0 comments on commit 996507e

Please sign in to comment.