= babeltrace2-sink.utils.counter(7)
:manpagetype: component class
:revdate: 14 September 2019


== NAME

babeltrace2-sink.utils.counter - Babeltrace 2's message counter sink
component class


== DESCRIPTION

A Babeltrace~2 compcls:sink.utils.counter component prints to the
standard output the number of messages it consumes with a count for each
type.

----
            +--------------------+
            | sink.utils.counter |
            |                    +--> Statistics to the
Messages -->@ in                 |    standard output
            +--------------------+
----

include::common-see-babeltrace2-intro.txt[]

The component's output looks like this:

----
        3842964 Event messages
              4 Stream beginning messages
              1 Stream end messages
             18 Packet beginning messages
             14 Packet end messages
            189 Discarded event messages
              0 Discarded packet messages
              3 Message iterator inactivity messages
        3843000 messages (TOTAL)
----

By default, a compcls:sink.utils.counter component prints a new block of
statistics every 1000 consumed messages, whatever their types. You can
use the param:step parameter to override this default period.

The component always prints a block of statistics when there's no more
messages to consume from its upstream message iterator and the last
block was different.

By default, a compcls:sink.utils.counter component prints the count of
messages for each type, even if this count is 0. You can make it hide
the zero counts with the param:hide-zero parameter.


== INITIALIZATION PARAMETERS

param:hide-zero=`yes` vtype:[optional boolean]::
    Do not print the statistics lines where the count is zero.

param:step='STEP' vtype:[optional unsigned integer]::
    Print a new block of statistics every 'STEP' consumed messages
    instead of 1000.
+
If 'STEP' is 0, then the component only prints statistics when there's
no more messages to consume.


== PORTS

----
+--------------------+
| sink.utils.counter |
|                    |
@ in                 |
+--------------------+
----


=== Input

`in`::
    Single input port.


include::common-footer.txt[]


== SEE ALSO

man:babeltrace2-intro(7),
man:babeltrace2-plugin-utils(7)
