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 /**   Module                                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define TXM_MODULE
24 #include "txm_module.h"
25 #ifndef TXM_THREAD_PERFORMANCE_INFO_GET_CALL_NOT_USED
26 /**************************************************************************/
27 /*                                                                        */
28 /*  FUNCTION                                               RELEASE        */
29 /*                                                                        */
30 /*    _tx_thread_performance_info_get                     PORTABLE C      */
31 /*                                                           6.1.10       */
32 /*  AUTHOR                                                                */
33 /*                                                                        */
34 /*    Scott Larson, Microsoft Corporation                                 */
35 /*                                                                        */
36 /*  DESCRIPTION                                                           */
37 /*                                                                        */
38 /*    This function retrieves performance information from the specified  */
39 /*    thread.                                                             */
40 /*                                                                        */
41 /*  INPUT                                                                 */
42 /*                                                                        */
43 /*    thread_ptr                        Pointer to thread control block   */
44 /*    resumptions                       Destination for number of times   */
45 /*                                        thread was resumed              */
46 /*    suspensions                       Destination for number of times   */
47 /*                                        thread was suspended            */
48 /*    solicited_preemptions             Destination for number of times   */
49 /*                                        thread called another service   */
50 /*                                        that resulted in preemption     */
51 /*    interrupt_preemptions             Destination for number of times   */
52 /*                                        thread was preempted by another */
53 /*                                        thread made ready in Interrupt  */
54 /*                                        Service Routine (ISR)           */
55 /*    priority_inversions               Destination for number of times   */
56 /*                                        a priority inversion was        */
57 /*                                        detected for this thread        */
58 /*    time_slices                       Destination for number of times   */
59 /*                                        thread was time-sliced          */
60 /*    relinquishes                      Destination for number of thread  */
61 /*                                        relinquishes                    */
62 /*    timeouts                          Destination for number of timeouts*/
63 /*                                        for thread                      */
64 /*    wait_aborts                       Destination for number of wait    */
65 /*                                        aborts for thread               */
66 /*    last_preempted_by                 Destination for pointer of the    */
67 /*                                        thread that last preempted this */
68 /*                                        thread                          */
69 /*                                                                        */
70 /*  OUTPUT                                                                */
71 /*                                                                        */
72 /*    status                            Completion status                 */
73 /*                                                                        */
74 /*  CALLS                                                                 */
75 /*                                                                        */
76 /*    _txm_module_kernel_call_dispatcher                                  */
77 /*                                                                        */
78 /*  CALLED BY                                                             */
79 /*                                                                        */
80 /*    Module application code                                             */
81 /*                                                                        */
82 /*  RELEASE HISTORY                                                       */
83 /*                                                                        */
84 /*    DATE              NAME                      DESCRIPTION             */
85 /*                                                                        */
86 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
87 /*  01-31-2022      Scott Larson            Modified comments and added   */
88 /*                                            CALL_NOT_USED option,       */
89 /*                                            resulting in version 6.1.10 */
90 /*                                                                        */
91 /**************************************************************************/
_tx_thread_performance_info_get(TX_THREAD * thread_ptr,ULONG * resumptions,ULONG * suspensions,ULONG * solicited_preemptions,ULONG * interrupt_preemptions,ULONG * priority_inversions,ULONG * time_slices,ULONG * relinquishes,ULONG * timeouts,ULONG * wait_aborts,TX_THREAD ** last_preempted_by)92 UINT _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions, ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions, ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts, TX_THREAD **last_preempted_by)
93 {
94 
95 UINT return_value;
96 ALIGN_TYPE extra_parameters[9];
97 
98     extra_parameters[0] = (ALIGN_TYPE) suspensions;
99     extra_parameters[1] = (ALIGN_TYPE) solicited_preemptions;
100     extra_parameters[2] = (ALIGN_TYPE) interrupt_preemptions;
101     extra_parameters[3] = (ALIGN_TYPE) priority_inversions;
102     extra_parameters[4] = (ALIGN_TYPE) time_slices;
103     extra_parameters[5] = (ALIGN_TYPE) relinquishes;
104     extra_parameters[6] = (ALIGN_TYPE) timeouts;
105     extra_parameters[7] = (ALIGN_TYPE) wait_aborts;
106     extra_parameters[8] = (ALIGN_TYPE) last_preempted_by;
107 
108     /* Call module manager dispatcher.  */
109     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_THREAD_PERFORMANCE_INFO_GET_CALL, (ALIGN_TYPE) thread_ptr, (ALIGN_TYPE) resumptions, (ALIGN_TYPE) extra_parameters);
110 
111     /* Return value to the caller.  */
112     return(return_value);
113 }
114 #endif
115