0

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 ./ReadImage > 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?

4

1 回答 1

0

我能够operf在 opencv 应用程序上运行,结果是,这就是你要找的吗?

Profiling started at Tue Jan 31 16:52:48 2017
Profiling stopped at Tue Jan 31 16:52:53 2017

-- OProfile/operf Statistics --
Nr. non-backtrace samples: 337018
Nr. kernel samples: 5603
Nr. user space samples: 331415
Nr. samples lost due to sample address not in expected range for domain: 0
Nr. lost kernel samples: 0
Nr. samples lost due to sample file open failure: 0
Nr. samples lost due to no permanent mapping: 0
Nr. user context kernel samples lost due to no app info available: 0
Nr. user samples lost due to no app info available: 0
Nr. backtraces skipped due to no file mapping: 0
Nr. hypervisor samples dropped due to address out-of-range: 0
Nr. samples lost reported by perf_events kernel: 0
于 2017-01-31T22:02:51.757 回答