cli: Show trigger event in bits plugin.
This commit is contained in:
parent
57bbf56b84
commit
5045c217e6
|
@ -37,6 +37,7 @@ struct context {
|
||||||
int spl_cnt;
|
int spl_cnt;
|
||||||
uint8_t *linevalues;
|
uint8_t *linevalues;
|
||||||
char *header;
|
char *header;
|
||||||
|
int mark_trigger;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void flush_linebufs(struct context *ctx, char *outbuf)
|
static void flush_linebufs(struct context *ctx, char *outbuf)
|
||||||
|
@ -60,6 +61,12 @@ static void flush_linebufs(struct context *ctx, char *outbuf)
|
||||||
sprintf(outbuf + strlen(outbuf), "%*s:%s\n", max_probename_len,
|
sprintf(outbuf + strlen(outbuf), "%*s:%s\n", max_probename_len,
|
||||||
ctx->probelist[i], ctx->linebuf + i * ctx->linebuf_len);
|
ctx->probelist[i], ctx->linebuf + i * ctx->linebuf_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mark trigger with ^ */
|
||||||
|
if (ctx->mark_trigger != -1)
|
||||||
|
sprintf(outbuf + strlen(outbuf), "T:%*s^\n",
|
||||||
|
ctx->mark_trigger + (ctx->mark_trigger / 8), "");
|
||||||
|
|
||||||
memset(ctx->linebuf, 0, i * ctx->linebuf_len);
|
memset(ctx->linebuf, 0, i * ctx->linebuf_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +93,7 @@ static int init(struct output *o, int default_spl)
|
||||||
ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
|
ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
|
||||||
ctx->line_offset = 0;
|
ctx->line_offset = 0;
|
||||||
ctx->spl_cnt = 0;
|
ctx->spl_cnt = 0;
|
||||||
|
ctx->mark_trigger = -1;
|
||||||
|
|
||||||
if (o->param && o->param[0])
|
if (o->param && o->param[0])
|
||||||
ctx->samples_per_line = strtoul(o->param, NULL, 10);
|
ctx->samples_per_line = strtoul(o->param, NULL, 10);
|
||||||
|
@ -121,6 +129,7 @@ static int event(struct output *o, int event_type, char **data_out,
|
||||||
ctx = o->internal;
|
ctx = o->internal;
|
||||||
switch (event_type) {
|
switch (event_type) {
|
||||||
case DF_TRIGGER:
|
case DF_TRIGGER:
|
||||||
|
ctx->mark_trigger = ctx->spl_cnt;
|
||||||
break;
|
break;
|
||||||
case DF_END:
|
case DF_END:
|
||||||
outsize = ctx->num_enabled_probes
|
outsize = ctx->num_enabled_probes
|
||||||
|
@ -189,6 +198,7 @@ static int data_bits(struct output *o, char *data_in, uint64_t length_in,
|
||||||
if (ctx->spl_cnt >= ctx->samples_per_line) {
|
if (ctx->spl_cnt >= ctx->samples_per_line) {
|
||||||
flush_linebufs(ctx, outbuf);
|
flush_linebufs(ctx, outbuf);
|
||||||
ctx->line_offset = ctx->spl_cnt = 0;
|
ctx->line_offset = ctx->spl_cnt = 0;
|
||||||
|
ctx->mark_trigger = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue