Fix indentation issues
This commit is contained in:
parent
31c5e6888d
commit
8c92dc2e76
@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
typedef struct my_igeom
|
typedef struct my_igeom
|
||||||
{
|
{
|
||||||
uint32_t facet_count;
|
uint32_t facet_count;
|
||||||
} my_igeom_t;
|
} my_igeom_t;
|
||||||
|
|
||||||
static void dummy_process_triangle(void* cookie,
|
static void dummy_process_triangle(void* cookie,
|
||||||
uint32_t triangle_id,
|
uint32_t triangle_id,
|
||||||
const gmio_stl_triangle_t* triangle)
|
const gmio_stl_triangle_t* triangle)
|
||||||
{
|
{
|
||||||
my_igeom_t* my_igeom = (my_igeom_t*)(cookie);
|
my_igeom_t* my_igeom = (my_igeom_t*)(cookie);
|
||||||
if (my_igeom != NULL)
|
if (my_igeom != NULL)
|
||||||
++(my_igeom->facet_count);
|
++(my_igeom->facet_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bench_gmio_stl_read(const char* filepath)
|
static void bench_gmio_stl_read(const char* filepath)
|
||||||
|
@ -10,34 +10,31 @@
|
|||||||
|
|
||||||
static void bench_occ_RWStl_ReadFile(const char* filepath)
|
static void bench_occ_RWStl_ReadFile(const char* filepath)
|
||||||
{
|
{
|
||||||
RWStl::ReadFile(OSD_Path(filepath));
|
RWStl::ReadFile(OSD_Path(filepath));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bench_gmio_stl_read(const char* filepath)
|
static void bench_gmio_stl_read(const char* filepath)
|
||||||
{
|
{
|
||||||
gmio_buffer_t buffer = gmio_buffer_malloc(256 * 1024);
|
gmio_buffer_t buffer = gmio_buffer_malloc(256 * 1024);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
int error = gmio_stl_read_file(filepath, &buffer, &mesh_creator);
|
int error = gmio_stl_read_file(filepath, &buffer, &mesh_creator);
|
||||||
if (error != GMIO_NO_ERROR)
|
if (error != GMIO_NO_ERROR)
|
||||||
printf("GeomIO error: 0x%X\n", error);
|
printf("GeomIO error: 0x%X\n", error);
|
||||||
|
|
||||||
gmio_buffer_deallocate(&buffer);
|
gmio_buffer_deallocate(&buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
benchmark(&bench_occ_RWStl_ReadFile,
|
benchmark(&bench_occ_RWStl_ReadFile,
|
||||||
"RWStl::ReadFile()",
|
"RWStl::ReadFile()",
|
||||||
argc - 1, argv + 1);
|
argc - 1, argv + 1);
|
||||||
|
|
||||||
benchmark(&bench_gmio_stl_read,
|
benchmark(&bench_gmio_stl_read,
|
||||||
"gmio_stl_read()",
|
"gmio_stl_read()",
|
||||||
argc - 1, argv + 1);
|
argc - 1, argv + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -4,22 +4,22 @@
|
|||||||
|
|
||||||
float elapsed_secs(clock_t start_tick)
|
float elapsed_secs(clock_t start_tick)
|
||||||
{
|
{
|
||||||
return (float)((clock() - start_tick) / (float)CLOCKS_PER_SEC);
|
return (float)((clock() - start_tick) / (float)CLOCKS_PER_SEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void benchmark(
|
void benchmark(
|
||||||
void (*func)(const char*), const char* title, int argc, char** argv)
|
void (*func)(const char*), const char* title, int argc, char** argv)
|
||||||
{
|
{
|
||||||
const clock_t start_tick = clock();
|
const clock_t start_tick = clock();
|
||||||
int iarg;
|
int iarg;
|
||||||
|
|
||||||
if (func == NULL)
|
if (func == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("Bench %s ...\n", title);
|
printf("Bench %s ...\n", title);
|
||||||
for (iarg = 0; iarg < argc; ++iarg) {
|
for (iarg = 0; iarg < argc; ++iarg) {
|
||||||
printf(" Read file %s ...\n", argv[iarg]);
|
printf(" Read file %s ...\n", argv[iarg]);
|
||||||
(*func)(argv[iarg]);
|
(*func)(argv[iarg]);
|
||||||
}
|
}
|
||||||
printf("\n %s exec time: %.2fs\n", title, elapsed_secs(start_tick));
|
printf("\n %s exec time: %.2fs\n", title, elapsed_secs(start_tick));
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ struct gmio_buffer
|
|||||||
|
|
||||||
/*! Optional pointer on function that deallocates the memory block \p ptr */
|
/*! Optional pointer on function that deallocates the memory block \p ptr */
|
||||||
void (*deallocate_func)(void* ptr);
|
void (*deallocate_func)(void* ptr);
|
||||||
|
|
||||||
};
|
};
|
||||||
typedef struct gmio_buffer gmio_buffer_t;
|
typedef struct gmio_buffer gmio_buffer_t;
|
||||||
|
|
||||||
|
@ -18,10 +18,12 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/*! Type alias for "pointer on function that allocates memory" (like standard malloc()) */
|
/*! Type alias for "pointer on function that allocates memory" (like standard
|
||||||
|
* malloc()) */
|
||||||
typedef void* (*gmio_malloc_func_t)(size_t);
|
typedef void* (*gmio_malloc_func_t)(size_t);
|
||||||
|
|
||||||
/*! Type alias for "pointer on function that frees memory" (like standard free()) */
|
/*! Type alias for "pointer on function that frees memory" (like standard
|
||||||
typedef void (*gmio_free_func_t)(void*);
|
* free()) */
|
||||||
|
typedef void (*gmio_free_func_t)(void*);
|
||||||
|
|
||||||
#endif /* GMIO_MEMORY_H */
|
#endif /* GMIO_MEMORY_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user