Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Profiling OpenCV using OProfile

I have this basic OpenCV program:

#include <iostream>
#include "opencv2/opencv.hpp"

int main(){

    std::cout<<"Reading Image..."<<std::endl;
    cv::Mat img = cv::imread("all_souls_000000.jpg", cv::IMREAD_GRAYSCALE);
    if(!img.data)
        std::cerr<<"Error reading image"<<std::endl;
    return 0;
}

Which creates the executable ReadImage. I want to profile it using OProfile. However, running:

operf ./SURFSPM > SURFSPM.log

Returns:

Kernel profiling is not possible with current system config.
Set /proc/sys/kernel/kptr_restrict to 0 to collect kernel samples.
operf: Profiler started
* * * * WARNING: Profiling rate was throttled back by the kernel * * * *
The number of samples actually recorded is less than expected, but is
probably still statistically valid.  Decreasing the sampling rate is the
best option if you want to avoid throttling.

Profiling done.

Why this happens? What is the best way to profile OpenCV?

Profiling OpenCV using OProfile

I have this basic OpenCV program:

#include <iostream>
#include "opencv2/opencv.hpp"

int main(){

    std::cout<<"Reading Image..."<<std::endl;
    cv::Mat img = cv::imread("all_souls_000000.jpg", cv::IMREAD_GRAYSCALE);
    if(!img.data)
        std::cerr<<"Error reading image"<<std::endl;
    return 0;
}

Which creates the executable ReadImage. I want to profile it using OProfile. However, running:

operf ./SURFSPM ./ReadImage > SURFSPM.log
ReadImage.log

Returns:

Kernel profiling is not possible with current system config.
Set /proc/sys/kernel/kptr_restrict to 0 to collect kernel samples.
operf: Profiler started
* * * * WARNING: Profiling rate was throttled back by the kernel * * * *
The number of samples actually recorded is less than expected, but is
probably still statistically valid.  Decreasing the sampling rate is the
best option if you want to avoid throttling.

Profiling done.

Why this happens? What is the best way to profile OpenCV?