Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Render a bin's topology and the capability negotiated on each pad. More...

Files

file  mpipe_dump.h
 Render a pipeline's topology for debugging.

Typedefs

typedef void(* mpipe_dump_print_t) (void *ctx, const char *str)
 Output callback of a dump.

Functions

int mpipe_dump_bin (struct mpipe_bin *bin, mpipe_dump_print_t print, void *ctx)
 Render a bin's topology and the capability on each of its pads.
int mpipe_dump_caps (const struct mpipe_structure *caps, mpipe_dump_print_t print, void *ctx)
 Render one capability on a single line.
const char * mpipe_dump_state_str (enum mpipe_state state)
 Name an element state.

Detailed Description

Render a bin's topology and the capability negotiated on each pad.

Renders a bin as a Graphviz graph: every element with its state, its pads as ports, the peer each pad is linked to and the capability that pad settled on. Negotiation is what logs show least well, so this is the tool for "what did each link agree on" and for "which pad is still unlinked".

The target emits text and the host lays it out. A board with no filesystem sends the text down its console and the graph is cut out of a serial capture:

sed -n '/^digraph/,/^}/p' capture.log > pipe.dot
dot -Tpng pipe.dot -o pipe.png

An element whose pads are not all linked is drawn with a red border, and one nothing reaches simply stands alone in the layout, so a broken graph shows itself without a separate report.

What is rendered is the graph as it is now, which is not always the graph the application built: an element may legitimately take itself out once it has nothing left to do, and a caps filter element does exactly that, relinking its neighbors to each other after negotiation and re-inserting itself on PAUSED to READY. A caps filter therefore shows up linked before a run and detached during one, and both readings are correct.

Nothing here allocates, and the walk holds no lock: a dump taken while the pipeline is changing state is a snapshot that may catch a pad mid-update. Dump from a settled state to read a settled answer.

Typedef Documentation

◆ mpipe_dump_print_t

typedef void(* mpipe_dump_print_t) (void *ctx, const char *str)

#include <mpipe_dump.h>

Output callback of a dump.

The dump renders one line at a time and hands each to the callback, so it needs no buffer of its own and can write wherever the caller wants: a shell instance, the console, or a buffer a test then asserts on.

Parameters
ctxThe context the dump was given, passed back untouched.
strOne rendered line, NUL-terminated, with its newline if the rendering has one there.

Function Documentation

◆ mpipe_dump_bin()

int mpipe_dump_bin ( struct mpipe_bin * bin,
mpipe_dump_print_t print,
void * ctx )

#include <mpipe_dump.h>

Render a bin's topology and the capability on each of its pads.

Parameters
binBin to render. A pipeline is one, cast to Bins.
printWhere to write, or NULL to write to the console with printk().
ctxPassed to print untouched.
Return values
0Success.

◆ mpipe_dump_caps()

int mpipe_dump_caps ( const struct mpipe_structure * caps,
mpipe_dump_print_t print,
void * ctx )

#include <mpipe_dump.h>

Render one capability on a single line.

Writes it as <video, format=RGBP, width=640, height=480>, a range as [min, max, step], a capability constraining nothing as <any> or <empty>. Every capability is delimited the same way, so one can be picked out of a line that carries other text after it. Ends without a newline, so a caller can put it where it wants.

Parameters
capsCapability to render.
printWhere to write, or NULL to write to the console with printk().
ctxPassed to print untouched.
Return values
0Success.

◆ mpipe_dump_state_str()

const char * mpipe_dump_state_str ( enum mpipe_state state)

#include <mpipe_dump.h>

Name an element state.

Parameters
stateState to name, see mpipe_state.
Returns
A short human-readable name, never NULL.