Initial commit
This commit is contained in:
205
common/src/tx_queue_performance_system_info_get.c
Normal file
205
common/src/tx_queue_performance_system_info_get.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* Copyright (c) Microsoft Corporation. All rights reserved. */
|
||||
/* */
|
||||
/* This software is licensed under the Microsoft Software License */
|
||||
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
|
||||
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
|
||||
/* and in the root directory of this software. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** ThreadX Component */
|
||||
/** */
|
||||
/** Queue */
|
||||
/** */
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
|
||||
#define TX_SOURCE_CODE
|
||||
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#include "tx_api.h"
|
||||
#include "tx_queue.h"
|
||||
#ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
|
||||
#include "tx_trace.h"
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _tx_queue_performance_system_info_get PORTABLE C */
|
||||
/* 6.0 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function retrieves queue system performance information. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* messages_sent Destination for total messages */
|
||||
/* sent */
|
||||
/* messages_received Destination for total messages */
|
||||
/* received */
|
||||
/* empty_suspensions Destination for total empty */
|
||||
/* queue suspensions */
|
||||
/* full_suspensions Destination for total full */
|
||||
/* queue suspensions */
|
||||
/* full_errors Destination for total queue full */
|
||||
/* errors returned - no suspension */
|
||||
/* timeouts Destination for total number of */
|
||||
/* timeouts */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* status Completion status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* None */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* */
|
||||
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _tx_queue_performance_system_info_get(ULONG *messages_sent, ULONG *messages_received,
|
||||
ULONG *empty_suspensions, ULONG *full_suspensions, ULONG *full_errors, ULONG *timeouts)
|
||||
{
|
||||
|
||||
#ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO
|
||||
|
||||
TX_INTERRUPT_SAVE_AREA
|
||||
|
||||
|
||||
/* Disable interrupts. */
|
||||
TX_DISABLE
|
||||
|
||||
/* If trace is enabled, insert this event into the trace buffer. */
|
||||
TX_TRACE_IN_LINE_INSERT(TX_TRACE_QUEUE_PERFORMANCE_SYSTEM_INFO_GET, 0, 0, 0, 0, TX_TRACE_QUEUE_EVENTS)
|
||||
|
||||
/* Log this kernel call. */
|
||||
TX_EL_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_INSERT
|
||||
|
||||
/* Retrieve all the pertinent information and return it in the supplied
|
||||
destinations. */
|
||||
|
||||
/* Retrieve the total number of queue messages sent. */
|
||||
if (messages_sent != TX_NULL)
|
||||
{
|
||||
|
||||
*messages_sent = _tx_queue_performance_messages_sent_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of queue messages received. */
|
||||
if (messages_received != TX_NULL)
|
||||
{
|
||||
|
||||
*messages_received = _tx_queue_performance__messages_received_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of empty queue suspensions. */
|
||||
if (empty_suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
*empty_suspensions = _tx_queue_performance_empty_suspension_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of full queue suspensions. */
|
||||
if (full_suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
*full_suspensions = _tx_queue_performance_full_suspension_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of full errors. */
|
||||
if (full_errors != TX_NULL)
|
||||
{
|
||||
|
||||
*full_errors = _tx_queue_performance_full_error_count;
|
||||
}
|
||||
|
||||
/* Retrieve the total number of queue timeouts. */
|
||||
if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
*timeouts = _tx_queue_performance_timeout_count;
|
||||
}
|
||||
|
||||
/* Restore interrupts. */
|
||||
TX_RESTORE
|
||||
|
||||
/* Return completion status. */
|
||||
return(TX_SUCCESS);
|
||||
|
||||
#else
|
||||
|
||||
UINT status;
|
||||
|
||||
|
||||
/* Access input arguments just for the sake of lint, MISRA, etc. */
|
||||
if (messages_sent != TX_NULL)
|
||||
{
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (messages_received != TX_NULL)
|
||||
{
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (empty_suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (full_suspensions != TX_NULL)
|
||||
{
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (full_errors != TX_NULL)
|
||||
{
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else if (timeouts != TX_NULL)
|
||||
{
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Not enabled, return error. */
|
||||
status = TX_FEATURE_NOT_ENABLED;
|
||||
}
|
||||
|
||||
/* Return completion status. */
|
||||
return(status);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user