Fix indentation issues

This commit is contained in:
Hugues Delorme 2015-03-30 16:43:26 +02:00
parent 31c5e6888d
commit 8c92dc2e76
5 changed files with 30 additions and 32 deletions

View File

@ -5,16 +5,16 @@
typedef struct my_igeom
{
uint32_t facet_count;
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);
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)

View File

@ -10,34 +10,31 @@
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)
{
gmio_buffer_t buffer = gmio_buffer_malloc(256 * 1024);
Handle_StlMesh_Mesh mesh = new StlMesh_Mesh;
gmio_stl_mesh_creator_t mesh_creator = gmio_stl_occmesh_creator(mesh);
int 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_occ_RWStl_ReadFile,
"RWStl::ReadFile()",
argc - 1, argv + 1);
if (argc > 1) {
benchmark(&bench_occ_RWStl_ReadFile,
"RWStl::ReadFile()",
argc - 1, argv + 1);
benchmark(&bench_gmio_stl_read,
"gmio_stl_read()",
argc - 1, argv + 1);
}
benchmark(&bench_gmio_stl_read,
"gmio_stl_read()",
argc - 1, argv + 1);
}
return 0;
return 0;
}

View File

@ -4,22 +4,22 @@
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 (*func)(const char*), const char* title, int argc, char** argv)
{
const clock_t start_tick = clock();
int iarg;
const clock_t start_tick = clock();
int iarg;
if (func == NULL)
return;
if (func == NULL)
return;
printf("Bench %s ...\n", title);
for (iarg = 0; iarg < argc; ++iarg) {
printf(" Read file %s ...\n", argv[iarg]);
(*func)(argv[iarg]);
}
printf("\n %s exec time: %.2fs\n", title, elapsed_secs(start_tick));
printf("Bench %s ...\n", title);
for (iarg = 0; iarg < argc; ++iarg) {
printf(" Read file %s ...\n", argv[iarg]);
(*func)(argv[iarg]);
}
printf("\n %s exec time: %.2fs\n", title, elapsed_secs(start_tick));
}

View File

@ -35,7 +35,6 @@ struct gmio_buffer
/*! Optional pointer on function that deallocates the memory block \p ptr */
void (*deallocate_func)(void* ptr);
};
typedef struct gmio_buffer gmio_buffer_t;

View File

@ -18,10 +18,12 @@
#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);
/*! Type alias for "pointer on function that frees memory" (like standard free()) */
typedef void (*gmio_free_func_t)(void*);
/*! Type alias for "pointer on function that frees memory" (like standard
* free()) */
typedef void (*gmio_free_func_t)(void*);
#endif /* GMIO_MEMORY_H */