Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ IncludeCategories:
# DART library headers (with angle brackets) - ordered from high-level to low-level
- Regex: '^<dart\/config\.hpp>$' # config first
Priority: 10
- Regex: '^<dart7\/fwd\.hpp>$' # dart7 forward declarations first
Priority: 11
- Regex: '^<dart7\/.*\.h(pp)?>$' # other dart7 headers
Priority: 12
- Regex: '^<dart\/test\/.*\.h(pp)?>$' # test utilities
Priority: 20
- Regex: '^<dart\/python\/.*\.h(pp)?>$' # bindings
Expand Down Expand Up @@ -99,24 +103,6 @@ IncludeCategories:
- Regex: '^<dart\/external\/.*\.h(pp)?>$' # external dependencies
Priority: 50

# DART7 experimental library headers (angle brackets)
- Regex: '^<dart7\/version\.hpp>$' # core version info
Priority: 60
- Regex: '^<dart7\/common\/.*\.h(pp)?>$' # common utilities
Priority: 61
- Regex: '^<dart7\/space\/.*\.h(pp)?>$' # state space utilities
Priority: 62
- Regex: '^<dart7\/frame\/.*\.h(pp)?>$' # frame subsystem
Priority: 63
- Regex: '^<dart7\/multi_body\/.*\.h(pp)?>$' # multibody subsystem
Priority: 64
- Regex: '^<dart7\/.*\.h(pp)?>$' # other dart7 headers
Priority: 70

# dartpy7 experimental bindings
- Regex: '^<dartpy7\/.*\.h(pp)?>$'
Priority: 80

# 3rd-party headers
- Regex: '^<.*\.h(pp)?>$'
Priority: 50
Expand Down
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ set(DART_PKG_EXTERNAL_DEPS "assimp, ccd, eigen3, fcl, octomap")
#===============================================================================
# Build options
#===============================================================================

# DART 7.0 options
option(DART7_VERBOSE "Show detailed DART7 dependency information" OFF)

if(MSVC)
set(DART_RUNTIME_LIBRARY "/MD" CACHE STRING "BaseName chosen by the user at CMake configure time")
set_property(CACHE DART_RUNTIME_LIBRARY PROPERTY STRINGS /MD /MT)
Expand Down Expand Up @@ -163,7 +167,6 @@ dart_option(DART_USE_SYSTEM_IMGUI
dart_option(DART_USE_SYSTEM_GOOGLEBENCHMARK "Use system GoogleBenchmark" OFF CATEGORY system)
dart_option(DART_USE_SYSTEM_GOOGLETEST "Use system GoogleTest" OFF CATEGORY system)
dart_option(DART_USE_SYSTEM_PYBIND11 "Use system pybind11" OFF CATEGORY system)
dart_option(DART_USE_SYSTEM_NANOBIND "Use system nanobind" OFF CATEGORY system)
dart_option(DART_USE_SYSTEM_TRACY "Use system Tracy" OFF CATEGORY system)
dart_option(DART_VERBOSE "Whether print detailed information in CMake process" OFF CATEGORY diagnostics)
dart_option(DART_BUILD_DART7 "Build experimental DART7 library" OFF CATEGORY build)
Expand Down Expand Up @@ -460,6 +463,14 @@ add_subdirectory(dart)

if(DART_BUILD_DART7)
add_subdirectory(dart7)

if(MSVC)
add_subdirectory(tests_dart7)
add_subdirectory(examples_dart7)
else()
add_subdirectory(tests_dart7 EXCLUDE_FROM_ALL)
add_subdirectory(examples_dart7 EXCLUDE_FROM_ALL)
endif()
endif()

set(DART_IN_SOURCE_BUILD TRUE)
Expand Down
56 changes: 56 additions & 0 deletions benchmarks_dart7/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright (c) 2011-2025, The DART development contributors
# All rights reserved.
#
# The list of contributors can be found at:
# https://github.com/dartsim/dart/blob/main/LICENSE
#
# This file is provided under the "BSD-style" License

# DART 7.0 Benchmarks
#
# Simply list benchmark files here. The benchmark name is derived from filename.
# Example: bm_profiling.cpp -> bm_profiling
#
# Since benchmarks_dart7/ is a sibling to dart7/ (not a subdirectory), we need to
# include dependencies and helper functions here.

cmake_minimum_required(VERSION 3.22.1)

# Include dart7 utility functions (must come first to define dart7_find_package)
include(dart7_defs)

# Include dependency finding (makes benchmark available)
include(dart7_dependencies)

if(NOT DART7_BUILD_BENCHMARKS)
message(STATUS "dart7: Benchmarks disabled (benchmark not found)")
return()
endif()

message(STATUS "dart7: Configuring benchmarks...")

#==============================================================================
# Benchmark List
#==============================================================================
# To add a new benchmark, simply add the filename to this list

set(DART7_BENCHMARKS
bm_profiling.cpp
)

# Register all benchmarks
foreach(bm_file ${DART7_BENCHMARKS})
# Extract benchmark name from filename (remove .cpp extension)
get_filename_component(bm_name ${bm_file} NAME_WE)
dart7_add_benchmark(${bm_name} ${CMAKE_CURRENT_SOURCE_DIR}/${bm_file})
list(APPEND DART7_BENCHMARK_TARGETS ${bm_name})
endforeach()

# Create meta target for all benchmarks
add_custom_target(dart7_benchmarks
DEPENDS ${DART7_BENCHMARK_TARGETS}
COMMENT "Building all DART7 benchmarks"
)

list(LENGTH DART7_BENCHMARKS num_benchmarks)
message(STATUS "dart7: ${num_benchmarks} benchmark(s)")
82 changes: 82 additions & 0 deletions benchmarks_dart7/bm_profiling.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2011-2025, The DART development contributors
* All rights reserved.
*
* The list of contributors can be found at:
* https://github.com/dartsim/dart/blob/main/LICENSE
*
* This file is provided under the following "BSD-style" License:
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include <benchmark/benchmark.h>
#include <dart7/common/profiling.hpp>

#include <cmath>

using namespace dart7::common;

// Benchmark ScopedTimer overhead
static void BM_ScopedTimerOverhead(benchmark::State& state)
{
ProfileStats::reset();

for (auto _ : state) {
DART7_PROFILE_SCOPE("test");
}
}
BENCHMARK(BM_ScopedTimerOverhead);

// Benchmark profiling with actual work
static void BM_ProfilingWithWork(benchmark::State& state)
{
ProfileStats::reset();

for (auto _ : state) {
DART7_PROFILE_SCOPE("computation");
volatile double result = 0.0;
for (int i = 0; i < state.range(0); ++i) {
result += std::sin(i * 0.001);
}
}
}
BENCHMARK(BM_ProfilingWithWork)->Range(8, 8 << 10);

// Benchmark manual profiling
static void BM_ManualProfiling(benchmark::State& state)
{
ProfileStats::reset();

for (auto _ : state) {
DART7_PROFILE_BEGIN(manual);
volatile double result = 0.0;
for (int i = 0; i < 100; ++i) {
result += i;
}
DART7_PROFILE_END(manual);
}
}
BENCHMARK(BM_ManualProfiling);

BENCHMARK_MAIN();
Loading
Loading