01 Feb, 2017

1 commit

  • Similar to for_each_subsystem and for_each_event in util/parse-events.c,
    add new macro 'for_each_event' for easy iteration over the tracepoints
    in order to be more compact and readable.

    Signed-off-by: Taeung Song
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1485862711-20216-2-git-send-email-treeze.taeung@gmail.com
    [ Slight change to keep existing style for checking strcmp() return ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Taeung Song
     

26 Jan, 2017

1 commit

  • Current trace info data lacks the saved cmdline mapping which is needed
    for pevent to find out the comm of a task. Add this and bump up the
    version number so that perf can determine its presence when reading.

    This is mostly corresponding to trace.dat file version 6, but still
    lacks 4 byte of number of cpus, and 10 bytes of type string - and I
    think we don't need those anyway.

    Signed-off-by: Namhyung Kim
    Tested-by: Masami Hiramatsu
    Cc: Frederic Weisbecker
    Cc: Jeremy Eder
    Cc: Jiri Olsa ,
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    [ Change version test from == to >= ]
    Link: http://lkml.kernel.org/n/tip-vaooqpxsikxbb3359p0corcb@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

04 Sep, 2015

1 commit

  • Moving tracing_path interface into api/fs/tracing_path.c out of util.c.
    It seems generic enough to be used by others, and I couldn't think of
    better place.

    Signed-off-by: Jiri Olsa
    Reviewed-by: Matt Fleming
    Reviewed-by: Raphael Beamonte
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1441180605-24737-5-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

24 Jul, 2015

1 commit

  • Since we now ask libtraceevent, the only user of this payload, to use
    perf's symbol resolution routines, there is no need to carry about
    ~4.5MB per perf.data when we can get it from one of the places the perf
    symbol resolution looks for that symtab (debuginfo, ~/.debug/,
    /proc/kallsyms, --symfs, etc), using the kernel and modules build-ids to
    make sure the right table is used.

    Acked-by: David Ahern
    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/n/tip-h89ituf9rso2rv1v7kjrbeda@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

17 Jul, 2014

1 commit

  • Moving pr_* debug macros to have it with in same object as debug
    variables, becase we will change them to use verbose variable in next
    patch.

    Signed-off-by: Jiri Olsa
    Cc: Corey Ashford
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1405374411-29012-3-git-send-email-jolsa@kernel.org
    [ Add missing debug.h include in python scripting glue and in the libdw unwind lib ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

08 Jul, 2014

1 commit

  • The following snippet
    V = malloc(S);
    if (!V) { }
    sprintf(V, ...)

    Can be easily changed to a one line:

    if (asprintf(&V, ...) < 0) { }

    Signed-off-by: Andy Shevchenko
    Cc: Adrian Hunter
    Link: http://lkml.kernel.org/r/1404474229-15272-1-git-send-email-andriy.shevchenko@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Andy Shevchenko
     

28 Dec, 2013

2 commits

  • Several areas already used this technique, so do some audit to
    consistently use it elsewhere.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-9sbere0kkplwe45ak6rk4a1f@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • For the frequent idiom of:

    free(ptr);
    ptr = NULL;

    Make it expect a pointer to the pointer being freed, so that it becomes
    clear at first sight that the variable being freed is being modified.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-pfw02ezuab37kha18wlut7ir@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

17 Dec, 2013

1 commit

  • Move debugfs.* to api/fs/. We have a common tools/lib/api/ place where
    the Makefile lives and then we place the headers in subdirs.

    For example, all the fs-related stuff goes to tools/lib/api/fs/ from
    which we get libapikfs.a (acme got almost the naming he wanted :-)) and
    we link it into the tools which need it - in this case perf and
    tools/vm/page-types.

    acme:

    "Looking at the implementation, I think some tools can even link
    directly to the .o files, avoiding the .a file altogether.

    But that is just an optimization/finer granularity tools/lib/
    cherrypicking that toolers can make use of."

    Fixup documentation cleaning target while at it.

    Signed-off-by: Borislav Petkov
    Acked-by: Ingo Molnar
    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: Arjan van de Ven
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Pekka Enberg
    Cc: Peter Zijlstra
    Cc: Robert Richter
    Cc: Stanislav Fomichev
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1386605664-24041-2-git-send-email-bp@alien8.de
    Signed-off-by: Arnaldo Carvalho de Melo

    Borislav Petkov
     

13 Jul, 2013

4 commits

  • It's useless to call the read_trace_init() function at this time as we
    don't need a returned pevent and it makes me confusing. :)

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1370323231-14022-16-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • It's confusing to have same name for two difference functions which does
    something opposite way. Since what they do in this file is read *AND*
    writing some of tracing metadata files, rename them to record_*() looks
    better to me.

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1370323231-14022-15-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Most tracepoint events already have their system and event name in
    ->name field so that searching whole event tracing directory for each
    evsel to match given id is suboptimal.

    Factor out this routine into tracepoint_name_to_path(). In case of en
    invalid name, it'll try to find path using id again.

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1372230862-15861-3-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Since they're generic helpers move them to util.c so that they can be
    used by others.

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1372230862-15861-2-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

22 Mar, 2013

4 commits


16 Mar, 2013

6 commits

  • It's defined in util/util.c and gets set from the begining of perf run.
    No need to duplicate it.

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1363173585-9754-6-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • They're never used and looks like leftovers from the porting of
    trace-cmd code.

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1363173585-9754-5-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • It's not set from anywhere so no need to keep it. Looks like an
    unneeded copy of the same variable in trace-event-read.c

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1363173585-9754-4-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • struct event_list and struct events are never used.

    Just get rid of them.

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1363173585-9754-3-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Move them to util.c and simplify code a bit.

    Signed-off-by: Borislav Petkov
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1361374353-30385-6-git-send-email-bp@alien8.de
    Signed-off-by: Arnaldo Carvalho de Melo

    Borislav Petkov
     
  • This introduces the tools/lib/lk library, that will gradually have the
    routines that now are used in tools/perf/ and other tools and that can
    be shared.

    Start by carving out debugfs routines for general use.

    Signed-off-by: Borislav Petkov
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/1361374353-30385-5-git-send-email-bp@alien8.de
    [ committer note: Add tools/lib/lk/ to perf's MANIFEST so that its tarballs continue to build ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Borislav Petkov
     

25 Apr, 2012

1 commit

  • The event parsing code in perf was originally copied from trace-cmd
    but never was kept up-to-date with the changes that was done there.
    The trace-cmd libtraceevent.a code is much more mature than what is
    currently in perf.

    This updates the code to use wrappers to handle the calls to the
    new event parsing code. The new code requires a handle to be pass
    around, which removes the global event variables and allows
    more than one event structure to be read from different files
    (and different machines).

    But perf still has the old global events and the code throughout
    perf does not yet have a nice way to pass around a handle.
    A global 'pevent' has been made for perf and the old calls have
    been created as wrappers to the new event parsing code that uses
    the global pevent.

    With this change, perf can later incorporate the pevent handle into
    the perf structures and allow more than one file to be read and
    compared, that contains different events.

    Signed-off-by: Steven Rostedt
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Steven Rostedt
    Cc: Borislav Petkov
    Cc: Jiri Olsa
    Cc: Arun Sharma
    Cc: Namhyung Kim
    Signed-off-by: Frederic Weisbecker

    Steven Rostedt
     

08 Jan, 2012

1 commit

  • The ctype.h include is not needed here and it breaks build on some systems (at
    least 64bit Ubuntu 10.04) like below. Just get rid of it.

    CC util/trace-event-info.o
    cc1: warnings being treated as errors
    util/trace-event-info.c: In function ‘record_file’:
    util/trace-event-info.c:192: error: implicit declaration of function ‘pwrite’
    util/trace-event-info.c:192: error: nested extern declaration of ‘pwrite’
    make: *** [util/trace-event-info.o] Error 1

    Cc: Ingo Molnar
    Cc: Joerg Roedel
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1326035430-7621-1-git-send-email-namhyung@gmail.com
    Signed-off-by: Namhyung Kim
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

28 Nov, 2011

1 commit


28 Oct, 2011

1 commit

  • Fix a typo which may be introduced when original code has been copied
    from trace-cmd.

    Cc: Ingo Molnar
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: yrl.pp-manager.tt@hitachi.com
    Link: http://lkml.kernel.org/r/20111004104456.14591.37395.stgit@fedora15
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

20 Oct, 2011

1 commit

  • Fixing the way the tracing information is stored within record command.
    The current implementation is causing issues for pipe output.

    Following commands fail currently:
    perf script syscall-counts ls
    perf record -e syscalls:sys_exit_read ls | ./perf report -i -

    The tracing information is part of the perf data file. It contains
    several files from within the tracing debugfs and procs directories.

    Beside some static header files, for each tracing event the format
    file is added. The /proc/kallsyms file is also added.

    The tracing data are stored with preceeding size. This is causing some
    dificulties for pipe output, since there's no way to tell debugfs/proc
    file size before reading it. So, for pipe output, all the debugfs files
    were read twice. Once to get the overall size and once to store the
    content itself. This can cause problem in case any of these file
    changed, within the storage time.

    To fix this behaviour and ensure the integrity of the tracing data, we:
    - read debugfs/proc file into the temp file
    - get temp file size and dump it to the pipe
    - dump the temp file contents to the pipe

    Cc: Eric Dumazet
    Cc: Ingo Molnar
    Cc: Neil Horman
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/20111020135943.GD2092@jolsa.brq.redhat.com
    Signed-off-by: Jiri Olsa
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

15 Jul, 2011

1 commit

  • While attempting to create a timechart of boot up I found perf didn't
    tolerate modules being loaded/unloaded. This patch fixes this by
    reading the file once and then writing the size read at the correct
    point in the file. It also simplifies the code somewhat.

    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Ingo Molnar
    Cc: Arnaldo Carvalho de Melo
    Signed-off-by: Sonny Rao
    Signed-off-by: Michael Neuling
    Link: http://lkml.kernel.org/r/10011.1310614483@neuling.org
    Signed-off-by: Steven Rostedt

    Sonny Rao
     

04 Jan, 2011

1 commit

  • Out of ad-hoc code and global arrays with hard coded sizes.

    This is the first step on having a library that will be first
    used on regression tests in the 'perf test' tool.

    [acme@felicio linux]$ size /tmp/perf.before
    text data bss dec hex filename
    1273776 97384 5104416 6475576 62cf38 /tmp/perf.before
    [acme@felicio linux]$ size /tmp/perf.new
    text data bss dec hex filename
    1275422 97416 1392416 2765254 2a31c6 /tmp/perf.new

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Tom Zanussi
    LKML-Reference:
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

05 May, 2010

1 commit

  • Fix a couple of inefficiencies and redundancies related to
    have_tracepoints() and its use when checking whether to write
    TRACE_INFO.

    First, there's no need to use get_tracepoints_path() in
    have_tracepoints() - we really just want the part that checks whether
    any attributes correspondo to tracepoints.

    Second, we really don't care about raw_samples per se - tracepoints
    are always raw_samples. In any case, the have_tracepoints() check
    should be sufficient to decide whether or not to write TRACE_INFO.

    Cc: Frederic Weisbecker
    Cc: Ingo Molnar ,
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Acked-by: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Tom Zanussi
     

03 May, 2010

1 commit

  • The current perf code implicitly assumes SAMPLE_RAW means tracepoints
    are being used, but doesn't check for that. It happily records the
    TRACE_INFO even if SAMPLE_RAW is used without tracepoints, but when the
    perf data is read it won't go any further when it finds TRACE_INFO but
    no tracepoints, and displays misleading errors.

    This adds a check for both in perf-record, and won't record TRACE_INFO
    unless both are true. This at least allows perf report -D to dump raw
    events, and avoids triggering a misleading error condition in perf
    trace. It doesn't actually enable the non-tracepoint raw events to be
    displayed in perf trace, since perf trace currently only deals with
    tracepoint events.

    Cc: Frédéric Weisbecker
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Tom Zanussi
    Signed-off-by: Arnaldo Carvalho de Melo

    Tom Zanussi
     

14 Apr, 2010

1 commit

  • Bypasses the tracing_data perf header code and replaces it with
    a synthesized event and processing function that accomplishes
    the same thing, used when reading/writing perf data to/from a
    pipe.

    The tracing data is pretty large, and this patch doesn't attempt
    to break it down into component events. The tracing_data event
    itself doesn't actually contain the tracing data, rather it
    arranges for the event processing code to skip over it after
    it's read, using the skip return value added to the event
    processing loop in a previous patch.

    Signed-off-by: Tom Zanussi
    Acked-by: Thomas Gleixner
    Cc: fweisbec@gmail.com
    Cc: rostedt@goodmis.org
    Cc: k-keiichi@bx.jp.nec.com
    Cc: acme@ghostprotocols.net
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tom Zanussi
     

16 Jan, 2010

1 commit


28 Dec, 2009

3 commits

  • Signed-off-by: Xiao Guangrong
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Frederic Weisbecker
    Cc: Clark Williams
    Cc: John Kacur
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Xiao Guangrong
     
  • Remove redundant code for 'perf trace'

    Signed-off-by: Xiao Guangrong
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Frederic Weisbecker
    Cc: Clark Williams
    Cc: John Kacur
    LKML-Reference:
    [ v2: resolved conflicts with recent changes ]
    Signed-off-by: Ingo Molnar

    Xiao Guangrong
     
  • A few more optimizations for perf when dealing with directories.

    Some of them significantly cut down the work which has to be
    done. d_type should always be set; otherwise fix the kernel
    code. And there are functions available to parse fstab-like
    files, so use them.

    Signed-off-by: Ulrich Drepper
    Acked-by: Pekka Enberg
    Cc: a.p.zijlstra@chello.nl
    Cc: acme@redhat.com
    Cc: eranian@google.com
    Cc: fweisbec@gmail.com
    Cc: lizf@cn.fujitsu.com
    Cc: paulus@samba.org
    Cc: xiaoguangrong@cn.fujitsu.com
    LKML-Reference:
    [ v2: two small stylistic fixlets ]
    Signed-off-by: Ingo Molnar

    Ulrich Drepper
     

22 Nov, 2009

1 commit

  • It better propagate errors, also if we do a simple:

    [root@doppio linux-2.6-tip]# perf record -R -a -f sleep 3s ;
    perf trace [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.182 MB perf.data (~7972 samples) ]
    Fatal: not an trace data file
    [root@doppio linux-2.6-tip]#

    That is what is expected, right? I.e. as we didn't specify any
    tracepoint event via -e, it should gracefully bail out and not
    SEGFAULT.

    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Steven Rostedt
    Cc: Frédéric Weisbecker
    Cc: Mike Galbraith
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    LKML-Reference:
    [ Fixed the error messages some more ]
    Signed-off-by: Ingo Molnar

    Arnaldo Carvalho de Melo
     

07 Oct, 2009

1 commit

  • This drops the trace.info file and move its contents into the
    common perf.data file.

    This is done by creating a new trace_info section into this file. A
    user of perf headers needs to call perf_header__set_trace_info() to
    save the trace meta informations into the perf.data file.

    A file created by perf after his patch is unsupported by previous
    version because the size of the headers have increased.

    That said, it's two new fields that have been added in the end of
    the headers, and those could be ignored by previous versions if
    they just handled the dynamic header size and then ignore the
    unknow part. The offsets guarantee the compatibility. We'll do a
    -stable fix for that.

    But current previous versions handle the header size using its
    static size, not dynamic, then it's not backward compatible with
    trace records.

    Signed-off-by: Frederic Weisbecker
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Paul Mackerras
    Cc: Mike Galbraith
    Cc: Paul Mackerras
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

21 Sep, 2009

1 commit

  • Bye-bye Performance Counters, welcome Performance Events!

    In the past few months the perfcounters subsystem has grown out its
    initial role of counting hardware events, and has become (and is
    becoming) a much broader generic event enumeration, reporting, logging,
    monitoring, analysis facility.

    Naming its core object 'perf_counter' and naming the subsystem
    'perfcounters' has become more and more of a misnomer. With pending
    code like hw-breakpoints support the 'counter' name is less and
    less appropriate.

    All in one, we've decided to rename the subsystem to 'performance
    events' and to propagate this rename through all fields, variables
    and API names. (in an ABI compatible fashion)

    The word 'event' is also a bit shorter than 'counter' - which makes
    it slightly more convenient to write/handle as well.

    Thanks goes to Stephane Eranian who first observed this misnomer and
    suggested a rename.

    User-space tooling and ABI compatibility is not affected - this patch
    should be function-invariant. (Also, defconfigs were not touched to
    keep the size down.)

    This patch has been generated via the following script:

    FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')

    sed -i \
    -e 's/PERF_EVENT_/PERF_RECORD_/g' \
    -e 's/PERF_COUNTER/PERF_EVENT/g' \
    -e 's/perf_counter/perf_event/g' \
    -e 's/nb_counters/nb_events/g' \
    -e 's/swcounter/swevent/g' \
    -e 's/tpcounter_event/tp_event/g' \
    $FILES

    for N in $(find . -name perf_counter.[ch]); do
    M=$(echo $N | sed 's/perf_counter/perf_event/g')
    mv $N $M
    done

    FILES=$(find . -name perf_event.*)

    sed -i \
    -e 's/COUNTER_MASK/REG_MASK/g' \
    -e 's/COUNTER/EVENT/g' \
    -e 's/\/event_id/g' \
    -e 's/counter/event/g' \
    -e 's/Counter/Event/g' \
    $FILES

    ... to keep it as correct as possible. This script can also be
    used by anyone who has pending perfcounters patches - it converts
    a Linux kernel tree over to the new naming. We tried to time this
    change to the point in time where the amount of pending patches
    is the smallest: the end of the merge window.

    Namespace clashes were fixed up in a preparatory patch - and some
    stylistic fallout will be fixed up in a subsequent patch.

    ( NOTE: 'counters' are still the proper terminology when we deal
    with hardware registers - and these sed scripts are a bit
    over-eager in renaming them. I've undone some of that, but
    in case there's something left where 'counter' would be
    better than 'event' we can undo that on an individual basis
    instead of touching an otherwise nicely automated patch. )

    Suggested-by: Stephane Eranian
    Acked-by: Peter Zijlstra
    Acked-by: Paul Mackerras
    Reviewed-by: Arjan van de Ven
    Cc: Mike Galbraith
    Cc: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Cc: Steven Rostedt
    Cc: Benjamin Herrenschmidt
    Cc: David Howells
    Cc: Kyle McMartin
    Cc: Martin Schwidefsky
    Cc: "David S. Miller"
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc:
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Ingo Molnar