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