* [GIT PULL 00/10] perf fixes and improvements
@ 2010-05-10 22:52 Arnaldo Carvalho de Melo
2010-05-10 22:52 ` [PATCH 01/10] perf hist: Calculate max_sym name len and nr_entries Arnaldo Carvalho de Melo
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:52 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo,
Frédéric Weisbecker, Mike Galbraith, Paul Mackerras,
Peter Zijlstra, Tom Zanussi
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Hi Ingo,
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf
Regards,
Arnaldo Carvalho de Melo (1):
perf hist: Calculate max_sym name len and nr_entries
Tom Zanussi (9):
perf/trace/scripting: failed-syscalls script cleanup
perf/trace/scripting: rw-by-pid script cleanup
perf/trace/scripting: rwtop script cleanup
perf/trace/scripting: wakeup-latency script cleanup
perf/trace/scripting: workqueue-stats script cleanup
perf/trace/scripting: don't show script start/stop messages by default
perf/trace/scripting: failed-syscalls-by-pid script cleanup
perf/trace/scripting: syscall-counts-by-pid script cleanup
perf/trace/scripting: syscall-counts script cleanup
tools/perf/builtin-report.c | 6 +-
tools/perf/builtin-trace.c | 3 +
tools/perf/scripts/perl/bin/failed-syscalls-report | 2 +-
tools/perf/scripts/perl/failed-syscalls.pl | 6 ++-
tools/perf/scripts/perl/rw-by-pid.pl | 60 ++++++++++++--------
tools/perf/scripts/perl/rwtop.pl | 48 +++++++++++----
tools/perf/scripts/perl/wakeup-latency.pl | 12 +++-
tools/perf/scripts/perl/workqueue-stats.pl | 12 ++--
.../python/bin/failed-syscalls-by-pid-report | 2 +-
.../python/bin/syscall-counts-by-pid-report | 2 +-
.../perf/scripts/python/bin/syscall-counts-report | 2 +-
tools/perf/util/hist.c | 27 +++++++--
tools/perf/util/hist.h | 4 +-
.../perf/util/scripting-engines/trace-event-perl.c | 3 -
.../util/scripting-engines/trace-event-python.c | 4 -
tools/perf/util/symbol.c | 5 +-
tools/perf/util/symbol.h | 1 +
17 files changed, 128 insertions(+), 71 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 01/10] perf hist: Calculate max_sym name len and nr_entries
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
@ 2010-05-10 22:52 ` Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 02/10] perf/trace/scripting: failed-syscalls script cleanup Arnaldo Carvalho de Melo
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:52 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo,
Frédéric Weisbecker, Mike Galbraith, Paul Mackerras,
Peter Zijlstra, Tom Zanussi
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Better done when we are adding entries, be it initially of when we're
re-sorting the histograms.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 6 +++---
tools/perf/util/hist.c | 27 ++++++++++++++++++++-------
tools/perf/util/hist.h | 4 +++-
tools/perf/util/symbol.c | 5 +++--
tools/perf/util/symbol.h | 1 +
5 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 53077fd..d7c7529 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -296,13 +296,13 @@ static int __cmd_report(void)
next = rb_first(&session->hists_tree);
while (next) {
struct hists *hists;
- u64 nr_hists;
hists = rb_entry(next, struct hists, rb_node);
hists__collapse_resort(hists);
- nr_hists = hists__output_resort(hists);
+ hists__output_resort(hists);
if (use_browser)
- perf_session__browse_hists(&hists->entries, nr_hists,
+ perf_session__browse_hists(&hists->entries,
+ hists->nr_entries,
hists->stats.total, help,
input_name);
else {
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 410cf56..e34fd24 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -47,6 +47,13 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template)
return self;
}
+static void hists__inc_nr_entries(struct hists *self, struct hist_entry *entry)
+{
+ if (entry->ms.sym && self->max_sym_namelen < entry->ms.sym->namelen)
+ self->max_sym_namelen = entry->ms.sym->namelen;
+ ++self->nr_entries;
+}
+
struct hist_entry *__hists__add_entry(struct hists *self,
struct addr_location *al,
struct symbol *sym_parent, u64 count)
@@ -89,6 +96,7 @@ struct hist_entry *__hists__add_entry(struct hists *self,
return NULL;
rb_link_node(&he->rb_node, parent, p);
rb_insert_color(&he->rb_node, &self->entries);
+ hists__inc_nr_entries(self, he);
out:
hist_entry__add_cpumode_count(he, al->cpumode, count);
return he;
@@ -137,7 +145,7 @@ void hist_entry__free(struct hist_entry *he)
* collapse the histogram
*/
-static void collapse__insert_entry(struct rb_root *root, struct hist_entry *he)
+static bool collapse__insert_entry(struct rb_root *root, struct hist_entry *he)
{
struct rb_node **p = &root->rb_node;
struct rb_node *parent = NULL;
@@ -153,7 +161,7 @@ static void collapse__insert_entry(struct rb_root *root, struct hist_entry *he)
if (!cmp) {
iter->count += he->count;
hist_entry__free(he);
- return;
+ return false;
}
if (cmp < 0)
@@ -164,6 +172,7 @@ static void collapse__insert_entry(struct rb_root *root, struct hist_entry *he)
rb_link_node(&he->rb_node, parent, p);
rb_insert_color(&he->rb_node, root);
+ return true;
}
void hists__collapse_resort(struct hists *self)
@@ -177,13 +186,16 @@ void hists__collapse_resort(struct hists *self)
tmp = RB_ROOT;
next = rb_first(&self->entries);
+ self->nr_entries = 0;
+ self->max_sym_namelen = 0;
while (next) {
n = rb_entry(next, struct hist_entry, rb_node);
next = rb_next(&n->rb_node);
rb_erase(&n->rb_node, &self->entries);
- collapse__insert_entry(&tmp, n);
+ if (collapse__insert_entry(&tmp, n))
+ hists__inc_nr_entries(self, n);
}
self->entries = tmp;
@@ -219,30 +231,31 @@ static void __hists__insert_output_entry(struct rb_root *entries,
rb_insert_color(&he->rb_node, entries);
}
-u64 hists__output_resort(struct hists *self)
+void hists__output_resort(struct hists *self)
{
struct rb_root tmp;
struct rb_node *next;
struct hist_entry *n;
u64 min_callchain_hits;
- u64 nr_hists = 0;
min_callchain_hits = self->stats.total * (callchain_param.min_percent / 100);
tmp = RB_ROOT;
next = rb_first(&self->entries);
+ self->nr_entries = 0;
+ self->max_sym_namelen = 0;
+
while (next) {
n = rb_entry(next, struct hist_entry, rb_node);
next = rb_next(&n->rb_node);
rb_erase(&n->rb_node, &self->entries);
__hists__insert_output_entry(&tmp, n, min_callchain_hits);
- ++nr_hists;
+ hists__inc_nr_entries(self, n);
}
self->entries = tmp;
- return nr_hists;
}
static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index bdde81e..1b18d04 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -19,10 +19,12 @@ struct events_stats {
struct hists {
struct rb_node rb_node;
struct rb_root entries;
+ u64 nr_entries;
struct events_stats stats;
u64 config;
u64 event_stream;
u32 type;
+ u32 max_sym_namelen;
};
struct hist_entry *__hists__add_entry(struct hists *self,
@@ -38,7 +40,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size,
long displacement, bool color, u64 total);
void hist_entry__free(struct hist_entry *);
-u64 hists__output_resort(struct hists *self);
+void hists__output_resort(struct hists *self);
void hists__collapse_resort(struct hists *self);
size_t hists__fprintf(struct hists *self, struct hists *pair,
bool show_displacement, FILE *fp);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 994efdb..ecccc8d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -130,8 +130,9 @@ static struct symbol *symbol__new(u64 start, u64 len, const char *name)
if (symbol_conf.priv_size)
self = ((void *)self) + symbol_conf.priv_size;
- self->start = start;
- self->end = len ? start + len - 1 : start;
+ self->start = start;
+ self->end = len ? start + len - 1 : start;
+ self->namelen = namelen - 1;
pr_debug4("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end);
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index edff866..6389d1a 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -54,6 +54,7 @@ struct symbol {
struct rb_node rb_node;
u64 start;
u64 end;
+ u16 namelen;
char name[0];
};
--
1.6.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 02/10] perf/trace/scripting: failed-syscalls script cleanup
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
2010-05-10 22:52 ` [PATCH 01/10] perf hist: Calculate max_sym name len and nr_entries Arnaldo Carvalho de Melo
@ 2010-05-10 22:53 ` Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 03/10] perf/trace/scripting: rw-by-pid " Arnaldo Carvalho de Melo
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:53 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Tom Zanussi, Frédéric Weisbecker,
Ingo Molnar, Arnaldo Carvalho de Melo
From: Tom Zanussi <tzanussi@gmail.com>
A couple small fixes for the failed syscalls script:
- The script description says it can be restricted to a specific comm,
make it so.
- silence the match output in the shell script
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1273466820-9330-2-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/scripts/perl/bin/failed-syscalls-report | 2 +-
tools/perf/scripts/perl/failed-syscalls.pl | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/perf/scripts/perl/bin/failed-syscalls-report b/tools/perf/scripts/perl/bin/failed-syscalls-report
index f634608..e3a5e55 100644
--- a/tools/perf/scripts/perl/bin/failed-syscalls-report
+++ b/tools/perf/scripts/perl/bin/failed-syscalls-report
@@ -2,7 +2,7 @@
# description: system-wide failed syscalls
# args: [comm]
if [ $# -gt 0 ] ; then
- if ! expr match "$1" "-" ; then
+ if ! expr match "$1" "-" > /dev/null ; then
comm=$1
shift
fi
diff --git a/tools/perf/scripts/perl/failed-syscalls.pl b/tools/perf/scripts/perl/failed-syscalls.pl
index c18e7e2..94bc25a 100644
--- a/tools/perf/scripts/perl/failed-syscalls.pl
+++ b/tools/perf/scripts/perl/failed-syscalls.pl
@@ -11,6 +11,8 @@ use Perf::Trace::Core;
use Perf::Trace::Context;
use Perf::Trace::Util;
+my $for_comm = shift;
+
my %failed_syscalls;
sub raw_syscalls::sys_exit
@@ -33,6 +35,8 @@ sub trace_end
foreach my $comm (sort {$failed_syscalls{$b} <=> $failed_syscalls{$a}}
keys %failed_syscalls) {
- printf("%-20s %10s\n", $comm, $failed_syscalls{$comm});
+ next if ($for_comm && $comm ne $for_comm);
+
+ printf("%-20s %10s\n", $comm, $failed_syscalls{$comm});
}
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 03/10] perf/trace/scripting: rw-by-pid script cleanup
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
2010-05-10 22:52 ` [PATCH 01/10] perf hist: Calculate max_sym name len and nr_entries Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 02/10] perf/trace/scripting: failed-syscalls script cleanup Arnaldo Carvalho de Melo
@ 2010-05-10 22:53 ` Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 04/10] perf/trace/scripting: rwtop " Arnaldo Carvalho de Melo
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:53 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Tom Zanussi, Frédéric Weisbecker,
Ingo Molnar, Arnaldo Carvalho de Melo
From: Tom Zanussi <tzanussi@gmail.com>
Some minor fixes for the rw-by-pid script:
- Fix nuisance 'use of uninitialized value' warnings
- Change the failed read/write sections to sort by error counts
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1273466820-9330-3-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/scripts/perl/rw-by-pid.pl | 60 +++++++++++++++++++++-------------
1 files changed, 37 insertions(+), 23 deletions(-)
diff --git a/tools/perf/scripts/perl/rw-by-pid.pl b/tools/perf/scripts/perl/rw-by-pid.pl
index da601fa..9db23c9 100644
--- a/tools/perf/scripts/perl/rw-by-pid.pl
+++ b/tools/perf/scripts/perl/rw-by-pid.pl
@@ -79,12 +79,12 @@ sub trace_end
printf("%6s %-20s %10s %10s %10s\n", "------", "--------------------",
"-----------", "----------", "----------");
- foreach my $pid (sort {$reads{$b}{bytes_read} <=>
- $reads{$a}{bytes_read}} keys %reads) {
- my $comm = $reads{$pid}{comm};
- my $total_reads = $reads{$pid}{total_reads};
- my $bytes_requested = $reads{$pid}{bytes_requested};
- my $bytes_read = $reads{$pid}{bytes_read};
+ foreach my $pid (sort { ($reads{$b}{bytes_read} || 0) <=>
+ ($reads{$a}{bytes_read} || 0) } keys %reads) {
+ my $comm = $reads{$pid}{comm} || "";
+ my $total_reads = $reads{$pid}{total_reads} || 0;
+ my $bytes_requested = $reads{$pid}{bytes_requested} || 0;
+ my $bytes_read = $reads{$pid}{bytes_read} || 0;
printf("%6s %-20s %10s %10s %10s\n", $pid, $comm,
$total_reads, $bytes_requested, $bytes_read);
@@ -96,16 +96,23 @@ sub trace_end
printf("%6s %20s %6s %10s\n", "------", "--------------------",
"------", "----------");
- foreach my $pid (keys %reads) {
- my $comm = $reads{$pid}{comm};
- foreach my $err (sort {$reads{$b}{comm} cmp $reads{$a}{comm}}
- keys %{$reads{$pid}{errors}}) {
- my $errors = $reads{$pid}{errors}{$err};
+ my @errcounts = ();
- printf("%6d %-20s %6d %10s\n", $pid, $comm, $err, $errors);
+ foreach my $pid (keys %reads) {
+ foreach my $error (keys %{$reads{$pid}{errors}}) {
+ my $comm = $reads{$pid}{comm} || "";
+ my $errcount = $reads{$pid}{errors}{$error} || 0;
+ push @errcounts, [$pid, $comm, $error, $errcount];
}
}
+ @errcounts = sort { $b->[3] <=> $a->[3] } @errcounts;
+
+ for my $i (0 .. $#errcounts) {
+ printf("%6d %-20s %6d %10s\n", $errcounts[$i][0],
+ $errcounts[$i][1], $errcounts[$i][2], $errcounts[$i][3]);
+ }
+
printf("\nwrite counts by pid:\n\n");
printf("%6s %20s %10s %10s\n", "pid", "comm",
@@ -113,11 +120,11 @@ sub trace_end
printf("%6s %-20s %10s %10s\n", "------", "--------------------",
"-----------", "----------");
- foreach my $pid (sort {$writes{$b}{bytes_written} <=>
- $writes{$a}{bytes_written}} keys %writes) {
- my $comm = $writes{$pid}{comm};
- my $total_writes = $writes{$pid}{total_writes};
- my $bytes_written = $writes{$pid}{bytes_written};
+ foreach my $pid (sort { ($writes{$b}{bytes_written} || 0) <=>
+ ($writes{$a}{bytes_written} || 0)} keys %writes) {
+ my $comm = $writes{$pid}{comm} || "";
+ my $total_writes = $writes{$pid}{total_writes} || 0;
+ my $bytes_written = $writes{$pid}{bytes_written} || 0;
printf("%6s %-20s %10s %10s\n", $pid, $comm,
$total_writes, $bytes_written);
@@ -129,16 +136,23 @@ sub trace_end
printf("%6s %20s %6s %10s\n", "------", "--------------------",
"------", "----------");
- foreach my $pid (keys %writes) {
- my $comm = $writes{$pid}{comm};
- foreach my $err (sort {$writes{$b}{comm} cmp $writes{$a}{comm}}
- keys %{$writes{$pid}{errors}}) {
- my $errors = $writes{$pid}{errors}{$err};
+ @errcounts = ();
- printf("%6d %-20s %6d %10s\n", $pid, $comm, $err, $errors);
+ foreach my $pid (keys %writes) {
+ foreach my $error (keys %{$writes{$pid}{errors}}) {
+ my $comm = $writes{$pid}{comm} || "";
+ my $errcount = $writes{$pid}{errors}{$error} || 0;
+ push @errcounts, [$pid, $comm, $error, $errcount];
}
}
+ @errcounts = sort { $b->[3] <=> $a->[3] } @errcounts;
+
+ for my $i (0 .. $#errcounts) {
+ printf("%6d %-20s %6d %10s\n", $errcounts[$i][0],
+ $errcounts[$i][1], $errcounts[$i][2], $errcounts[$i][3]);
+ }
+
print_unhandled();
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 04/10] perf/trace/scripting: rwtop script cleanup
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2010-05-10 22:53 ` [PATCH 03/10] perf/trace/scripting: rw-by-pid " Arnaldo Carvalho de Melo
@ 2010-05-10 22:53 ` Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 05/10] perf/trace/scripting: wakeup-latency " Arnaldo Carvalho de Melo
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:53 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Tom Zanussi, Frédéric Weisbecker,
Ingo Molnar, Arnaldo Carvalho de Melo
From: Tom Zanussi <tzanussi@gmail.com>
A couple of fixes for the rwtop script:
- printing the totals and clearing the hashes in the signal handler
eventually leads to various random and serious problems when running
the rwtop script continuously. Moving the print_totals() calls to
the event handlers solves that problem, and the event handlers are
invoked frequently enough that it doesn't affect the timeliness of
the output.
- Fix nuisance 'use of uninitialized value' warnings
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Message-Id: <1273466820-9330-4-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/scripts/perl/rwtop.pl | 48 +++++++++++++++++++++++++++----------
1 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/tools/perf/scripts/perl/rwtop.pl b/tools/perf/scripts/perl/rwtop.pl
index ec2ab49..4bb3ecd 100644
--- a/tools/perf/scripts/perl/rwtop.pl
+++ b/tools/perf/scripts/perl/rwtop.pl
@@ -21,6 +21,7 @@ use Perf::Trace::Util;
my $default_interval = 3;
my $nlines = 20;
my $print_thread;
+my $print_pending = 0;
my %reads;
my %writes;
@@ -36,6 +37,8 @@ sub syscalls::sys_exit_read
$common_pid, $common_comm,
$nr, $ret) = @_;
+ print_check();
+
if ($ret > 0) {
$reads{$common_pid}{bytes_read} += $ret;
} else {
@@ -52,6 +55,8 @@ sub syscalls::sys_enter_read
$common_pid, $common_comm,
$nr, $fd, $buf, $count) = @_;
+ print_check();
+
$reads{$common_pid}{bytes_requested} += $count;
$reads{$common_pid}{total_reads}++;
$reads{$common_pid}{comm} = $common_comm;
@@ -63,6 +68,8 @@ sub syscalls::sys_exit_write
$common_pid, $common_comm,
$nr, $ret) = @_;
+ print_check();
+
if ($ret <= 0) {
$writes{$common_pid}{errors}{$ret}++;
}
@@ -74,6 +81,8 @@ sub syscalls::sys_enter_write
$common_pid, $common_comm,
$nr, $fd, $buf, $count) = @_;
+ print_check();
+
$writes{$common_pid}{bytes_written} += $count;
$writes{$common_pid}{total_writes}++;
$writes{$common_pid}{comm} = $common_comm;
@@ -81,7 +90,7 @@ sub syscalls::sys_enter_write
sub trace_begin
{
- $SIG{ALRM} = \&print_totals;
+ $SIG{ALRM} = \&set_print_pending;
alarm 1;
}
@@ -91,6 +100,20 @@ sub trace_end
print_totals();
}
+sub print_check()
+{
+ if ($print_pending == 1) {
+ $print_pending = 0;
+ print_totals();
+ }
+}
+
+sub set_print_pending()
+{
+ $print_pending = 1;
+ alarm $interval;
+}
+
sub print_totals
{
my $count;
@@ -106,12 +129,12 @@ sub print_totals
printf("%6s %-20s %10s %10s %10s\n", "------", "--------------------",
"----------", "----------", "----------");
- foreach my $pid (sort {$reads{$b}{bytes_read} <=>
- $reads{$a}{bytes_read}} keys %reads) {
- my $comm = $reads{$pid}{comm};
- my $total_reads = $reads{$pid}{total_reads};
- my $bytes_requested = $reads{$pid}{bytes_requested};
- my $bytes_read = $reads{$pid}{bytes_read};
+ foreach my $pid (sort { ($reads{$b}{bytes_read} || 0) <=>
+ ($reads{$a}{bytes_read} || 0) } keys %reads) {
+ my $comm = $reads{$pid}{comm} || "";
+ my $total_reads = $reads{$pid}{total_reads} || 0;
+ my $bytes_requested = $reads{$pid}{bytes_requested} || 0;
+ my $bytes_read = $reads{$pid}{bytes_read} || 0;
printf("%6s %-20s %10s %10s %10s\n", $pid, $comm,
$total_reads, $bytes_requested, $bytes_read);
@@ -130,11 +153,11 @@ sub print_totals
printf("%6s %-20s %10s %13s\n", "------", "--------------------",
"----------", "-------------");
- foreach my $pid (sort {$writes{$b}{bytes_written} <=>
- $writes{$a}{bytes_written}} keys %writes) {
- my $comm = $writes{$pid}{comm};
- my $total_writes = $writes{$pid}{total_writes};
- my $bytes_written = $writes{$pid}{bytes_written};
+ foreach my $pid (sort { ($writes{$b}{bytes_written} || 0) <=>
+ ($writes{$a}{bytes_written} || 0)} keys %writes) {
+ my $comm = $writes{$pid}{comm} || "";
+ my $total_writes = $writes{$pid}{total_writes} || 0;
+ my $bytes_written = $writes{$pid}{bytes_written} || 0;
printf("%6s %-20s %10s %13s\n", $pid, $comm,
$total_writes, $bytes_written);
@@ -146,7 +169,6 @@ sub print_totals
%reads = ();
%writes = ();
- alarm $interval;
}
my %unhandled;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 05/10] perf/trace/scripting: wakeup-latency script cleanup
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2010-05-10 22:53 ` [PATCH 04/10] perf/trace/scripting: rwtop " Arnaldo Carvalho de Melo
@ 2010-05-10 22:53 ` Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 06/10] perf/trace/scripting: workqueue-stats " Arnaldo Carvalho de Melo
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:53 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Tom Zanussi, Frédéric Weisbecker,
Ingo Molnar, Arnaldo Carvalho de Melo
From: Tom Zanussi <tzanussi@gmail.com>
Some minor fixes for the wakeup-latency script:
- Fix nuisance 'use of uninitialized value' warnings
- Avoid divide-by-zero error
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1273466820-9330-5-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/scripts/perl/wakeup-latency.pl | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/perf/scripts/perl/wakeup-latency.pl b/tools/perf/scripts/perl/wakeup-latency.pl
index ed58ef2..d9143dc 100644
--- a/tools/perf/scripts/perl/wakeup-latency.pl
+++ b/tools/perf/scripts/perl/wakeup-latency.pl
@@ -22,8 +22,8 @@ my %last_wakeup;
my $max_wakeup_latency;
my $min_wakeup_latency;
-my $total_wakeup_latency;
-my $total_wakeups;
+my $total_wakeup_latency = 0;
+my $total_wakeups = 0;
sub sched::sched_switch
{
@@ -67,8 +67,12 @@ sub trace_end
{
printf("wakeup_latency stats:\n\n");
print "total_wakeups: $total_wakeups\n";
- printf("avg_wakeup_latency (ns): %u\n",
- avg($total_wakeup_latency, $total_wakeups));
+ if ($total_wakeups) {
+ printf("avg_wakeup_latency (ns): %u\n",
+ avg($total_wakeup_latency, $total_wakeups));
+ } else {
+ printf("avg_wakeup_latency (ns): N/A\n");
+ }
printf("min_wakeup_latency (ns): %u\n", $min_wakeup_latency);
printf("max_wakeup_latency (ns): %u\n", $max_wakeup_latency);
--
1.6.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 06/10] perf/trace/scripting: workqueue-stats script cleanup
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2010-05-10 22:53 ` [PATCH 05/10] perf/trace/scripting: wakeup-latency " Arnaldo Carvalho de Melo
@ 2010-05-10 22:53 ` Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 07/10] perf/trace/scripting: don't show script start/stop messages by default Arnaldo Carvalho de Melo
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:53 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Tom Zanussi, Frédéric Weisbecker,
Ingo Molnar, Arnaldo Carvalho de Melo
From: Tom Zanussi <tzanussi@gmail.com>
Some minor fixes for the workqueue-stats script:
- Fix nuisance 'use of uninitialized value' warnings
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1273466820-9330-6-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/scripts/perl/workqueue-stats.pl | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/perf/scripts/perl/workqueue-stats.pl b/tools/perf/scripts/perl/workqueue-stats.pl
index 511302c..b84b126 100644
--- a/tools/perf/scripts/perl/workqueue-stats.pl
+++ b/tools/perf/scripts/perl/workqueue-stats.pl
@@ -71,9 +71,9 @@ sub trace_end
printf("%3s %6s %6s\t%-20s\n", "---", "---", "----", "----");
foreach my $pidhash (@cpus) {
while ((my $pid, my $wqhash) = each %$pidhash) {
- my $ins = $$wqhash{'inserted'};
- my $exe = $$wqhash{'executed'};
- my $comm = $$wqhash{'comm'};
+ my $ins = $$wqhash{'inserted'} || 0;
+ my $exe = $$wqhash{'executed'} || 0;
+ my $comm = $$wqhash{'comm'} || "";
if ($ins || $exe) {
printf("%3u %6u %6u\t%-20s\n", $cpu, $ins, $exe, $comm);
}
@@ -87,9 +87,9 @@ sub trace_end
printf("%3s %6s %6s\t%-20s\n", "---", "-------", "---------", "----");
foreach my $pidhash (@cpus) {
while ((my $pid, my $wqhash) = each %$pidhash) {
- my $created = $$wqhash{'created'};
- my $destroyed = $$wqhash{'destroyed'};
- my $comm = $$wqhash{'comm'};
+ my $created = $$wqhash{'created'} || 0;
+ my $destroyed = $$wqhash{'destroyed'} || 0;
+ my $comm = $$wqhash{'comm'} || "";
if ($created || $destroyed) {
printf("%3u %6u %6u\t%-20s\n", $cpu, $created, $destroyed,
$comm);
--
1.6.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 07/10] perf/trace/scripting: don't show script start/stop messages by default
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
` (5 preceding siblings ...)
2010-05-10 22:53 ` [PATCH 06/10] perf/trace/scripting: workqueue-stats " Arnaldo Carvalho de Melo
@ 2010-05-10 22:53 ` Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 08/10] perf/trace/scripting: failed-syscalls-by-pid script cleanup Arnaldo Carvalho de Melo
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:53 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Tom Zanussi, Frédéric Weisbecker,
Ingo Molnar, Arnaldo Carvalho de Melo
From: Tom Zanussi <tzanussi@gmail.com>
Only print the script start/stop messages in verbose mode - users
normally don't care and it just clutters up the output.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1273466820-9330-7-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 3 +++
.../perf/util/scripting-engines/trace-event-perl.c | 3 ---
.../util/scripting-engines/trace-event-python.c | 4 ----
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 6e268ca..95fcb05 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -53,6 +53,8 @@ static void setup_scripting(void)
static int cleanup_scripting(void)
{
+ pr_debug("\nperf trace script stopped\n");
+
return scripting_ops->stop_script();
}
@@ -703,6 +705,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used)
err = scripting_ops->start_script(script_name, argc, argv);
if (err)
goto out;
+ pr_debug("perf trace started with script %s\n\n", script_name);
}
err = __cmd_trace(session);
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 5376378..b059dc5 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -371,7 +371,6 @@ static int perl_start_script(const char *script, int argc, const char **argv)
run_start_sub();
free(command_line);
- fprintf(stderr, "perf trace started with Perl script %s\n\n", script);
return 0;
error:
perl_free(my_perl);
@@ -394,8 +393,6 @@ static int perl_stop_script(void)
perl_destruct(my_perl);
perl_free(my_perl);
- fprintf(stderr, "\nperf trace Perl script stopped\n");
-
return 0;
}
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 6a72f14..81f39ca 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -374,8 +374,6 @@ static int python_start_script(const char *script, int argc, const char **argv)
}
free(command_line);
- fprintf(stderr, "perf trace started with Python script %s\n\n",
- script);
return err;
error:
@@ -407,8 +405,6 @@ out:
Py_XDECREF(main_module);
Py_Finalize();
- fprintf(stderr, "\nperf trace Python script stopped\n");
-
return err;
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 08/10] perf/trace/scripting: failed-syscalls-by-pid script cleanup
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
` (6 preceding siblings ...)
2010-05-10 22:53 ` [PATCH 07/10] perf/trace/scripting: don't show script start/stop messages by default Arnaldo Carvalho de Melo
@ 2010-05-10 22:53 ` Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 09/10] perf/trace/scripting: syscall-counts-by-pid " Arnaldo Carvalho de Melo
2010-05-11 6:13 ` [GIT PULL 00/10] perf fixes and improvements Ingo Molnar
9 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:53 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Tom Zanussi, Frédéric Weisbecker,
Ingo Molnar, Arnaldo Carvalho de Melo
From: Tom Zanussi <tzanussi@gmail.com>
A small fixe for the failed syscalls by pid script:
- silence the match output in the shell script
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1273466820-9330-8-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../python/bin/failed-syscalls-by-pid-report | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report
index 8c128ef..3029354 100644
--- a/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report
+++ b/tools/perf/scripts/python/bin/failed-syscalls-by-pid-report
@@ -2,7 +2,7 @@
# description: system-wide failed syscalls, by pid
# args: [comm]
if [ $# -gt 0 ] ; then
- if ! expr match "$1" "-" ; then
+ if ! expr match "$1" "-" > /dev/null ; then
comm=$1
shift
fi
--
1.6.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 09/10] perf/trace/scripting: syscall-counts-by-pid script cleanup
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
` (7 preceding siblings ...)
2010-05-10 22:53 ` [PATCH 08/10] perf/trace/scripting: failed-syscalls-by-pid script cleanup Arnaldo Carvalho de Melo
@ 2010-05-10 22:53 ` Arnaldo Carvalho de Melo
2010-05-11 6:13 ` [GIT PULL 00/10] perf fixes and improvements Ingo Molnar
9 siblings, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-05-10 22:53 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Tom Zanussi, Frédéric Weisbecker,
Ingo Molnar, Arnaldo Carvalho de Melo
From: Tom Zanussi <tzanussi@gmail.com>
A small fix for the syscall counts by pid script:
- silence the match output in the shell script
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <1273466820-9330-9-git-send-email-tzanussi@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../python/bin/syscall-counts-by-pid-report | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/scripts/python/bin/syscall-counts-by-pid-report b/tools/perf/scripts/python/bin/syscall-counts-by-pid-report
index c53362e..9e9d8dd 100644
--- a/tools/perf/scripts/python/bin/syscall-counts-by-pid-report
+++ b/tools/perf/scripts/python/bin/syscall-counts-by-pid-report
@@ -2,7 +2,7 @@
# description: system-wide syscall counts, by pid
# args: [comm]
if [ $# -gt 0 ] ; then
- if ! expr match "$1" "-" ; then
+ if ! expr match "$1" "-" > /dev/null ; then
comm=$1
shift
fi
--
1.6.2.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [GIT PULL 00/10] perf fixes and improvements
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
` (8 preceding siblings ...)
2010-05-10 22:53 ` [PATCH 09/10] perf/trace/scripting: syscall-counts-by-pid " Arnaldo Carvalho de Melo
@ 2010-05-11 6:13 ` Ingo Molnar
9 siblings, 0 replies; 11+ messages in thread
From: Ingo Molnar @ 2010-05-11 6:13 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Arnaldo Carvalho de Melo, Fr??d??ric Weisbecker,
Mike Galbraith, Paul Mackerras, Peter Zijlstra, Tom Zanussi
* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Hi Ingo,
>
> Please pull from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf
>
> Regards,
>
> Arnaldo Carvalho de Melo (1):
> perf hist: Calculate max_sym name len and nr_entries
>
> Tom Zanussi (9):
> perf/trace/scripting: failed-syscalls script cleanup
> perf/trace/scripting: rw-by-pid script cleanup
> perf/trace/scripting: rwtop script cleanup
> perf/trace/scripting: wakeup-latency script cleanup
> perf/trace/scripting: workqueue-stats script cleanup
> perf/trace/scripting: don't show script start/stop messages by default
> perf/trace/scripting: failed-syscalls-by-pid script cleanup
> perf/trace/scripting: syscall-counts-by-pid script cleanup
> perf/trace/scripting: syscall-counts script cleanup
>
> tools/perf/builtin-report.c | 6 +-
> tools/perf/builtin-trace.c | 3 +
> tools/perf/scripts/perl/bin/failed-syscalls-report | 2 +-
> tools/perf/scripts/perl/failed-syscalls.pl | 6 ++-
> tools/perf/scripts/perl/rw-by-pid.pl | 60 ++++++++++++--------
> tools/perf/scripts/perl/rwtop.pl | 48 +++++++++++----
> tools/perf/scripts/perl/wakeup-latency.pl | 12 +++-
> tools/perf/scripts/perl/workqueue-stats.pl | 12 ++--
> .../python/bin/failed-syscalls-by-pid-report | 2 +-
> .../python/bin/syscall-counts-by-pid-report | 2 +-
> .../perf/scripts/python/bin/syscall-counts-report | 2 +-
> tools/perf/util/hist.c | 27 +++++++--
> tools/perf/util/hist.h | 4 +-
> .../perf/util/scripting-engines/trace-event-perl.c | 3 -
> .../util/scripting-engines/trace-event-python.c | 4 -
> tools/perf/util/symbol.c | 5 +-
> tools/perf/util/symbol.h | 1 +
> 17 files changed, 128 insertions(+), 71 deletions(-)
Pulled, thanks Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-05-11 6:13 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-10 22:52 [GIT PULL 00/10] perf fixes and improvements Arnaldo Carvalho de Melo
2010-05-10 22:52 ` [PATCH 01/10] perf hist: Calculate max_sym name len and nr_entries Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 02/10] perf/trace/scripting: failed-syscalls script cleanup Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 03/10] perf/trace/scripting: rw-by-pid " Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 04/10] perf/trace/scripting: rwtop " Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 05/10] perf/trace/scripting: wakeup-latency " Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 06/10] perf/trace/scripting: workqueue-stats " Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 07/10] perf/trace/scripting: don't show script start/stop messages by default Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 08/10] perf/trace/scripting: failed-syscalls-by-pid script cleanup Arnaldo Carvalho de Melo
2010-05-10 22:53 ` [PATCH 09/10] perf/trace/scripting: syscall-counts-by-pid " Arnaldo Carvalho de Melo
2010-05-11 6:13 ` [GIT PULL 00/10] perf fixes and improvements Ingo Molnar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.