esp_spi_flash_counters.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. #include <stdbool.h>
  9. #include "esp_err.h"
  10. #include "sdkconfig.h"
  11. #if CONFIG_SPI_FLASH_ENABLE_COUNTERS || defined __DOXYGEN__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /**
  16. * Structure holding statistics for one type of operation
  17. */
  18. typedef struct {
  19. uint32_t count; /*!< number of times operation was executed */
  20. uint32_t time; /*!< total time taken, in microseconds */
  21. uint32_t bytes; /*!< total number of bytes */
  22. } esp_flash_counter_t;
  23. /**
  24. * Structure for counters of flash actions
  25. */
  26. typedef struct {
  27. esp_flash_counter_t read; /*!< counters for read action, like `esp_flash_read`*/
  28. esp_flash_counter_t write; /*!< counters for write action, like `esp_flash_write`*/
  29. esp_flash_counter_t erase; /*!< counters for erase action, like `esp_flash_erase`*/
  30. } esp_flash_counters_t;
  31. // for deprecate old api
  32. typedef esp_flash_counter_t spi_flash_counter_t;
  33. typedef esp_flash_counters_t spi_flash_counters_t;
  34. /**
  35. * @brief Reset SPI flash operation counters
  36. */
  37. void esp_flash_reset_counters(void);
  38. void spi_flash_reset_counters(void) __attribute__((deprecated("Please use 'esp_flash_reset_counters' instead")));
  39. /**
  40. * @brief Print SPI flash operation counters
  41. */
  42. void esp_flash_dump_counters(FILE* stream);
  43. void spi_flash_dump_counters(void) __attribute__((deprecated("Please use 'esp_flash_dump_counters' instead")));
  44. /**
  45. * @brief Return current SPI flash operation counters
  46. *
  47. * @return pointer to the esp_flash_counters_t structure holding values
  48. * of the operation counters
  49. */
  50. const esp_flash_counters_t* esp_flash_get_counters(void);
  51. const spi_flash_counters_t* spi_flash_get_counters(void) __attribute__((deprecated("Please use 'esp_flash_get_counters' instead")));
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS || defined __DOXYGEN__