0

Is it possible to perform benchmarking with QBENCHMARK with a different data point each time a measurement is made? To be more specific, I have the following test case:

void TestImage::test_IMCreationBenchmark_data()
{
    const uint HEIGHT = 480;
    const uint WIDTH = 640;
    const uint16_t MAXVAL = 1000;
    const uint16_t MINVAL = 10;

    QTest::addColumn<cv::Mat>("image");

    const std::string rowName = "Mat";
    cv::Mat I(HEIGHT, WIDTH, CV_16U);
    cv::randu(I, cv::Scalar(MINVAL), cv::Scalar(MAXVAL));
    QTest::newRow(rowName.c_str()) << I;
}

void TestImage::test_IMCreationBenchmark()
{
    QFETCH(cv::Mat, image);
    ImageManipulator im;

    QBENCHMARK {
        im.update(image);
    }
}

The statement within the QBENCHMARK macro is executed several times. I have verified this by just printing out debug statements to the console. My intention is to have each of these executions with a different randomly populated cv::Mat instead of reusing just one. Is it possible to achieve this?

mahasamatman
  • 603
  • 1
  • 7
  • 10

0 Answers0