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