1\page mipi_syst_printer_page Instrumentation API Examples
2
3[TOC]
4
5SyS-T Protocol Printer {#mipi_syst_printer}
6==============================================================================
7The project includes a SyS-T data protocol pretty printer tool
8in the printer subdirectory. The printer is a standalone application
9written in C++11. It supports reading the output from instrumented
10applications using the example platform from the SyS-T
11instrumentation library.
12The tool scans the output for lines starting with ``SYS-T RAW DATA:`` and
13converts the hex dumps into binary data for decoding. The printer can
14be easily adapted to real trace data transports by replacing the code
15in ``printer/src/mipi_syst_main.cpp`` with an appropriate data reader.
16
17Building the Printer
18------------------------------------------------------------------------------
19The following transcript shows how to build the printer on a Linux console.
20The printer is a standalone application and independent from the
21instrumentation library or example projects.
22
23```
24$ cmake ../../sys-t/printer
25-- The C compiler identification is GNU 5.4.0
26-- The CXX compiler identification is GNU 5.4.0
27-- Check for working C compiler: /usr/bin/cc
28-- Check for working C compiler: /usr/bin/cc -- works
29-- Detecting C compiler ABI info
30-- Detecting C compiler ABI info - done
31-- Detecting C compile features
32-- Detecting C compile features - done
33-- Check for working CXX compiler: /usr/bin/c++
34-- Check for working CXX compiler: /usr/bin/c++ -- works
35-- Detecting CXX compiler ABI info
36-- Detecting CXX compiler ABI info - done
37-- Detecting CXX compile features
38-- Detecting CXX compile features - done
39-- Configuring done
40-- Generating done
41-- Build files have been written to: /users/mipi/prj/syst_build/printer
42
43$ make
44Scanning dependencies of target systprint
45[ 14%] Building CXX object CMakeFiles/systprint.dir/src/mipi_syst_main.cpp.o
46[ 28%] Building CXX object CMakeFiles/systprint.dir/src/mipi_syst_collateral.cpp.o
47[ 42%] Building CXX object CMakeFiles/systprint.dir/src/mipi_syst_printf.cpp.o
48[ 57%] Building CXX object CMakeFiles/systprint.dir/src/mipi_syst_decode.cpp.o
49[ 71%] Building CXX object CMakeFiles/systprint.dir/src/mipi_syst_message.cpp.o
50[100%] Linking CXX executable systprint
51[100%] Built target systprint
52```
53
54Testing the Printer
55------------------------------------------------------------------------------
56The printer project comes with a self test feature. The ``printer/test``
57directory contains reference input and output files collected using the
58``example/client`` example application. To run the printer test use the
59following command (or the cmake test driver command ``ctest``) in the
60printer build directory:
61
62```
63$ make test
64Running tests...
65Test project /users/mipi/prj/syst_build/printer
66    Start 1: print_client_example
671/3 Test #1: print_client_example ...............   Passed    0.01 sec
68    Start 2: diff_output_with_32bit_reference
692/3 Test #2: diff_output_with_32bit_reference ...   Passed    0.04 sec
70    Start 3: diff_output_with_64bit_reference
713/3 Test #3: diff_output_with_64bit_reference ...   Passed    0.03 sec
72
73100% tests passed, 0 tests failed out of 3
74
75Total Test time (real) =   0.11 sec
76```
77
78To actually see the printer output, run the printer directly using command
79line arguments, or indirectly through the test driver in verbose mode
80(```ctest --verbose```). The following transcript shows how to call the
81printer directly:
82
83```
84$systprint --short_guid {494E5443-8A9C-4014-A65A-2F36A36D96E4} --collateral ../../sys-t/printer/test/collateral.xml ../../sys-t/printer/test/input_client64.txt
85
86Decode Status,Payload,Type,Severity,Origin,Unit,Message TimeStamp,Context TimeStamp,Location,Raw Length,Checksum,Collateral
87OK,"0x0000000000010000 version banner string",BUILD:LONG,MAX,example,1,0x00054A4B376A70E9,0x0000000000000000,,62,0x4DDEF5B9,../../sys-t/printer/test/collateral.xml
88OK,"SyS-T Library version 1.0.0",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x0000000000000001,./systclient.c:64,48,0x7A34B527,../../sys-t/printer/test/collateral.xml
89OK,"+-------------------------------------------------------+",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x0000000000000002,./othersource.c:40,36,0x7CBB44B6,../../sys-t/printer/test/collateral.xml
90OK,"|               ____         _____   _______            |",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x0000000000000003,./othersource.c:41,36,0x2761EBF4,../../sys-t/printer/test/collateral.xml
91OK,"|              / ___|       / ____| |__   __|           |",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x0000000000000004,./othersource.c:42,36,0x55C63EAB,../../sys-t/printer/test/collateral.xml
92OK,"|             | |___  __  _| |___ _____| |              |",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x0000000000000005,./othersource.c:43,36,0xE3885FB4,../../sys-t/printer/test/collateral.xml
93OK,"|              \___ \| | | |\___ \_____| |              |",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x0000000000000006,./othersource.c:44,36,0x4C13A7F5,../../sys-t/printer/test/collateral.xml
94OK,"|              ____| | |_| |____| |    | |              |",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x0000000000000007,./othersource.c:45,36,0xE2C8BDC2,../../sys-t/printer/test/collateral.xml
95OK,"|             |_____/ \__| |_____/     |_|              |",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x0000000000000008,./othersource.c:46,36,0xD0734297,../../sys-t/printer/test/collateral.xml
96OK,"|                      _/ /                             |",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x0000000000000009,./othersource.c:47,36,0x6D704426,../../sys-t/printer/test/collateral.xml
97OK,"|                     |__/                              |",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x000000000000000A,./othersource.c:48,36,0x0A8FD609,../../sys-t/printer/test/collateral.xml
98OK,"+-------------------------------------------------------+",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x000000000000000B,./othersource.c:49,36,0x1E99CD8F,../../sys-t/printer/test/collateral.xml
99OK,"|    catalog Format  |         Printed Result           |",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A70E9,0x000000000000000C,./othersource.c:231,36,0xA17B5C1C,../../sys-t/printer/test/collateral.xml
100OK,"|---------------------------------strings---------------|",CATALOG:ID32P64,INFO,example,1,0x00054A4B376A74D1,0x000000000000000D,./othersource.c:232,36,0x11A215E6,../../sys-t/printer/test
101(...)
102$
103```