sourcestats: save asymmetry run in dump files

This allows the asymmetry correction to be applied right after restart.
This commit is contained in:
Miroslav Lichvar 2016-12-12 14:39:56 +01:00
parent fac1093ebf
commit 95a4f33265

View file

@ -844,6 +844,8 @@ SST_SaveToFile(SST_Stats inst, FILE *out)
inst->strata[j]); inst->strata[j]);
} }
fprintf(out, "%d\n", inst->asymmetry_run);
} }
/* ================================================== */ /* ================================================== */
@ -898,6 +900,10 @@ SST_LoadFromFile(SST_Stats inst, FILE *in)
UTI_NormaliseTimespec(&inst->sample_times[i]); UTI_NormaliseTimespec(&inst->sample_times[i]);
} }
} }
/* This field was not saved in older versions */
if (!fgets(line, sizeof(line), in) || sscanf(line, "%d\n", &inst->asymmetry_run) != 1)
inst->asymmetry_run = 0;
} else { } else {
inst->n_samples = 0; /* Load abandoned if any sign of corruption */ inst->n_samples = 0; /* Load abandoned if any sign of corruption */
return 0; return 0;