title: How to count time in a process JNI?
body: <p>I want to make logging time which a JNI's cpp system needed for every process.This is my code : </p>
  
  <pre><code>/*
  *  ImageProcessing.cpp
  */
  #include &lt;jni.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string&gt;
  #include &lt;android/log.h&gt;
  #include &lt;strstream&gt;
  #include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/imgproc/imgproc_c.h&gt;
  #include &lt;opencv2/objdetect/objdetect.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;vector&gt;
  
  
  #define LOG_TAG "TourGuide"
  #define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
  
  using namespace std;
  using namespace cv;
  
  std::vector&lt;float&gt; parse_delimeted_list_of_numbers(char* line, char delimeter)
  {
      std::vector&lt;float&gt; vector_of_numbers;
      std::istrstream input_stream(line);
      std::string text;
      float number;
      while (std::getline(input_stream, text, delimeter)) {
          sscanf(text.c_str(), "%f", &amp;number, text.size());
          vector_of_numbers.push_back(number);
      }
      return vector_of_numbers;
  }
  
  extern "C"
  jboolean
  Java_com_example_franksyesipangkar_tourguide_CameraPreview_ImageProcessing
  (JNIEnv* env, jobject thiz, jint width, jint height, jbyteArray NV21FrameData, jintArray outPixels, jbyteArray b)
  
  {
  
  LOGD("JNIEnv");
  
  
      //convert jbyteArray to char
      jbyte *cmd = env-&gt;GetByteArrayElements(b, 0);
      LOGD("JNIEnvFeature");
  
  
  
      char feature[90600];//[819000] sejumlah 800kb untuk ukuran file
      memset(feature,0, sizeof(feature));
      memcpy(feature, cmd, strlen((char*)cmd));
  
      LOGD("OutFeature: %s", feature);
      //LOGD("OutCMD: %s", cmd);
  
  
  
                vector&lt;float&gt; vectorHOGSVM;
  
                  vectorHOGSVM = parse_delimeted_list_of_numbers(feature, ' ');
  
  
           LOGD("Parsing Vector Success ");
  
  
  
  
      /* Mengambil data pointer */
      jbyte * pNV21FrameData = env-&gt;GetByteArrayElements(NV21FrameData, 0);
      jint * poutPixels = env-&gt;GetIntArrayElements(outPixels, 0);
  
      /* Membuat matrix dari input frame gambar */
  
      Mat mGray(height, width, CV_8UC1, (unsigned char *)pNV21FrameData);
      Mat mResult(height, width, CV_8UC4, (unsigned char *)poutPixels);
  
      /* Mengubah matrix kembali menjadi frame gambar */
      IplImage GrayImg = mGray;
      IplImage ResultImg = mResult;
  
  
  
          HOGDescriptor hog;
      //hog.winSize = Size(56,40);
  
      // Set our custom detecting vector
        hog.setSVMDetector(vectorHOGSVM);
  
  
      //hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
  
  
  
      /* Deklarasi variable vector untuk menggambar kotak deteksi */
      vector&lt;Rect&gt; found, found_filtered;
      size_t i, j;
  
  
  
  
  
          hog.detectMultiScale(mGray, found, 0, Size(8,8), Size(32,32), 1.05, 2);
  
  
  
      double t = (double)getTickCount();
      t = (double)getTickCount() - t;
     LOGD("Detection Time: %gms", t*1000./cv::getTickFrequency());
     LOGD("Animal: %d", found.size());
  
      for( i = 0; i &lt; found.size(); i++ )
          {
              Rect r = found[i];
              for( j = 0; j &lt; found.size(); j++ )
                  if( j != i &amp;&amp; (r &amp; found[j]) == r)
                      break;
              if( j == found.size() )
                  found_filtered.push_back(r);
          }
      if(found.size()) {
              Rect r = found[0];
              r.x += cvRound(r.width*0.1);
              r.width = cvRound(r.width*0.8);
              r.y += cvRound(r.height*0.07);
              r.height = cvRound(r.height*0.8);
              LOGD("c : %d, r : %d",r.height,r.width);
  
  
  
      cvCvtColor(&amp;GrayImg, &amp;ResultImg, CV_GRAY2BGR);
  
  
  
      env-&gt;ReleaseByteArrayElements(NV21FrameData, pNV21FrameData, 0);
      env-&gt;ReleaseIntArrayElements(outPixels, poutPixels, 0);
  
      env-&gt;ReleaseByteArrayElements(b, cmd, 0);
  
  
      return true;
  
  }
  </code></pre>
  
  <p>For detection process, I make logging time with <code>cv::getTickFrequency()</code> (OpenCV function) like this :</p>
  
  <pre><code> double t = (double)getTickCount();
   t = (double)getTickCount() - t;
   LOGD("Detection Time: %gms", t*1000./cv::getTickFrequency());
  </code></pre>
  
  <p>But, in another process I don't understand for making log time.So, I want to make logging time in every process, in process <code>LOGD("OutFeature: %s", feature);</code>, and process <code>LOGD("Parsing Vector Success ");</code>.Do you have an idea for it ?</p>