SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
The device statistics API gives the option to retrieve WLAN and device statistics.
Start collecting device or WLAN statistics (including RX statistics) for an unlimited time using sl_DeviceStatStart. It must be followed with a call to sl_DeviceStatGet and the correct flag according to the requested statistics. There are two kinds of statistics:
On Clear On Read statistics, for each call to sl_DeviceStatGet, are stored in the device and are returned to the user, then initialized to zero and counted again.
However, the Accumulated statistics start collecting statistics from the device initialization, and do not stop or reset. Using the sl_DeviceStatGet function does not re-initialize Accumulated type counters.
Example:
void CollectStatistics()
{
/* this struct is equivalent to SlWlanGetRxStatResponse_t */
SlDeviceGetStat_t deviceRXStat;
/* Power Management statistics (new statistics) */
SlDeviceGetPmStat_t devicePMStat;
int ret = 0;
/* start statistics mode */
ret = sl_DeviceStatStart(0);
if (ret != 0)
{
//check ret error
}
sleep(1); // sleep for 1 sec/* this call is equivalent to sl_WlanRxStatGet(&rxStat,0) *//* statistics has been cleared upon read */
ret = sl_DeviceStatGet(SL_DEVICE_STAT_WLAN_RX, sizeof(SlDeviceGetStat_t), &deviceRXStat);
if (ret != 0)
{
//check ret error
}
/* Use the statistics that has returned from the API, as store them on DB. *//* new statistics *//* statistics has been cleared upon read */
ret = sl_DeviceStatGet(SL_DEVICE_STAT_PM, sizeof(SlDeviceGetPmStat_t), &devicePMStat);
if (ret != 0)
{
//check ret error
}
/* Use the statistics that has returned from the API. */
ret = sl_DeviceStatStop(0);
if (ret != 0)
{
//check ret error
}
}
This API replaces and extends the existing API of sl_WlanRxStatStart.
sl_WlanRxStatStart, sl_WlanRxStatStop, and sl_WlanRxStatGet are deprecated and exist only for backwards compatibility.
TI recommends only using the new sl_DeviceStatStart, sl_DeviceStatGet, and sl_DeviceStatStop APIs.
The new APIs (sl_DeviceStatXXX) contain all the capabilities of the deprecated APIs (sl_WlanRxStatXXX).
When the user starts to work with one of the API's flow (sl_ WlanRxStatStart /sl_ DeviceStatStart), the other flow cannot be called until the chosen flow is stopped (by using sl_WlanRxStatStop/sl_ DeviceStatStop). Thus, sl_WlanRxStat and sl_DeviceStat flows cannot run at the same time. This API is part of the device statistics APIs.