1 /*
2  * Trace Recorder for Tracealyzer v4.9.2
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_TCPIP_PORT
20  *
21  * @brief Specifies the TCP/IP port.
22  */
23 #define TRC_CFG_STREAM_PORT_TCPIP_PORT 8888
24 
25 /**
26  * @def TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER
27  *
28  * @brief This define will determine whether to use the internal buffer or not.
29  * If file writing creates additional trace events (i.e. it uses semaphores or mutexes),
30  * then the internal buffer must be enabled to avoid infinite recursion.
31  */
32 #define TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER 1
33 
34 /**
35  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_SIZE
36  *
37  * @brief Configures the size of the internal buffer if used.
38  */
39 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_SIZE 10240
40 
41 /**
42  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_WRITE_MODE
43  *
44  * @brief This should be set to TRC_INTERNAL_EVENT_BUFFER_OPTION_WRITE_MODE_DIRECT for best performance.
45  */
46 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_WRITE_MODE TRC_INTERNAL_EVENT_BUFFER_OPTION_WRITE_MODE_DIRECT
47 
48 /**
49  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_TRANSFER_MODE
50  *
51  * @brief Defines if the internal buffer will attempt to transfer all data each time or limit it to a chunk size.
52  */
53 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_TRANSFER_MODE TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_ALL
54 
55 /**
56  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_SIZE
57  *
58  * @brief Defines the maximum chunk size when transferring
59  * internal buffer events in chunks.
60  */
61 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_SIZE 1024
62 
63 /**
64  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT
65  *
66  * @brief Defines the number of transferred bytes needed to trigger another transfer.
67  * It also depends on TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT to set a maximum number
68  * of additional transfers this loop.
69  * This will increase throughput by immediately doing a transfer and not wait for another xTraceTzCtrl() loop.
70  */
71 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT 256
72 
73 /**
74  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT
75  *
76  * @brief Defines the maximum number of times to trigger another transfer before returning to xTraceTzCtrl().
77  * It also depends on TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT to see if a meaningful amount of data was
78  * transferred in the last loop.
79  * This will increase throughput by immediately doing a transfer and not wait for another xTraceTzCtrl() loop.
80  */
81 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT 5
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif /* TRC_STREAM_PORT_CONFIG_H */
88