Skip to content
Snippets Groups Projects
Select Git revision
  • 1f6075f99073a8b5ec9649ae8c0bf2e06fdd42f1
  • openEuler-1.0-LTS default protected
  • openEuler-22.09
  • OLK-5.10
  • openEuler-22.03-LTS-Ascend
  • openEuler-22.03-LTS
  • master
  • openEuler-22.03-LTS-LoongArch-NW
  • openEuler-22.09-HCK
  • openEuler-20.03-LTS-SP3
  • openEuler-21.09
  • openEuler-21.03
  • openEuler-20.09
  • 4.19.90-2210.4.0
  • 5.10.0-121.0.0
  • 5.10.0-60.61.0
  • 4.19.90-2210.3.0
  • 5.10.0-60.60.0
  • 5.10.0-120.0.0
  • 5.10.0-60.59.0
  • 5.10.0-119.0.0
  • 4.19.90-2210.2.0
  • 4.19.90-2210.1.0
  • 5.10.0-118.0.0
  • 5.10.0-106.19.0
  • 5.10.0-60.58.0
  • 4.19.90-2209.6.0
  • 5.10.0-106.18.0
  • 5.10.0-106.17.0
  • 5.10.0-106.16.0
  • 5.10.0-106.15.0
  • 5.10.0-117.0.0
  • 5.10.0-60.57.0
33 results

builtin-stat.c

Blame
  • builtin-stat.c 47.40 KiB
    /*
     * builtin-stat.c
     *
     * Builtin stat command: Give a precise performance counters summary
     * overview about any workload, CPU or specific PID.
     *
     * Sample output:
    
       $ perf stat ./hackbench 10
    
      Time: 0.118
    
      Performance counter stats for './hackbench 10':
    
           1708.761321 task-clock                #   11.037 CPUs utilized
                41,190 context-switches          #    0.024 M/sec
                 6,735 CPU-migrations            #    0.004 M/sec
                17,318 page-faults               #    0.010 M/sec
         5,205,202,243 cycles                    #    3.046 GHz
         3,856,436,920 stalled-cycles-frontend   #   74.09% frontend cycles idle
         1,600,790,871 stalled-cycles-backend    #   30.75% backend  cycles idle
         2,603,501,247 instructions              #    0.50  insns per cycle
                                                 #    1.48  stalled cycles per insn
           484,357,498 branches                  #  283.455 M/sec
             6,388,934 branch-misses             #    1.32% of all branches
    
            0.154822978  seconds time elapsed
    
     *
     * Copyright (C) 2008-2011, Red Hat Inc, Ingo Molnar <mingo@redhat.com>
     *
     * Improvements and fixes by:
     *
     *   Arjan van de Ven <arjan@linux.intel.com>
     *   Yanmin Zhang <yanmin.zhang@intel.com>
     *   Wu Fengguang <fengguang.wu@intel.com>
     *   Mike Galbraith <efault@gmx.de>
     *   Paul Mackerras <paulus@samba.org>
     *   Jaswinder Singh Rajput <jaswinder@kernel.org>
     *
     * Released under the GPL v2. (and only v2, not any later version)
     */
    
    #include "perf.h"
    #include "builtin.h"
    #include "util/cgroup.h"
    #include "util/util.h"
    #include "util/parse-options.h"
    #include "util/parse-events.h"
    #include "util/pmu.h"
    #include "util/event.h"
    #include "util/evlist.h"
    #include "util/evsel.h"
    #include "util/debug.h"
    #include "util/color.h"
    #include "util/stat.h"
    #include "util/header.h"
    #include "util/cpumap.h"
    #include "util/thread.h"
    #include "util/thread_map.h"
    
    #include <stdlib.h>
    #include <sys/prctl.h>
    #include <locale.h>
    
    #define DEFAULT_SEPARATOR	" "
    #define CNTR_NOT_SUPPORTED	"<not supported>"
    #define CNTR_NOT_COUNTED	"<not counted>"
    
    static void print_stat(int argc, const char **argv);