lkml.org 
[lkml]   [2009]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf_counter tools: remove glib dependency and fix bugs in kerneltop.c

* Paul Mackerras <paulus@samba.org> wrote:

> The glib dependency in kerneltop.c is only for a little bit of list
> manipulation, and I find it inconvenient. This adds a 'next' field to
> struct source_line, which lets us link them together into a list. The
> code to do the linking ourselves turns out to be no longer or more
> difficult than using glib.
>
> This also fixes a few other problems:
>
> - We need to #include <limits.h> to get PATH_MAX on powerpc.
>
> - We need to #include <linux/types.h> rather than have our own
> definitions of __u64 and __s64; on powerpc the installed headers
> define them to be unsigned long and long respectively, and if we
> have our own, different definition here that causes a compile error.
>
> - This takes out the x86 setting of errno from -ret in
> sys_perf_counter_open. My experiments on x86 indicate that the
> glibc syscall() does this for us already.
>
> - We had two CPU migration counters in the default set, which seems
> unnecessary; I changed one of them to a context switch counter.
>
> - In perfstat mode we were printing CPU cycles and instructions as
> milliseconds, and the cpu clock and task clock counters as events.
> This fixes that.
>
> - In perfstat mode we were still printing a blank line after the first
> counter, which was a holdover from when a task clock counter was
> automatically included as the first counter. This removes the blank
> line.
>
> - On a test machine here, parse_symbols() and parse_vmlinux() were
> taking long enough (almost 0.5 seconds) for the mmap buffer to
> overflow before we got to the first mmap_read() call, so this moves
> them before we open all the counters.
>
> - The error message if sys_perf_counter_open fails needs to use errno,
> not -fd[i][counter].
>
> Signed-off-by: Paul Mackerras <paulus@samba.org>
>
> ---
> Documentation/perf_counter/Makefile | 2 +-
> Documentation/perf_counter/kerneltop.c | 112 +++++++++++++-------------------
> 2 files changed, 46 insertions(+), 68 deletions(-)

Very nice, thanks Paul!

Ingo


\
 
 \ /
  Last update: 2009-03-24 10:23    [W:0.067 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site