From 2260c97d1a6f6d66f8e093988cb80db02b1c8b26 Mon Sep 17 00:00:00 2001 From: JP Appel Date: Thu, 25 Apr 2024 20:14:07 -0400 Subject: update performance print to show more information --- README.md | 6 ++++-- TODO.md | 6 +++--- src/fractals.c | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 115197d..fe1db82 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,10 @@ If you wish to compile with additional floating point precision, add `-DEXTENDED ### Running Any version of the program can be used to generate a visualizer compatible `.grid` file. -All versions of the program support the same command line arguments -The performance flag outputs information in the format of `,,`. +All versions of the program support the same command line arguments. + +The performance flag outputs information in the format of +`,,,,,,,,`. Note that the runtime is an average runtime from multiple runs. The number of runs can be adjusted directly in `src/fractals.c` in `NUM_RUNS` or passed set in `CPPFLAGS` by adding `-DNUM_RUNS=N` diff --git a/TODO.md b/TODO.md index a57e378..fa255bd 100644 --- a/TODO.md +++ b/TODO.md @@ -6,9 +6,9 @@ * [x] read/write grids to/from file * [ ] create image with libgd * [ ] create animation with libgd -* [ ] code refactor - * [ ] change functions so that complex_t is passed instead of complex from - * [ ] store the size of lower_left and upper_right before the values of lower_left and upper_right in the .grid format +* [x] code refactor + * [x] change functions so that complex_t is passed instead of complex from + * [x] store the size of lower_left and upper_right before the values of lower_left and upper_right in the .grid format * [x] write serial * [x] mandelbrot * [x] multibrot diff --git a/src/fractals.c b/src/fractals.c index 6b4c67a..7f1f605 100644 --- a/src/fractals.c +++ b/src/fractals.c @@ -67,7 +67,7 @@ int main(const int argc, char *argv[]) { bool verbose = false; bool performance = false; grid_gen_params* params; - char* fractal_name; + char* fractal_name = "mandelbrot"; fractal_generator generator = mandelbrot_grid; char* output_filename = "fractal.grid"; @@ -176,13 +176,14 @@ int main(const int argc, char *argv[]) { zoom_grid(grid, magnification); } - // TODO: make additional param to fractals that take these in - generator(grid, params); if(performance){ double time = time_fractal(generator, grid, params); - printf("%s,%f\n", fractal_name, time); + printf("%s,%s,%zu,%zu," + CFORMAT","CFORMAT","CFORMAT","CFORMAT",%f\n", + argv[0], fractal_name, x_res, y_res, + lower_left.re, lower_left.im, upper_right.re, upper_right.im, time); } if(verbose){ -- cgit v1.2.3