]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/commitdiff
Remove profiling code
authorMichal Sojka <michal.sojka@cvut.cz>
Fri, 9 Mar 2018 23:53:31 +0000 (00:53 +0100)
committerMichal Sojka <michal.sojka@cvut.cz>
Fri, 9 Mar 2018 23:58:56 +0000 (00:58 +0100)
In its current form, it complicates understanding of the rest of the
code.

src/kcf.cpp

index 41293808a5dd9f7705ab86958598c067c7abcd9b..f29e961dcadcc7076cf3703d04bcf244314d5769 100644 (file)
@@ -4,12 +4,6 @@
 #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>
@@ -183,23 +177,7 @@ void KCF_Tracker::track(cv::Mat &img)
     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) {
@@ -239,25 +217,7 @@ void KCF_Tracker::track(cv::Mat &img)
     } 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)
@@ -318,29 +278,8 @@ void KCF_Tracker::track(cv::Mat &img)
         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