benchs: add bench_gmio
This commit is contained in:
parent
d3f4062bc8
commit
31c5e6888d
@ -30,18 +30,22 @@ set(GMIO_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Directory where the GeomIO library
|
|||||||
# List source files in commons/
|
# List source files in commons/
|
||||||
file(GLOB COMMONS_FILES commons/*)
|
file(GLOB COMMONS_FILES commons/*)
|
||||||
set(COMMONS_FILES ${COMMONS_FILES})
|
set(COMMONS_FILES ${COMMONS_FILES})
|
||||||
#add_definitions(-DGMIO_HAVE_STDINT_H)
|
# TODO: check if GMIO_HAVE_STDINT_H is required or not
|
||||||
|
add_definitions(-DGMIO_HAVE_STDINT_H)
|
||||||
|
|
||||||
|
include_directories(${GMIO_DIR}/include)
|
||||||
|
link_libraries(${GMIO_DIR}/lib/gmio.lib)
|
||||||
|
|
||||||
|
add_executable(bench_gmio bench_gmio/main.c ${COMMONS_FILES})
|
||||||
|
|
||||||
if(BENCHMARK_ASSIMP)
|
if(BENCHMARK_ASSIMP)
|
||||||
add_executable(bench_assimp bench_assimp/main.cpp ${COMMONS_FILES})
|
add_executable(bench_assimp bench_assimp/main.cpp ${COMMONS_FILES})
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
bench_assimp
|
bench_assimp
|
||||||
PUBLIC ${ASSIMP_DIR}/include
|
PUBLIC ${ASSIMP_DIR}/include)
|
||||||
PUBLIC ${GMIO_DIR}/include)
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
bench_assimp
|
bench_assimp
|
||||||
${ASSIMP_DIR}/lib64/assimp.lib
|
${ASSIMP_DIR}/lib64/assimp.lib)
|
||||||
${GMIO_DIR}/lib/gmio.lib)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BENCHMARK_OPENCASCADE)
|
if(BENCHMARK_OPENCASCADE)
|
||||||
@ -49,17 +53,18 @@ if(BENCHMARK_OPENCASCADE)
|
|||||||
bench_occ/main.cpp
|
bench_occ/main.cpp
|
||||||
${GMIO_DIR}/src/gmio_support/occ_libstl.cpp
|
${GMIO_DIR}/src/gmio_support/occ_libstl.cpp
|
||||||
${COMMONS_FILES})
|
${COMMONS_FILES})
|
||||||
add_definitions(-D_OCC64 -DWNT)
|
target_compile_definitions(
|
||||||
|
bench_occ
|
||||||
|
PUBLIC _OCC64 # TODO: define only if target arch is 64b
|
||||||
|
PUBLIC WNT) # TODO: define only if target OS is Windows
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
bench_occ
|
bench_occ
|
||||||
PUBLIC ${OPENCASCADE_DIR}/inc
|
PUBLIC ${OPENCASCADE_DIR}/inc)
|
||||||
PUBLIC ${GMIO_DIR}/include)
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
bench_occ
|
bench_occ
|
||||||
${OPENCASCADE_DIR}/win64/vc11/lib/TKernel.lib
|
${OPENCASCADE_DIR}/win64/vc11/lib/TKernel.lib
|
||||||
${OPENCASCADE_DIR}/win64/vc11/lib/TKMath.lib
|
${OPENCASCADE_DIR}/win64/vc11/lib/TKMath.lib
|
||||||
${OPENCASCADE_DIR}/win64/vc11/lib/TKSTL.lib
|
${OPENCASCADE_DIR}/win64/vc11/lib/TKSTL.lib)
|
||||||
${GMIO_DIR}/lib/gmio.lib)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,10 +142,7 @@ static void gmio_assimp_end_solid(void* cookie)
|
|||||||
|
|
||||||
static void bench_gmio_stl_read(const char* filepath)
|
static void bench_gmio_stl_read(const char* filepath)
|
||||||
{
|
{
|
||||||
// void* mbuffer = std::malloc(512 * 1024);
|
gmio_buffer_t buffer = gmio_buffer_malloc(256 * 1024);
|
||||||
// gmio_buffer_t buffer = gmio_buffer(mbuffer, 512 * 1024);
|
|
||||||
char mbuffer[256 * 1024];
|
|
||||||
gmio_buffer_t buffer = gmio_buffer(&mbuffer[0], sizeof(mbuffer));
|
|
||||||
|
|
||||||
aiScene scene;
|
aiScene scene;
|
||||||
gmio_stl_mesh_creator_t mesh_creator = { 0 };
|
gmio_stl_mesh_creator_t mesh_creator = { 0 };
|
||||||
@ -159,7 +156,7 @@ static void bench_gmio_stl_read(const char* filepath)
|
|||||||
if (error != GMIO_NO_ERROR)
|
if (error != GMIO_NO_ERROR)
|
||||||
printf("GeomIO error: 0x%X\n", error);
|
printf("GeomIO error: 0x%X\n", error);
|
||||||
|
|
||||||
//std::free(mbuffer);
|
gmio_buffer_deallocate(&buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
45
benchs/bench_gmio/main.c
Normal file
45
benchs/bench_gmio/main.c
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#include <gmio_core/error.h>
|
||||||
|
#include <gmio_stl/stl_io.h>
|
||||||
|
|
||||||
|
#include "../commons/bench_tools.h"
|
||||||
|
|
||||||
|
typedef struct my_igeom
|
||||||
|
{
|
||||||
|
uint32_t facet_count;
|
||||||
|
} my_igeom_t;
|
||||||
|
|
||||||
|
static void dummy_process_triangle(void* cookie,
|
||||||
|
uint32_t triangle_id,
|
||||||
|
const gmio_stl_triangle_t* triangle)
|
||||||
|
{
|
||||||
|
my_igeom_t* my_igeom = (my_igeom_t*)(cookie);
|
||||||
|
if (my_igeom != NULL)
|
||||||
|
++(my_igeom->facet_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bench_gmio_stl_read(const char* filepath)
|
||||||
|
{
|
||||||
|
gmio_buffer_t buffer = gmio_buffer_malloc(512 * 1024);
|
||||||
|
my_igeom_t cookie = { 0 };
|
||||||
|
gmio_stl_mesh_creator_t mesh_creator = { 0 };
|
||||||
|
int error = GMIO_NO_ERROR;
|
||||||
|
|
||||||
|
mesh_creator.cookie = &cookie;
|
||||||
|
mesh_creator.add_triangle_func = dummy_process_triangle;
|
||||||
|
|
||||||
|
error = gmio_stl_read_file(filepath, &buffer, &mesh_creator);
|
||||||
|
if (error != GMIO_NO_ERROR)
|
||||||
|
printf("GeomIO error: 0x%X\n", error);
|
||||||
|
|
||||||
|
gmio_buffer_deallocate(&buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
if (argc > 1) {
|
||||||
|
benchmark(&bench_gmio_stl_read,
|
||||||
|
"gmio_stl_read_file()",
|
||||||
|
argc - 1, argv + 1);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
@ -1,21 +0,0 @@
|
|||||||
include(../../qmake/config.pri)
|
|
||||||
|
|
||||||
CONFIG -= build_all
|
|
||||||
|
|
||||||
*-g++*:QMAKE_CFLAGS += -ansi -pedantic-errors
|
|
||||||
|
|
||||||
TEMPLATE = app
|
|
||||||
TARGET = bench_libstl$$TARGET_SUFFIX
|
|
||||||
|
|
||||||
INCLUDEPATH += $$GMIO_ROOT/include
|
|
||||||
|
|
||||||
HEADERS += ../commons/bench_tools.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
../commons/bench_tools.c \
|
|
||||||
main.c
|
|
||||||
|
|
||||||
DEFINES += GMIO_USE_STDINT_H
|
|
||||||
|
|
||||||
LIBS += -L$$GMIO_ROOT/lib -lgmio$$TARGET_SUFFIX
|
|
||||||
QMAKE_RPATHDIR += $$GMIO_ROOT/lib
|
|
@ -15,10 +15,7 @@ static void bench_occ_RWStl_ReadFile(const char* filepath)
|
|||||||
|
|
||||||
static void bench_gmio_stl_read(const char* filepath)
|
static void bench_gmio_stl_read(const char* filepath)
|
||||||
{
|
{
|
||||||
// void* mbuffer = std::malloc(512 * 1024);
|
gmio_buffer_t buffer = gmio_buffer_malloc(256 * 1024);
|
||||||
// gmio_buffer_t buffer = gmio_buffer(mbuffer, 512 * 1024);
|
|
||||||
char mbuffer[256 * 1024];
|
|
||||||
gmio_buffer_t buffer = gmio_buffer(&mbuffer[0], sizeof(mbuffer));
|
|
||||||
|
|
||||||
Handle_StlMesh_Mesh mesh = new StlMesh_Mesh;
|
Handle_StlMesh_Mesh mesh = new StlMesh_Mesh;
|
||||||
gmio_stl_mesh_creator_t mesh_creator = gmio_stl_occmesh_creator(mesh);
|
gmio_stl_mesh_creator_t mesh_creator = gmio_stl_occmesh_creator(mesh);
|
||||||
@ -27,7 +24,7 @@ static void bench_gmio_stl_read(const char* filepath)
|
|||||||
if (error != GMIO_NO_ERROR)
|
if (error != GMIO_NO_ERROR)
|
||||||
printf("GeomIO error: 0x%X\n", error);
|
printf("GeomIO error: 0x%X\n", error);
|
||||||
|
|
||||||
//std::free(mbuffer);
|
gmio_buffer_deallocate(&buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user