Thanks for your reply ,David Long.
Can you give me url of the kernel version 3.4.19?Thanks.


2012/12/5 David Long <dave.long@linaro.org>
On 12/04/12 13:46, Scott Bambrough wrote:
+ Dave Long



On Tue, Dec 4, 2012 at 3:37 AM, Peng Fan <xfan87@gmail.com <mailto:xfan87@gmail.com>> wrote:


    I use the option `-v`, and I can see that the first number of
    branches, instructions branch-misses and so on is zero.why?

    root@android:/ # perf stat -v echo "linaro"
    linaro
    task-clock: 93902590 93902590 93902590

    context-switches: 9 93902590 93902590

    CPU-migrations: 0 93902590 93902590
    page-faults: 104 93902590 93902590
    cycles: 4284725 76202392 76202392
    stalled-cycles-frontend: 0 76202392 76202392
    stalled-cycles-backend: 0 76202392 76202392
    instructions: 0 76202392 76202392
    branches: 0 76202392 76202392
    branch-misses: 0 76202392 76202392

     Performance counter stats for 'echo linaro':

             93.902590 task-clock                #    0.282 CPUs utilized
                     9 context-switches          #    0.000 M/sec
                     0 CPU-migrations            #    0.000 M/sec
                   104 page-faults               #    0.001 M/sec
               4284725 cycles                    #    0.046 GHz
    *                 0 stalled-cycles-frontend   #    0.00% frontend

    cycles idle
                     0 stalled-cycles-backend    #    0.00% backend     cycles idle
                     0 instructions              #    0.00 insns per
    cycle
                     0 branches                  #    0.000 M/sec
                     0 branch-misses             #    0.00% of all
    branches *


           0.332550049 seconds time elapsed

    Can anybody give me suggestions?How can I use perf to get the
    value of hardware performance counter


Using a recent 3.4.19 kernel I am unable to reproduce your results:


context-switches: 0 8941650 8941650
CPU-migrations: 0 8941650 8941650
page-faults: 147 8941650 8941650
cycles: 2665204 8941650 8941650
stalled-cycles-frontend: 365973 8941650 8941650
stalled-cycles-backend: 1748465 8941650 8941650
instructions: 1368842 8941650 8941650
branches: 152838 8941650 8941650
branch-misses: 53924 8941650 8941650


 Performance counter stats for 'echo linaro':

          8.941650 task-clock                #    0.740 CPUs utilized
                 0 context-switches          #    0.000 K/sec
                 0 CPU-migrations            #    0.000 K/sec
               147 page-faults               #    0.016 M/sec
           2665204 cycles                    #    0.298 GHz
            365973 stalled-cycles-frontend   #   13.73% frontend cycles idle
           1748465 stalled-cycles-backend    #   65.60% backend cycles idle
           1368842 instructions              #    0.51  insns per cycle
                                             #    1.28  stalled cycles per insn
            152838 branches                  #   17.093 M/sec
             53924 branch-misses             #   35.28% of all branches

       0.012084973 seconds time elapsed


Significant changes were made the the counter/event kernel code about the time of the release.  I do not believe they made it in in time.  Please try simply using a slightly more recent kernel.

--
David Long
Kernel Engineer, TI Landing Team
Linaro