1 /*
2  * Trace Recorder for Tracealyzer v4.10.3
3  * Copyright 2023 Percepio AB
4  * www.percepio.com
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * The configuration for trace streaming ("stream ports").
9  */
10 
11 #ifndef TRC_STREAM_PORT_CONFIG_H
12 #define TRC_STREAM_PORT_CONFIG_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 /**
19  * @def TRC_CFG_STREAM_PORT_UDP_ADDRESS
20  *
21  * @brief Specifies the UDP address.
22  */
23 #define TRC_CFG_STREAM_PORT_UDP_ADDRESS "192.168.1.100"
24 
25 /**
26  * @def TRC_CFG_STREAM_PORT_UDP_PORT
27  *
28  * @brief Specifies the UDP port.
29  */
30 #define TRC_CFG_STREAM_PORT_UDP_PORT 8888
31 
32 /**
33  * @def TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER
34  *
35  * @brief This define will determine whether to use the internal buffer or not.
36  * If file writing creates additional trace events (i.e. it uses semaphores or mutexes),
37  * then the internal buffer must be enabled to avoid infinite recursion.
38  */
39 #define TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER 1
40 
41 /**
42  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_SIZE
43  *
44  * @brief Configures the size of the internal buffer if used.
45  */
46 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_SIZE 10240
47 
48 /**
49  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_WRITE_MODE
50  *
51  * @brief This should be set to TRC_INTERNAL_EVENT_BUFFER_OPTION_WRITE_MODE_DIRECT for best performance.
52  */
53 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_WRITE_MODE TRC_INTERNAL_EVENT_BUFFER_OPTION_WRITE_MODE_DIRECT
54 
55 /**
56  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_TRANSFER_MODE
57  *
58  * @brief Defines if the internal buffer will attempt to transfer all data each time or limit it to a chunk size.
59  */
60 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_TRANSFER_MODE TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_ALL
61 
62 /**
63  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_SIZE
64  *
65  * @brief Defines the maximum chunk size when transferring
66  * internal buffer events in chunks.
67  */
68 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_SIZE 1024
69 
70 /**
71  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT
72  *
73  * @brief Defines the number of transferred bytes needed to trigger another transfer.
74  * It also depends on TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT to set a maximum number
75  * of additional transfers this loop.
76  * This will increase throughput by immediately doing a transfer and not wait for another xTraceTzCtrl() loop.
77  */
78 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT 256
79 
80 /**
81  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT
82  *
83  * @brief Defines the maximum number of times to trigger another transfer before returning to xTraceTzCtrl().
84  * It also depends on TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT to see if a meaningful amount of data was
85  * transferred in the last loop.
86  * This will increase throughput by immediately doing a transfer and not wait for another xTraceTzCtrl() loop.
87  */
88 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT 5
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* TRC_STREAM_PORT_CONFIG_H */
95