1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** ThreadX Component */
17 /** */
18 /** Queue */
19 /** */
20 /**************************************************************************/
21 /**************************************************************************/
22
23 #define TX_SOURCE_CODE
24
25
26 /* Include necessary system files. */
27
28 #include "tx_api.h"
29 #include "tx_queue.h"
30 #ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
31 #include "tx_trace.h"
32 #endif
33
34
35 /**************************************************************************/
36 /* */
37 /* FUNCTION RELEASE */
38 /* */
39 /* _tx_queue_performance_system_info_get PORTABLE C */
40 /* 6.1 */
41 /* AUTHOR */
42 /* */
43 /* William E. Lamie, Microsoft Corporation */
44 /* */
45 /* DESCRIPTION */
46 /* */
47 /* This function retrieves queue system performance information. */
48 /* */
49 /* INPUT */
50 /* */
51 /* messages_sent Destination for total messages */
52 /* sent */
53 /* messages_received Destination for total messages */
54 /* received */
55 /* empty_suspensions Destination for total empty */
56 /* queue suspensions */
57 /* full_suspensions Destination for total full */
58 /* queue suspensions */
59 /* full_errors Destination for total queue full */
60 /* errors returned - no suspension */
61 /* timeouts Destination for total number of */
62 /* timeouts */
63 /* */
64 /* OUTPUT */
65 /* */
66 /* status Completion status */
67 /* */
68 /* CALLS */
69 /* */
70 /* None */
71 /* */
72 /* CALLED BY */
73 /* */
74 /* Application Code */
75 /* */
76 /* RELEASE HISTORY */
77 /* */
78 /* DATE NAME DESCRIPTION */
79 /* */
80 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
81 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
82 /* resulting in version 6.1 */
83 /* */
84 /**************************************************************************/
_tx_queue_performance_system_info_get(ULONG * messages_sent,ULONG * messages_received,ULONG * empty_suspensions,ULONG * full_suspensions,ULONG * full_errors,ULONG * timeouts)85 UINT _tx_queue_performance_system_info_get(ULONG *messages_sent, ULONG *messages_received,
86 ULONG *empty_suspensions, ULONG *full_suspensions, ULONG *full_errors, ULONG *timeouts)
87 {
88
89 #ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
90
91 TX_INTERRUPT_SAVE_AREA
92
93
94 /* Disable interrupts. */
95 TX_DISABLE
96
97 /* If trace is enabled, insert this event into the trace buffer. */
98 TX_TRACE_IN_LINE_INSERT(TX_TRACE_QUEUE_PERFORMANCE_SYSTEM_INFO_GET, 0, 0, 0, 0, TX_TRACE_QUEUE_EVENTS)
99
100 /* Log this kernel call. */
101 TX_EL_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_INSERT
102
103 /* Retrieve all the pertinent information and return it in the supplied
104 destinations. */
105
106 /* Retrieve the total number of queue messages sent. */
107 if (messages_sent != TX_NULL)
108 {
109
110 *messages_sent = _tx_queue_performance_messages_sent_count;
111 }
112
113 /* Retrieve the total number of queue messages received. */
114 if (messages_received != TX_NULL)
115 {
116
117 *messages_received = _tx_queue_performance__messages_received_count;
118 }
119
120 /* Retrieve the total number of empty queue suspensions. */
121 if (empty_suspensions != TX_NULL)
122 {
123
124 *empty_suspensions = _tx_queue_performance_empty_suspension_count;
125 }
126
127 /* Retrieve the total number of full queue suspensions. */
128 if (full_suspensions != TX_NULL)
129 {
130
131 *full_suspensions = _tx_queue_performance_full_suspension_count;
132 }
133
134 /* Retrieve the total number of full errors. */
135 if (full_errors != TX_NULL)
136 {
137
138 *full_errors = _tx_queue_performance_full_error_count;
139 }
140
141 /* Retrieve the total number of queue timeouts. */
142 if (timeouts != TX_NULL)
143 {
144
145 *timeouts = _tx_queue_performance_timeout_count;
146 }
147
148 /* Restore interrupts. */
149 TX_RESTORE
150
151 /* Return completion status. */
152 return(TX_SUCCESS);
153
154 #else
155
156 UINT status;
157
158
159 /* Access input arguments just for the sake of lint, MISRA, etc. */
160 if (messages_sent != TX_NULL)
161 {
162
163 /* Not enabled, return error. */
164 status = TX_FEATURE_NOT_ENABLED;
165 }
166 else if (messages_received != TX_NULL)
167 {
168
169 /* Not enabled, return error. */
170 status = TX_FEATURE_NOT_ENABLED;
171 }
172 else if (empty_suspensions != TX_NULL)
173 {
174
175 /* Not enabled, return error. */
176 status = TX_FEATURE_NOT_ENABLED;
177 }
178 else if (full_suspensions != TX_NULL)
179 {
180
181 /* Not enabled, return error. */
182 status = TX_FEATURE_NOT_ENABLED;
183 }
184 else if (full_errors != TX_NULL)
185 {
186
187 /* Not enabled, return error. */
188 status = TX_FEATURE_NOT_ENABLED;
189 }
190 else if (timeouts != TX_NULL)
191 {
192
193 /* Not enabled, return error. */
194 status = TX_FEATURE_NOT_ENABLED;
195 }
196 else
197 {
198
199 /* Not enabled, return error. */
200 status = TX_FEATURE_NOT_ENABLED;
201 }
202
203 /* Return completion status. */
204 return(status);
205 #endif
206 }
207
208