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