Benchmark formatting + on different images sizes

TODO:
- markdown formatting ?
- header/footer
This commit is contained in:
Joachim
2020-03-27 17:19:56 +01:00
parent 2c01d87ace
commit 0973f2f5c2
13 changed files with 209 additions and 308 deletions

View File

@ -4,7 +4,7 @@ This example uses OpenCV library on the Esp32. Only the modules `core`, `imgproc
The goal of this example is to check which OpenCV features are working.
The goal of this example is to check which OpenCV features are working and to benchmark their computation time on the target.

View File

@ -0,0 +1,129 @@
============================== Thresholding tests ==============================
Image 160x120 -------------------------
Binary threshold 2 [ms]
Triangle threshold 3 [ms]
OTSU threshold 6 [ms]
To zero threshold 2 [ms]
Image 320x240 -------------------------
Binary threshold 10 [ms]
Triangle threshold 17 [ms]
OTSU threshold 19 [ms]
To zero threshold 10 [ms]
Image 640x480 -------------------------
Binary threshold 42 [ms]
Triangle threshold 66 [ms]
OTSU threshold 68 [ms]
To zero threshold 42 [ms]
================================ Blurring tests ================================
Image 160x120 -------------------------
GaussianBlur9x9 33 [ms]
medianBlur9x9 53 [ms]
bilateralFilter 137 [ms]
Image 320x240 -------------------------
GaussianBlur9x9 128 [ms]
medianBlur9x9 272 [ms]
bilateralFilter 534 [ms]
Image 640x480 -------------------------
GaussianBlur9x9 503 [ms]
medianBlur9x9 1424 [ms]
bilateralFilter 2118 [ms]
======================= Morphology transformations tests =======================
Image 160x120 -------------------------
erode 8 [ms]
dilate 8 [ms]
open 14 [ms]
Image 320x240 -------------------------
erode 30 [ms]
dilate 30 [ms]
open 57 [ms]
Image 640x480 -------------------------
erode 117 [ms]
dilate 117 [ms]
open 224 [ms]
================================ Resizing tests ================================
Image 160x120 -------------------------
linear resize 3 [ms]
cubic resize 6 [ms]
pyrUp 11 [ms]
Image 320x240 -------------------------
linear resize 16 [ms]
cubic resize 26 [ms]
pyrUp 49 [ms]
Image 640x480 -------------------------
linear resize 59 [ms]
cubic resize 107 [ms]
pyrUp 195 [ms]
============================= Edge detection tests =============================
Image 160x120 -------------------------
Sobel 14 [ms]
Canny: 35 [ms]
Image 320x240 -------------------------
Sobel 49 [ms]
Canny: 123 [ms]
Image 640x480 -------------------------
Sobel 186 [ms]
Canny: 462 [ms]
============================= Hough transform tests ============================
Image 160x120 -------------------------
HoughLines 847 [ms]
HoughLineP 1580 [ms]
Image 320x240 -------------------------
HoughLines 3121 [ms]
HoughLineP 6209 [ms]
Image 640x480 -------------------------
HoughLines 9954 [ms]
HoughLineP 17904 [ms]
OpenCV compiled with:
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DESP32=ON \
-DBUILD_SHARED_LIBS=OFF \
-DCV_DISABLE_OPTIMIZATION=OFF \
-DWITH_IPP=OFF \
-DWITH_TBB=OFF \
-DWITH_OPENMP=OFF \
-DWITH_PTHREADS_PF=OFF \
-DWITH_QUIRC=OFF \
-DWITH_1394=OFF \
-DWITH_CUDA=OFF \
-DWITH_OPENCL=OFF \
-DWITH_OPENCLAMDFFT=OFF \
-DWITH_OPENCLAMDBLAS=OFF \
-DWITH_VA_INTEL=OFF \
-DWITH_EIGEN=OFF \
\
-DWITH_GSTREAMER=OFF \
-DWITH_GTK=OFF \
-DWITH_JASPER=OFF \
-DWITH_JPEG=OFF \
-DWITH_WEBP=OFF \
-DBUILD_ZLIB=ON \
-DBUILD_PNG=ON \
-DWITH_TIFF=OFF \
-DWITH_V4L=OFF \
-DWITH_LAPACK=OFF \
-DWITH_ITT=OFF \
-DWITH_PROTOBUF=OFF \
-DWITH_IMGCODEC_HDR=OFF \
-DWITH_IMGCODEC_SUNRASTER=OFF \
-DWITH_IMGCODEC_PXM=OFF \
-DWITH_IMGCODEC_PFM=OFF \
\
-DBUILD_LIST=core,imgproc,imgcodecs \
-DBUILD_JAVA=OFF \
-DBUILD_opencv_python=OFF \
-DBUILD_opencv_java=OFF \
\
-DBUILD_opencv_apps=OFF \
-DBUILD_PACKAGE=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_TESTS=OFF \
-DCV_ENABLE_INTRINSICS=OFF \
-DCV_TRACE=OFF \
-DOPENCV_ENABLE_MEMALIGN=OFF \
\
-DCMAKE_TOOLCHAIN_FILE=~/esp/esp-idf/tools/cmake/toolchain-esp32.cmake \
..

View File

@ -1,87 +0,0 @@
I (12398) SYSTEM: task stack left: 29028 Bytes
I (12408) SYSTEM: heap left: 4379580 Bytes
I (12678) opencv_tests: Image read of 399x473x3, with 0 pixel depth
I (12678) opencv_tests: ==================== Thresholding tests ====================
Time taken by Binary threshold: 26 [ms]
Time taken by Triangle threshold: 40 [ms]
Time taken by OTSU threshold: 43 [ms]
Time taken by To zero threshold: 26 [ms]
I (13138) SYSTEM: task stack left: 26124 Bytes
I (13138) SYSTEM: heap left: 3813264 Bytes
I (13138) opencv_tests: ==================== Blurring tests ====================
Time taken by GaussianBlur: 1068 [ms]
Time taken by medianBlur: 1592 [ms]
Time taken by bilateralFilter: 2774 [ms]
I (29458) SYSTEM: task stack left: 26124 Bytes
I (29458) SYSTEM: heap left: 3812992 Bytes
I (29458) opencv_tests: =========== Morphology transformations tests ===========
Time taken by erode: 279 [ms]
Time taken by dilate: 278 [ms]
Time taken by open: 533 [ms]
I (32748) SYSTEM: task stack left: 26124 Bytes
I (32748) SYSTEM: heap left: 3812992 Bytes
I (32748) opencv_tests: ==================== Resizing tests ====================
Time taken by linear resize: 105 [ms]
Time taken by cubic resize: 340 [ms]
Time taken by pyrUp: 498 [ms]
Time taken by pyrDown: 77 [ms]
I (35828) SYSTEM: task stack left: 936 Bytes
I (35828) SYSTEM: heap left: 3812992 Bytes
I (35828) opencv_tests: ================= Edge detection tests =================
Time taken by Sobel: 121 [ms]
Time taken by Canny: 317 [ms]
I (36568) SYSTEM: task stack left: 936 Bytes
I (36568) SYSTEM: heap left: 3812992 Bytes
OpenCV compiled with:
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DESP32=ON \
-DBUILD_SHARED_LIBS=OFF \
-DCV_DISABLE_OPTIMIZATION=OFF \
-DWITH_IPP=OFF \
-DWITH_TBB=OFF \
-DWITH_OPENMP=OFF \
-DWITH_PTHREADS_PF=OFF \
-DWITH_QUIRC=OFF \
-DWITH_1394=OFF \
-DWITH_CUDA=OFF \
-DWITH_OPENCL=OFF \
-DWITH_OPENCLAMDFFT=OFF \
-DWITH_OPENCLAMDBLAS=OFF \
-DWITH_VA_INTEL=OFF \
-DWITH_EIGEN=OFF \
\
-DWITH_GSTREAMER=OFF \
-DWITH_GTK=OFF \
-DWITH_JASPER=OFF \
-DWITH_JPEG=OFF \
-DWITH_WEBP=OFF \
-DBUILD_ZLIB=ON \
-DBUILD_PNG=ON \
-DWITH_TIFF=OFF \
-DWITH_V4L=OFF \
-DWITH_LAPACK=OFF \
-DWITH_ITT=OFF \
-DWITH_PROTOBUF=OFF \
-DWITH_IMGCODEC_HDR=OFF \
-DWITH_IMGCODEC_SUNRASTER=OFF \
-DWITH_IMGCODEC_PXM=OFF \
-DWITH_IMGCODEC_PFM=OFF \
\
-DBUILD_LIST=core,imgproc,imgcodecs \
-DBUILD_JAVA=OFF \
-DBUILD_opencv_python=OFF \
-DBUILD_opencv_java=OFF \
\
-DBUILD_opencv_apps=OFF \
-DBUILD_PACKAGE=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_TESTS=OFF \
-DCV_ENABLE_INTRINSICS=OFF \
-DCV_TRACE=OFF \
-DOPENCV_ENABLE_MEMALIGN=OFF \
\
-DCMAKE_TOOLCHAIN_FILE=~/esp/esp-idf/tools/cmake/toolchain-esp32.cmake \
..

View File

@ -1,85 +0,0 @@
I (12395) SYSTEM: task stack left: 29028 Bytes
I (12395) SYSTEM: heap left: 4379580 Bytes
I (12695) opencv_tests: Image read of 399x473x3, with 0 pixel depth
I (12695) opencv_tests: ==================== Thresholding tests ====================
Time taken by Binary threshold: 30 [ms]
Time taken by Triangle threshold: 49 [ms]
Time taken by OTSU threshold: 52 [ms]
Time taken by To zero threshold: 30 [ms]
I (13235) SYSTEM: task stack left: 29028 Bytes
I (13235) SYSTEM: heap left: 3813264 Bytes
I (13235) opencv_tests: ==================== Blurring tests ====================
Time taken by GaussianBlur: 1102 [ms]
Time taken by medianBlur: 1596 [ms]
Time taken by bilateralFilter: 2773 [ms]
I (29665) SYSTEM: task stack left: 27340 Bytes
I (29665) SYSTEM: heap left: 3812992 Bytes
I (29665) opencv_tests: =========== Morphology transformations tests ===========
Time taken by erode: 355 [ms]
Time taken by dilate: 355 [ms]
Time taken by open: 686 [ms]
I (33875) SYSTEM: task stack left: 27340 Bytes
I (33875) SYSTEM: heap left: 3812992 Bytes
I (33875) opencv_tests: ==================== Resizing tests ====================
Time taken by linear resize: 109 [ms]
Time taken by cubic resize: 337 [ms]
Time taken by pyrUp: 499 [ms]
Time taken by pyrDown: 77 [ms]
I (36955) SYSTEM: task stack left: 936 Bytes
I (36955) SYSTEM: heap left: 3812992 Bytes
I (36955) opencv_tests: ================= Edge detection tests =================
Time taken by Sobel: 153 [ms]
Time taken by Canny: 324 [ms]
I (37805) SYSTEM: task stack left: 936 Bytes
I (37805) SYSTEM: heap left: 3812992 Bytes
OpenCV compiled with :
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DESP32=ON \
-DBUILD_SHARED_LIBS=OFF \
-DCV_DISABLE_OPTIMIZATION=ON \
-DWITH_IPP=OFF \
-DWITH_TBB=OFF \
-DWITH_OPENMP=OFF \
-DWITH_PTHREADS_PF=OFF \
-DWITH_QUIRC=OFF \
-DWITH_1394=OFF \
-DWITH_CUDA=OFF \
-DWITH_OPENCL=OFF \
-DWITH_OPENCLAMDFFT=OFF \
-DWITH_OPENCLAMDBLAS=OFF \
-DWITH_VA_INTEL=OFF \
\
-DWITH_GSTREAMER=OFF \
-DWITH_GTK=OFF \
-DWITH_JASPER=OFF \
-DWITH_JPEG=OFF \
-DWITH_WEBP=OFF \
-DBUILD_ZLIB=ON \
-DBUILD_PNG=ON \
-DWITH_TIFF=OFF \
-DWITH_V4L=OFF \
-DWITH_ITT=OFF \
-DWITH_PROTOBUF=OFF \
-DWITH_IMGCODEC_HDR=OFF \
-DWITH_IMGCODEC_SUNRASTER=OFF \
-DWITH_IMGCODEC_PXM=OFF \
-DWITH_IMGCODEC_PFM=OFF \
\
-DBUILD_LIST=core,imgproc,imgcodecs \
-DBUILD_JAVA=OFF \
-DBUILD_opencv_python=OFF \
-DBUILD_opencv_java=OFF \
\
-DBUILD_opencv_apps=OFF \
-DBUILD_PACKAGE=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_TESTS=OFF \
-DCV_ENABLE_INTRINSICS=OFF \
-DCV_TRACE=OFF \
-DOPENCV_ENABLE_MEMALIGN=OFF \
\
-DCMAKE_TOOLCHAIN_FILE=~/esp/esp-idf/tools/cmake/toolchain-esp32.cmake \
..

View File

@ -21,112 +21,52 @@ using namespace cv;
using namespace std;
char* TAG="opencv_tests";
const String imageFileName = "/spiffs/jack.png";
const char* TAG="opencv_tests";
const int REPEAT = 3; // number of times to repeat the function call for the average
const int NB_IMAGES = 3; // number of images with different resolutions for the tests
const String images_res[] = {"160x120", "320x240", "640x480"};
extern "C" {
void app_main(void);
}
/**
* Function that tests the basics of OpenCV:
* - Matrices creation
* - Arithmetic operations
* -
*/
void test_basics()
Mat read_image_specific_res(const String &fileName)
{
ESP_LOGI(TAG, "Doing basic matrices test");
Mat img = imread(fileName, IMREAD_GRAYSCALE);
/* Matrices initialization tests */
Mat M1(2,2, CV_8UC3, Scalar(0,0,255));
cout << "M1 = " << endl << " " << M1 << endl << endl;
Mat M2(2,2, CV_8UC3, Scalar(0,0,111));
cout << "M2 = " << endl << " " << M2 << endl << endl;
Mat eye = Mat::eye(10, 10, CV_32F) * 0.1;
cout << "eye = " << endl << " " << eye << endl << endl;
Mat ones = Mat::ones(15, 4, CV_8U)*3;
cout << "ones = " << endl << " " << ones << endl << endl;
vector<float> v;
v.push_back((float)CV_PI);
v.push_back(2);
v.push_back(3.01f);
cout << "floats vector = " << endl << " " << Mat(v) << endl << endl;
uint8_t data[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
Mat M3 = Mat(3, 5, CV_8UC1, data);
cout << "Gray matrix = " << endl << " " << M3 << endl << endl;
}
/**
* Function that reads and write on the SPI Flash File System
*/
void test_spiffs()
{
ESP_LOGI(TAG, "Doing SPIFFS read/write tests");
/* SPIFFS file reading test */
FILE* f = fopen("/spiffs/hello.txt", "r");
if (f == NULL) {
ESP_LOGE(TAG, "Failed to open file for reading");
return;
if(img.empty()) {
ESP_LOGW(TAG, "cannot read the image: %s", fileName.c_str());
return img;
}
char line[64];
fgets(line, sizeof(line), f);
fclose(f);
printf("Read from file: '%s'\n", line);
/* Images reading/writing tests */
Mat src;
src = imread(imageFileName, IMREAD_COLOR);
if(src.empty()) {
ESP_LOGW(TAG, "cannot read the image: %s", imageFileName.c_str());
return;
}
imwrite("/spiffs/dst.png", src);
ESP_LOGI(TAG, "Image written!");
ESP_LOGI(TAG, "Image read of %dx%dx%d, with %d pixel depth", img.rows, img.cols, img.channels(), img.depth());
return img;
}
void test_thresholds(const Mat &src)
{
ESP_LOGI(TAG, "==================== Thresholding tests ====================");
Mat gray, dst;
// convert to grayscale
cvtColor(src, gray, COLOR_BGR2GRAY);
Mat dst;
// apply thresholds
BENCHMARK_MS("Binary threshold", REPEAT, threshold, gray, dst, 128, 255, THRESH_BINARY);
BENCHMARK_MS("Triangle threshold", REPEAT, threshold, gray, dst, 0, 255, THRESH_BINARY | THRESH_TRIANGLE);
BENCHMARK_MS("OTSU threshold", REPEAT, threshold, gray, dst, 0, 255, THRESH_BINARY | THRESH_OTSU);
BENCHMARK_MS("To zero threshold", REPEAT, threshold, gray, dst, 128, 255, THRESH_TOZERO);
BENCHMARK_MS("Binary threshold", REPEAT, threshold, src, dst, 128, 255, THRESH_BINARY);
BENCHMARK_MS("Triangle threshold", REPEAT, threshold, src, dst, 0, 255, THRESH_BINARY | THRESH_TRIANGLE);
BENCHMARK_MS("OTSU threshold", REPEAT, threshold, src, dst, 0, 255, THRESH_BINARY | THRESH_OTSU);
BENCHMARK_MS("To zero threshold", REPEAT, threshold, src, dst, 128, 255, THRESH_TOZERO);
}
void test_blurring(const Mat &src)
{
ESP_LOGI(TAG, "==================== Blurring tests ====================");
Mat dst;
// apply blurs
BENCHMARK_MS("GaussianBlur", REPEAT, GaussianBlur, src, dst, Size(9, 9), 0, 0, BORDER_DEFAULT);
BENCHMARK_MS("medianBlur", REPEAT, medianBlur, src, dst, 9);
BENCHMARK_MS("GaussianBlur9x9", REPEAT, GaussianBlur, src, dst, Size(9, 9), 0, 0, BORDER_DEFAULT);
BENCHMARK_MS("medianBlur9x9", REPEAT, medianBlur, src, dst, 9);
BENCHMARK_MS("bilateralFilter", REPEAT, bilateralFilter, src, dst, 9, 18, 5, BORDER_DEFAULT);
}
void test_morphology_transform(const Mat &src)
{
ESP_LOGI(TAG, "=========== Morphology transformations tests ===========");
Mat dst;
// create a kernel for the transformation
@ -140,8 +80,6 @@ void test_morphology_transform(const Mat &src)
void test_resize(const Mat &src)
{
ESP_LOGI(TAG, "==================== Resizing tests ====================");
Mat dst;
BENCHMARK_MS("linear resize", REPEAT, resize, src, dst, Size(), 0.75, 0.75, INTER_LINEAR);
@ -153,42 +91,34 @@ void test_resize(const Mat &src)
void test_edge_detect(const Mat &src)
{
ESP_LOGI(TAG, "================= Edge detection tests =================");
Mat dst;
Mat dst, gray;
// convert to grayscale
cvtColor(src, gray, COLOR_BGR2GRAY);
BENCHMARK_MS("Sobel", REPEAT, Sobel, gray, dst, 2, 2, 1, 3, 1, 0, BORDER_DEFAULT);
//BENCHMARK_MS("Canny", REPEAT, Canny, gray, dst, 8, 24, 3, false); // FIXME: can't deduce template parameter 'F'
BENCHMARK_MS("Sobel", REPEAT, Sobel, src, dst, 2, 2, 1, 3, 1, 0, BORDER_DEFAULT);
//BENCHMARK_MS("Canny", REPEAT, Canny, src, dst, 8, 24, 3, false); // FIXME: can't deduce template parameter 'F'
Canny(src, dst, 8, 24, 3, false); // cache warm up
auto start = chrono::system_clock::now();
Canny(gray, dst, 8, 24, 3, false);
Canny(src, dst, 8, 24, 3, false);
auto duration = chrono::duration_cast<chrono::milliseconds >(chrono::system_clock::now() - start);
std::cout << "Time taken by " << "Canny" << ": " << duration.count() << " [" << "ms" << "]" << std::endl;
std::cout << "Canny" << ": " << duration.count() << " [" << "ms" << "]" << std::endl;
}
void test_hough(const Mat &src)
{
ESP_LOGI(TAG, "================= Hough transform tests =================");
Mat dst, blurred, edge;
Mat dst, gray, edge;
// Grayscale and edge detection
cvtColor(src, gray, COLOR_BGR2GRAY);
Canny(gray, edge, 8, 24, 3, false);
blur(src, blurred, Size(3,3));
Canny(blurred, edge, 10, 30, 3, false);
// hough
vector<Vec2f> lines;
BENCHMARK_MS("HoughLines", REPEAT, HoughLines, edge, lines, 1, CV_PI/180, 200, 0, 0, 0, CV_PI);
cout << lines.size() << " lines were detected" << endl;
BENCHMARK_MS("HoughLines", REPEAT, HoughLines, edge, lines, 1, CV_PI/180, 100, 0, 0, 0, CV_PI);
// probabilistic hough
vector<Vec4i> linesP;
BENCHMARK_MS("HoughLineP", REPEAT, HoughLinesP, edge, linesP, 1, CV_PI/180, 200, 30, 10);
cout << linesP.size() << " lines were detected" << endl;
BENCHMARK_MS("HoughLineP", REPEAT, HoughLinesP, edge, linesP, 1, CV_PI/180, 100, 80, 0);
}
void app_main(void)
{
ESP_LOGI(TAG, "Starting main");
@ -197,46 +127,59 @@ void app_main(void)
/* SPIFFS init */
init_spiffs();
/* Basics Matrices tests */
test_basics();
/* Test the spiffs read/write */
test_spiffs();
disp_mem_infos();
/* Read the images for the tests */
Mat src = read_image_specific_res("/spiffs/"+images_res[0]+".png");
Mat src2 = read_image_specific_res("/spiffs/"+images_res[1]+".png");
Mat src3 = read_image_specific_res("/spiffs/"+images_res[2]+".png");
vector<Mat> matrices;
matrices.push_back(src);
matrices.push_back(src2);
matrices.push_back(src3);
/* Read an image for the next tests */
Mat src = imread(imageFileName, IMREAD_COLOR);
if(src.empty()) {
ESP_LOGW(TAG, "cannot read the image: %s", imageFileName.c_str());
return;
}
ESP_LOGI(TAG, "Image read of %dx%dx%d, with %d pixel depth", src.rows, src.cols, src.channels(), src.depth());
// TODO: rename measure.hpp in benchmark.hpp and add printHeader method
// TODO: make an array of function and call them from a single loop
/* Conversions and thresholds tests */
test_thresholds(src);
disp_mem_infos();
printf("============================== Thresholding tests ==============================\n");
for(int i = 0; i < NB_IMAGES; i++) {
printf("Image %s -------------------------\n", images_res[i].c_str());
test_thresholds(matrices[i]);
}
/* Blurring tests */
test_blurring(src);
disp_mem_infos();
printf("================================ Blurring tests ================================\n");
for(int i = 0; i < NB_IMAGES; i++) {
printf("Image %s -------------------------\n", images_res[i].c_str());
test_blurring(matrices[i]);
}
/* Morphology transformations */
test_morphology_transform(src);
disp_mem_infos();
printf("======================= Morphology transformations tests =======================\n");
for(int i = 0; i < NB_IMAGES; i++) {
printf("Image %s -------------------------\n", images_res[i].c_str());
test_morphology_transform(matrices[i]);
}
/* Edge detection */
test_edge_detect(src);
disp_mem_infos();
printf("================================ Resizing tests ================================\n");
for(int i = 0; i < NB_IMAGES; i++) {
printf("Image %s -------------------------\n", images_res[i].c_str());
test_resize(matrices[i]);
}
/* Image resizing */
test_resize(src);
disp_mem_infos();
wait_msec(500);
printf("============================= Edge detection tests =============================\n");
for(int i = 0; i < NB_IMAGES; i++) {
printf("Image %s -------------------------\n", images_res[i].c_str());
test_edge_detect(matrices[i]);
}
/* Hough transform */
test_hough(src);
disp_mem_infos();
printf("============================= Hough transform tests ============================\n");
for(int i = 0; i < NB_IMAGES; i++) {
printf("Image %s -------------------------\n", images_res[i].c_str());
test_hough(matrices[i]);
}
ESP_LOGI(TAG, "End of main");
}

View File

@ -23,14 +23,15 @@
*
* Usage examples:
* - without macro:
* measure<chrono::milliseconds>::benchmark("ms", "medianBlur", repeat, medianBlur, src, dst, 9);
* measure<std::chrono::milliseconds>::benchmark("ms", "medianBlur", repeat, medianBlur, src, dst, 9);
* - with macro:
* BENCHMARK_MS("medianBlur", repeat, medianBlur, src, dst, 9);
*/
#define BENCHMARK_NS(name, repeat, fct, ...) measure<chrono::nanoseconds>::benchmark("ns", name, repeat, fct, __VA_ARGS__)
#define BENCHMARK_US(name, repeat, fct, ...) measure<chrono::microseconds>::benchmark("us", name, repeat, fct, __VA_ARGS__)
#define BENCHMARK_MS(name, repeat, fct, ...) measure<chrono::milliseconds>::benchmark("ms", name, repeat, fct, __VA_ARGS__)
#define BENCHMARK_S(name, repeat, fct, ...) measure<chrono::seconds>::benchmark("s", name, repeat, fct, __VA_ARGS__)
#define BENCHMARK_NS(name, repeat, fct, ...) measure<std::chrono::nanoseconds>::benchmark("ns", name, repeat, fct, __VA_ARGS__)
#define BENCHMARK_US(name, repeat, fct, ...) measure<std::chrono::microseconds>::benchmark("us", name, repeat, fct, __VA_ARGS__)
#define BENCHMARK_MS(name, repeat, fct, ...) measure<std::chrono::milliseconds>::benchmark("ms", name, repeat, fct, __VA_ARGS__)
#define BENCHMARK_S(name, repeat, fct, ...) measure<std::chrono::seconds>::benchmark("s", name, repeat, fct, __VA_ARGS__)
#define fw(what) std::forward<decltype(what)>(what)
@ -78,7 +79,7 @@ struct measure
avg += duration(func, (args)...);
}
std::cout << "Time taken by " << name << ": " << (avg / repeat).count() << " [" << unit << "]" << std::endl;
std::cout << name << "\t " << (avg / repeat).count() << " [" << unit << "]" << std::endl;
}
/**

View File

@ -3,4 +3,4 @@
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 2M,
storage, data, spiffs, , 1M,
storage, data, spiffs, , 1M,

1 # Espressif ESP32 Partition Table
3 nvs, data, nvs, 0x9000, 0x6000,
4 phy_init, data, phy, 0xf000, 0x1000,
5 factory, app, factory, 0x10000, 2M,
6 storage, data, spiffs, , 1M,

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 KiB

View File

@ -1 +1 @@
Coucou Salut
Coucou Salut!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB