SPIFFS: Add speed test.

This commit is contained in:
sheinz 2016-07-15 00:08:34 +03:00
parent 22654a4de7
commit 1db953e0c3
2 changed files with 16 additions and 3 deletions

@ -1 +1 @@
Subproject commit 12b10230cc56970857e6890bdd5663fbae74c4c3
Subproject commit 2ad547adc5f725594b3c6752f036ff4401b221fc

View file

@ -1,5 +1,6 @@
#include "espressif/esp_common.h"
#include "esp/uart.h"
#include "esp/timer.h"
#include "FreeRTOS.h"
#include "task.h"
#include "esp8266.h"
@ -10,6 +11,10 @@
#include "fs-test/fs_test.h"
static fs_time_t get_current_time()
{
return timer_get_count(FRC2) / 5000; // to get roughly 1ms resolution
}
void test_task(void *pvParameters)
{
@ -24,12 +29,20 @@ void test_task(void *pvParameters)
while (1) {
vTaskDelay(5000 / portTICK_RATE_MS);
if (fs_test_run(1000)) {
if (fs_load_test_run(100)) {
printf("PASS\n");
} else {
printf("FAIL\n");
}
vTaskDelay(5000 / portTICK_RATE_MS);
float write_rate, read_rate;
if (fs_speed_test_run(get_current_time, &write_rate, &read_rate)) {
printf("Read speed: %.0f bytes/s\n", read_rate * 1000);
printf("Write speed: %.0f bytes/s\n", write_rate * 1000);
} else {
printf("FAIL\n");
}
}
}