Created
April 21, 2022 04:27
-
-
Save Roman-Port/f35e333fa9606e894873dbb234515a8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void run_benchmark() { | |
int target = 2600000 * 5; | |
int blockSize = sizeof(buffer); | |
while (blockSize >= 256) { | |
//Do benchmark | |
FILE* output = fopen("/sdcard/out.bin", "wb"); | |
int64_t start = esp_timer_get_time(); | |
int remaining = target; | |
while (remaining > 0) { | |
remaining -= fwrite(buffer, 1, blockSize > remaining ? remaining : blockSize, output); | |
} | |
int64_t end = esp_timer_get_time(); | |
fclose(output); | |
//Log timing info | |
double speed = target / ((end - start) / 1000000.0); | |
printf("BS %i -> %f KB/sec\n", blockSize, (float)(speed / 1024)); | |
//Prepare next test | |
blockSize /= 2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment