User:MarcusMueller/Message Debug: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Copy of original page)
 
(Removing the category tag from this draft)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Block Docs]]
Debug block for the message passing system.
Debug block for the message passing system.


The message debug block is used to capture and print or store messages as they are received. Any block that generates a message may connect that message port to one or more of the three message input ports of this debug block.
The message debug block is used to capture and print or store messages as they are received. Any block that generates a message may connect that message port to one or more of the message input ports of this debug block.


The message ports are:
The message ports are, if not showing the extended logging levels


* print: prints the message directly to standard out.
; log (new in 3.11)
* store: stores the message in an internal vector. It works in conjunction with a message_debug::get_message(size_t i) call that allows us to retrieve message i afterward.
: Uses the GNU Radio logging system to print the message contents. '''This is probably the input you want.'''
* print_pdu: specifically designed to handle formatted PDUs (see pdu.h). It discards messages that aren't PDU pairs (or are null).
; print
: Prints the message directly to standard out; verbose, not logged to any configured logging backends. You can suppress the printing of PDU data blob contents with the "Print PDU contents" option.
; store
: Stores the message in an internal vector. It works in conjunction with a <code>message_debug::get_message(size_t i)</code> call that allows us to retrieve message <code>i</code> afterwards.
; print_pdu (deprecated since 3.10, might be removed)
: Print the contents of the PDU (if a PDU)


== Parameters ==
== Parameters ==


None
; Print PDU contents
: Prints a hexdump of the contents of PDUs; if not set, only print the meta description and length
; Log level (new in 3.11)
: sets the log level to trace, debug, info, warning, error or critical
 


== Example Flowgraph ==
== Example Flowgraph ==
In this example, a Message Strobe block sends the string "Demo" once per second. It is displayed on the user terminal by the Message Debug block.
This program illustrates the usage of two messages debugs to log things at different log levels.


[[File:PUB_SUB_msg_demo.png]]
[[File:Message_debug.png]]
 
yielding this output:
<pre>
message_debug :info: Message: ((name . Throughput) (rate_now . 1.18012e+09) (rate_avg . 1.18012e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.14209e+09) (rate_avg . 1.17441e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.08271e+09) (rate_avg . 1.16066e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.09153e+09) (rate_avg . 1.15029e+09))
message_debug :info: Message: TEST
message_debug :info: Message: ((name . Throughput) (rate_now . 1.05336e+09) (rate_avg . 1.13575e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.06578e+09) (rate_avg . 1.12525e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.06676e+09) (rate_avg . 1.11648e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.12334e+09) (rate_avg . 1.11751e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.09542e+09) (rate_avg . 1.1142e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.00273e+09) (rate_avg . 1.09748e+09))
message_debug :info: Message: TEST
message_debug :info: Message: ((name . Throughput) (rate_now . 1.03877e+09) (rate_avg . 1.08867e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.0601e+09) (rate_avg . 1.08438e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.15669e+09) (rate_avg . 1.09523e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.14234e+09) (rate_avg . 1.1023e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.12055e+09) (rate_avg . 1.10503e+09))
message_debug :info: Message: TEST
message_debug :info: Message: ((name . Throughput) (rate_now . 1.13489e+09) (rate_avg . 1.10951e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.13598e+09) (rate_avg . 1.11348e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.15385e+09) (rate_avg . 1.11954e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.16601e+09) (rate_avg . 1.12651e+09))
message_debug :critical: Message: rare event
message_debug :info: Message: ((name . Throughput) (rate_now . 1.16408e+09) (rate_avg . 1.13214e+09))
message_debug :info: Message: TEST
message_debug :info: Message: ((name . Throug ……
</pre>


== Source Files ==
== Source Files ==


; C++ files
; C++ files
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/message_debug_impl.cc]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/message_debug_impl.cc]


; Header files
; Header files
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/message_debug_impl.h]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/lib/message_debug_impl.h]


; Public header files
; Public header files
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/include/gnuradio/blocks/message_debug.h]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/include/gnuradio/blocks/message_debug.h]


; Block definition
; Block definition
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/grc/blocks_message_debug.block.yml]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/grc/blocks_message_debug.block.yml]
 
; Example flowgraphs
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/examples/message_debug.grc]
: [https://github.com/gnuradio/gnuradio/blob/main/gr-blocks/examples/probe_rate_message_debug.grc]

Latest revision as of 15:48, 24 October 2023

Debug block for the message passing system.

The message debug block is used to capture and print or store messages as they are received. Any block that generates a message may connect that message port to one or more of the message input ports of this debug block.

The message ports are, if not showing the extended logging levels

log (new in 3.11)
Uses the GNU Radio logging system to print the message contents. This is probably the input you want.
print
Prints the message directly to standard out; verbose, not logged to any configured logging backends. You can suppress the printing of PDU data blob contents with the "Print PDU contents" option.
store
Stores the message in an internal vector. It works in conjunction with a message_debug::get_message(size_t i) call that allows us to retrieve message i afterwards.
print_pdu (deprecated since 3.10, might be removed)
Print the contents of the PDU (if a PDU)

Parameters

Print PDU contents
Prints a hexdump of the contents of PDUs; if not set, only print the meta description and length
Log level (new in 3.11)
sets the log level to trace, debug, info, warning, error or critical


Example Flowgraph

This program illustrates the usage of two messages debugs to log things at different log levels.

Message debug.png

yielding this output:

message_debug :info: Message: ((name . Throughput) (rate_now . 1.18012e+09) (rate_avg . 1.18012e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.14209e+09) (rate_avg . 1.17441e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.08271e+09) (rate_avg . 1.16066e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.09153e+09) (rate_avg . 1.15029e+09))
message_debug :info: Message: TEST
message_debug :info: Message: ((name . Throughput) (rate_now . 1.05336e+09) (rate_avg . 1.13575e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.06578e+09) (rate_avg . 1.12525e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.06676e+09) (rate_avg . 1.11648e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.12334e+09) (rate_avg . 1.11751e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.09542e+09) (rate_avg . 1.1142e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.00273e+09) (rate_avg . 1.09748e+09))
message_debug :info: Message: TEST
message_debug :info: Message: ((name . Throughput) (rate_now . 1.03877e+09) (rate_avg . 1.08867e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.0601e+09) (rate_avg . 1.08438e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.15669e+09) (rate_avg . 1.09523e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.14234e+09) (rate_avg . 1.1023e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.12055e+09) (rate_avg . 1.10503e+09))
message_debug :info: Message: TEST
message_debug :info: Message: ((name . Throughput) (rate_now . 1.13489e+09) (rate_avg . 1.10951e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.13598e+09) (rate_avg . 1.11348e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.15385e+09) (rate_avg . 1.11954e+09))
message_debug :info: Message: ((name . Throughput) (rate_now . 1.16601e+09) (rate_avg . 1.12651e+09))
message_debug :critical: Message: rare event
message_debug :info: Message: ((name . Throughput) (rate_now . 1.16408e+09) (rate_avg . 1.13214e+09))
message_debug :info: Message: TEST
message_debug :info: Message: ((name . Throug ……

Source Files

C++ files
[1]
Header files
[2]
Public header files
[3]
Block definition
[4]
Example flowgraphs
[5]
[6]