#define MAX_ARITY 10
#define MAX_CLS_SIZE 10
+/**
+ * For an explanation of these values see phi_stat_dump_pretty
+ */
enum vals_t {
I_ARG = 0,
I_CONST,
int i;
if (! (file = fopen(filename, "wt"))) {
- //TODO DBG((dbgmod, 0, "Cannot open file for writing\n"));
+ fprintf(stderr, "Cannot open file for writing: %s\n", filename);
return;
}
for (i = 0; i < ASIZE; i++) {
if (i >= I_ARITY_S && i <= I_ARITY_E)
- fprintf(file, "%i %i\n", stat[i], stat[I_ALL_NODES]);
+ fprintf(file, "%i %i\n", stat[i], stat[I_PHIS]);
+ else if (i >= I_CLS_SIZE_S && i <= I_CLS_SIZE_E)
+ fprintf(file, "%i %i\n", stat[i], stat[I_PHICLS]);
else
fprintf(file, "%i\n", stat[i]);
}
/**
* Updates a cumulative file with the current values.
*/
-static void update_file(char *filename) {
+void phi_stat_update(char *filename) {
int i;
FILE *all;
int vals[ASIZE];
+ if (!filename)
+ return;
+
/* read in */
all = fopen(filename, "rt");
if (all) {
for (i = 0; i < ASIZE; i++) {
if (i >= I_ARITY_S && i <= I_ARITY_E)
- fscanf(all, "%i %i\n", &vals[i], &vals[I_ALL_NODES]);
+ fscanf(all, "%i %i\n", &vals[i], &vals[I_PHIS]);
+ else if (i >= I_CLS_SIZE_S && i <= I_CLS_SIZE_E)
+ fscanf(all, "%i %i\n", &vals[i], &vals[I_PHICLS]);
else
fscanf(all, "%i\n", &vals[i]);
}
* Dumps the current contents of the values array to a file.
* Updates a cumulative file.
*/
-void phi_stat_dump(char *filename, char *cum_filename) {
+void phi_stat_dump(char *filename) {
if (filename)
dump_file(filename, curr_vals);
- if (cum_filename)
- update_file(cum_filename);
}
FILE *out;
if (! (out = fopen(filename, "wt"))) {
- //TODO DBG((dbgmod, 0, "Cannot open file for writing\n"));
+ fprintf(stderr, "Cannot open file for writing: %s\n", filename);
return;
}