#include <future>
#include <algorithm>
-#ifdef PROFILING
-#include <perfmon/pfmlib_perf_event.h>
-#include <errno.h>
-#include <err.h>
-#endif //PROFILING
-
#ifdef OPENCV_CUFFT
#include <cuda.h>
#include <cuda_runtime.h>
cv::Point2i max_response_pt;
int scale_index = 0;
std::vector<double> scale_responses;
-#ifdef PROFILING
- struct perf_event_attr attr;
- int fd, ret;
- uint64_t count = 0, values[3];
- ret = pfm_initialize();
- if (ret != PFM_SUCCESS)
- errx(1, "cannot initialize library: %s", pfm_strerror(ret));
- memset(&attr, 0, sizeof(attr));
- ret = pfm_get_perf_event_encoding("cycles", PFM_PLM0|PFM_PLM3, &attr, NULL, NULL);
- if (ret != PFM_SUCCESS)
- errx(1, "cannot find encoding: %s", pfm_strerror(ret));
- attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED|PERF_FORMAT_TOTAL_TIME_RUNNING;
- attr.disabled = 1;
- fd = perf_event_open(&attr, getpid(), -1, -1, 0);
- if (fd < 0)
- err(1, "cannot create event");
-#endif //PROFILING
+
if (m_use_multithreading){
std::vector<std::future<cv::Mat>> async_res(p_scales.size());
for (size_t i = 0; i < p_scales.size(); ++i) {
} else {
#pragma omp parallel for ordered private(patch_feat) schedule(dynamic)
for (size_t i = 0; i < p_scales.size(); ++i) {
-#ifdef PROFILING
- ret = ioctl(fd, PERF_EVENT_IOC_RESET, 0);
- if (ret)
- err(1, "ioctl(reset) failed");
- ret = ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
- if (ret)
- err(1, "ioctl(enable) failed");
-#endif //PROFILING
patch_feat = get_features(input_rgb, input_gray, p_pose.cx, p_pose.cy, p_windows_size[0], p_windows_size[1], p_current_scale * p_scales[i]);
-#ifdef PROFILING
- ret = ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
- if (ret)
- err(1, "ioctl(disable) failed");
- ret = read(fd, values, sizeof(values));
- if (ret != sizeof(values))
- err(1, "cannot read results: %s", strerror(errno));
- if (values[2])
- count += (uint64_t)((double)values[0] * values[1]/values[2]);
-#endif //PROFILING
ComplexMat zf = fft2(patch_feat, p_cos_window);
cv::Mat response;
if (m_use_linearkernel)
p_current_scale = p_min_max_scale[0];
if (p_current_scale > p_min_max_scale[1])
p_current_scale = p_min_max_scale[1];
-#ifdef PROFILING
- ret = ioctl(fd, PERF_EVENT_IOC_RESET, 0);
- if (ret)
- err(1, "ioctl(reset) failed");
- ret = ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
- if (ret)
- err(1, "ioctl(enable) failed");
-#endif //PROFILING
//obtain a subwindow for training at newly estimated target position
patch_feat = get_features(input_rgb, input_gray, p_pose.cx, p_pose.cy, p_windows_size[0], p_windows_size[1], p_current_scale);
-#ifdef PROFILING
- ret = ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
- if (ret)
- err(1, "ioctl(disable) failed");
- ret = read(fd, values, sizeof(values));
- if (ret != sizeof(values))
- err(1, "cannot read results: %s", strerror(errno));
- if (values[2])
- count += (uint64_t)((double)values[0] * values[1]/values[2]);
- printf("count=%'"PRIu64"\n", count/p_scales.size()+1);
- close(fd);
- pfm_terminate();
-#endif //PROFILING
ComplexMat xf = fft2(patch_feat, p_cos_window);
//subsequent frames, interpolate model