-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add google benchmark for NormalEstimation
- Loading branch information
Showing
5 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set(SUBSYS_NAME benchmarks) | ||
set(SUBSYS_DESC "Point cloud library benchmarks") | ||
set(SUBSYS_DEPS common features search kdtree io) | ||
set(DEFAULT ON) | ||
set(build TRUE) | ||
set(REASON "Enabled by default") | ||
PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") | ||
PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS}) | ||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") | ||
find_package(benchmark REQUIRED) | ||
add_executable(example example.cpp) | ||
target_link_libraries(example benchmark::benchmark pcl_io pcl_search pcl_features) | ||
#TODO set_target_properties? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <benchmark/benchmark.h> | ||
#include <pcl/features/normal_3d.h> // for NormalEstimation | ||
#include <pcl/io/pcd_io.h> // for PCDReader | ||
|
||
static void BM_NormalEstimation(benchmark::State& state) { | ||
// Perform setup here | ||
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>); | ||
pcl::PCDReader reader; | ||
reader.read ("/home/markus/pcd_files/milk_cartoon_all_small_clorox.pcd", *cloud); | ||
pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne; | ||
ne.setInputCloud (cloud); | ||
ne.setKSearch (100); | ||
pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>); | ||
for (auto _ : state) { | ||
// This code gets timed | ||
ne.compute (*cloud_normals); | ||
} | ||
} | ||
// Register the function as a benchmark | ||
BENCHMARK(BM_NormalEstimation); | ||
// Run the benchmark | ||
BENCHMARK_MAIN(); |