mightymandel v16

GPU-based Mandelbrot set explorer

logging.c
Go to the documentation of this file.
1 // mightymandel -- GPU-based Mandelbrot Set explorer
2 // Copyright (C) 2012,2013,2014,2015 Claude Heiland-Allen
3 // License GPL3+ http://www.gnu.org/licenses/gpl.html
4 
5 #include <stdio.h>
6 #include <string.h>
7 
8 #include "render.h"
9 #include "logging.h"
10 #include "image.h"
11 
13 FILE *log_target = 0;
14 const char *log_prefix[7] = {
15  "OOPS\t",
16  "FATAL\t",
17  "ERROR\t",
18  "WARN\t",
19  "NOTICE\t",
20  "INFO\t",
21  "DEBUG\t"
22 };
23 
24 const char *result_name[5] = {
25  "ok",
26  "glitch",
27  "parse",
28  "deep",
29  "timeout"
30 };
31 
32 void log_result(const char *filename, enum result_t result, enum render_method_t method, double iterations, double exterior, double interior, double glitch, int passes) {
33  const char *basename = filename;
34  if (basename) { basename = strrchr(basename, '/'); }
35  if (basename) { basename++; }
36  if (! basename) { basename = filename; }
37  if (! basename) { basename = ""; }
38  // "# filename,result,method,iterations,exterior,interior,glitch,passes"
39  switch (result) {
40  case result_parse:
41  printf("%s,%s,,,,,,\n", basename, result_name[result]);
42  break;
43  case result_ok:
44  case result_glitch:
45  case result_timeout:
46  switch (method) {
47  case render_method_fp32:
48  case render_method_fp64:
49  printf("%s,%s,%s,%f,%f,%f,,\n", basename, result_name[result], render_method_name[method], iterations, exterior, interior);
50  break;
51  case render_method_fpxx:
52  printf("%s,%s,%s,%f,%f,%f,%f,%d\n", basename, result_name[result], render_method_name[method], iterations, exterior, interior, glitch, passes);
53  break;
54  }
55  break;
56  case result_deep:
57  printf("%s,%s,,,,,,\n", basename, result_name[result]);
58  break;
59  }
60 }