title: How to resolve "not counted" in perf?
body: <p>perf stat -d ./sample.out
  Output is:</p>
  <pre><code>Performance counter stats for './sample.out':
  
            0.586266 task-clock (msec)         #    0.007 CPUs utilized          
                   2 context-switches          #    0.003 M/sec                  
                   1 cpu-migrations            #    0.002 M/sec                  
                 116 page-faults               #    0.198 M/sec                  
            7,35,790 cycles                    #    1.255 GHz                     [81.06%]
       &lt;not counted&gt; stalled-cycles-frontend 
     &lt;not supported&gt; stalled-cycles-backend  
       &lt;not counted&gt; instructions            
       &lt;not counted&gt; branches                
       &lt;not counted&gt; branch-misses           
     &lt;not supported&gt; L1-dcache-loads:HG      
       &lt;not counted&gt; L1-dcache-load-misses:HG
       &lt;not counted&gt; LLC-loads:HG            
     &lt;not supported&gt; LLC-load-misses:HG      
  
         0.088013919 seconds time elapsed
  </code></pre>
  <p>I read why  will show up from <a href="https://unix.stackexchange.com/questions/98641/understanding-perf-tool-output"></a>. But I am getting  for even basic counters like instructions, branches etc. Can anyone suggest how to make it work?</p>
  <p>Interesting thing is:</p>
  <blockquote>
  <p>sudo perf stat sleep 3</p>
  </blockquote>
  <p>gives output:</p>
  <pre><code>Performance counter stats for 'sleep 3':
  
            0.598484 task-clock (msec)         #    0.000 CPUs utilized          
                   2 context-switches          #    0.003 M/sec                  
                   0 cpu-migrations            #    0.000 K/sec                  
                 181 page-faults               #    0.302 M/sec                  
       &lt;not counted&gt; cycles                  
       &lt;not counted&gt; stalled-cycles-frontend 
     &lt;not supported&gt; stalled-cycles-backend  
       &lt;not counted&gt; instructions            
       &lt;not counted&gt; branches                
       &lt;not counted&gt; branch-misses
  </code></pre>
  <blockquote>
  <p>sudo perf stat -C 1 sleep 3</p>
  </blockquote>
  <pre><code> Performance counter stats for 'CPU(s) 1':
  
         3002.640578 task-clock (msec)         #    1.001 CPUs utilized           [100.00%]
                 425 context-switches          #    0.142 K/sec                   [100.00%]
                   9 cpu-migrations            #    0.003 K/sec                   [100.00%]
                   5 page-faults               #    0.002 K/sec                  
         7,82,97,019 cycles                    #    0.026 GHz                     [33.32%]
         9,38,21,585 stalled-cycles-frontend   #  119.83% frontend cycles idle    [33.32%]
     &lt;not supported&gt; stalled-cycles-backend  
         3,09,81,643 instructions              #    0.40  insns per cycle        
                                               #    3.03  stalled cycles per insn [33.32%]
           70,15,390 branches                  #    2.336 M/sec                   [33.32%]
            6,38,644 branch-misses             #    9.10% of all branches         [33.32%]
  
         3.001075650 seconds time elapsed
  </code></pre>
  <p>Why is this unexpected working.??</p>
  <p>Thank you</p>