struct context *ctx;
unsigned int max_linelen, outsize, p, curbit, i;
uint64_t sample;
- static uint64_t samplecount = 0;
+ static uint64_t samplecount = 0, old_sample = 0;
char *outbuf, *c;
if (!o) {
}
for (i = 0; i <= length_in - ctx->unitsize; i += ctx->unitsize) {
+
memcpy(&sample, data_in + i, ctx->unitsize);
+ /*
+ * Don't output the same samples multiple times. However, make
+ * sure to output at least the first and last sample.
+ */
+ if (samplecount++ != 0 && sample == old_sample) {
+ if (i != (length_in - ctx->unitsize))
+ continue;
+ }
+ old_sample = sample;
+
/* The first column is a counter (needed for gnuplot). */
c = outbuf + strlen(outbuf);
sprintf(c, "%" PRIu64 "\t", samplecount++);