title: Calculate execution time of a function in c++ (visual studio 2010)
body: <p>I am coding in c++ and working on Visual Studio 2010. I am trying to compute the time that a function takes to execute, here is my code</p>
  
  <pre><code>        double sum=0;   
          clock_t start_s=clock();
          for(int j=1;j&lt;size;j++)
          {
              int key=data[j];
              int i=j-1;
              while(i&gt;=0 &amp;&amp; data[i]&gt;key)
              {
                  data[i+1]=data[i];
                  i=i-1;
              }
              data[i+1]=key;
          }
          clock_t stop_s=clock();
          sum=((double)(stop_s - start_s)/CLOCKS_PER_SEC);
  </code></pre>
  
  <p>but the problem is that the time computes to 0. How can I measure the time in even smaller unit</p>