ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dev_stat_api.h Source File

dev_stat_api.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
00003  *
00004  * SPDX-License-Identifier: LicenseRef-PBL
00005  *
00006  * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * https://www.mbed.com/licenses/PBL-1.0
00010  *
00011  * See the License for the specific language governing permissions and limitations under the License.
00012  *
00013  */
00014 /**
00015  * \file dev_stat_api.h
00016  * \brief 6LowPAN library device statistics API
00017  *
00018  * - dev_stat_internal_init(), Enable stats update.
00019  * - dev_stat_get_longest_heap_sector(), Get longest free sector.
00020  * - dev_stat_get_runtime_seconds(), Get system runtime in seconds.
00021  *
00022  */
00023 #ifndef _DEV_STAT_API_H
00024 #define _DEV_STAT_API_H
00025 
00026 #include "ns_types.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 /**
00033  * /struct dev_stat_t
00034  * /brief Struct for device stats buffer structure.
00035  */
00036 typedef struct dev_stat_t {
00037     /*Heap stats*/
00038     int16_t heap_sector_size;               /**< Heap total sector length. */
00039     int16_t heap_sector_alloc_cnt;      /**< Reserved heap sector count. */
00040     int16_t heap_sector_allocated_bytes;    /**< Reserved heap data in bytes. */
00041     int16_t heap_sector_allocated_bytes_max;    /**< Reserved heap data in bytes max value. */
00042     uint32_t heap_alloc_total_bytes;        /**< Total heap allocated bytes. */
00043     uint32_t heap_alloc_fail_cnt;           /**< Counter for heap allocation fail. */
00044 } dev_stat_t;
00045 
00046 /**
00047   *  \brief Enable device stats collection.
00048   *
00049   * \param info_ptr Static pointer where the stack updates device stat.
00050   *
00051   * \return 0, Init OK.
00052   * \return -1, Null pointer parameter detected.
00053   *
00054   */
00055 extern int8_t dev_stat_internal_init(dev_stat_t *info_ptr);
00056 /**
00057   *  \brief Get current longest free sector.
00058   *
00059   *
00060   * \return Signed 16-bit length for longest sector size.
00061   *
00062   */
00063 extern int16_t dev_stat_get_longest_heap_sector(void);
00064 /**
00065   *  \brief Get system runtime in seconds.
00066   *
00067   *
00068   * \return Signed 16-bit length for longest sector size.
00069   *
00070   */
00071 extern uint32_t dev_stat_get_runtime_seconds(void);
00072 #ifdef __cplusplus
00073 }
00074 #endif
00075 #endif