added pulpstone scripts to oprofile package added 5 different opt. types: smart, bizarre, speed, size, lazy created an extra config option for debug symbols git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@2476 c5f82cb5-29bc-0310-9cd0-bff59a50e3bcrocklinux
@ -0,0 +1,35 @@ |
|||||
|
#!/usr/bin/gawk -f |
||||
|
|
||||
|
BEGIN { |
||||
|
speedargidx=0; |
||||
|
sizeargidx=0; |
||||
|
isholy=0; |
||||
|
} |
||||
|
|
||||
|
ARGIND == 1 { |
||||
|
holylist[$4] = 1; |
||||
|
} |
||||
|
|
||||
|
ARGIND == 2 { |
||||
|
if ( gsub("^-SPEED", "") == 1 ) |
||||
|
speedarg[speedargidx++] = $0; |
||||
|
else |
||||
|
if ( gsub("^-SIZE", "") == 1 ) |
||||
|
sizearg[sizeargidx++] = $0; |
||||
|
else { |
||||
|
speedarg[speedargidx++] = $0; |
||||
|
sizearg[sizeargidx++] = $0; |
||||
|
} |
||||
|
if ( holylist[$0] == 1 ) |
||||
|
isholy=1; |
||||
|
} |
||||
|
|
||||
|
END { |
||||
|
if ( isholy ) |
||||
|
for (i=0; i<speedargidx; i++) |
||||
|
print speedarg[i]; |
||||
|
else |
||||
|
for (i=0; i<sizeargidx; i++) |
||||
|
print sizearg[i]; |
||||
|
} |
||||
|
|
@ -0,0 +1,10 @@ |
|||||
|
|
||||
|
install_pulpstone() { |
||||
|
cp -v $confdir/pulpstoner.pl $root/usr/bin/pulpstoner |
||||
|
cp -v $confdir/pulpstonec.pl $root/usr/bin/pulpstonec |
||||
|
cp -v $confdir/pulpstoned.sh $root/usr/bin/pulpstoned |
||||
|
chmod +x $root/usr/bin/pulpstone[rcd] |
||||
|
} |
||||
|
|
||||
|
hook_add postmake 5 "install_pulpstone" |
||||
|
|
@ -0,0 +1,19 @@ |
|||||
|
#!/usr/bin/perl -w |
||||
|
|
||||
|
use strict; |
||||
|
use English; |
||||
|
|
||||
|
my $min_points = 50; |
||||
|
|
||||
|
my %tuples; |
||||
|
|
||||
|
while (<>) { |
||||
|
next unless /^\*\*\s+([0-9\.]+):\s+(\S+)\s+(\S+)/; |
||||
|
$tuples{sprintf "%-14s\t%-22s", $2, $3} += $1; |
||||
|
} |
||||
|
|
||||
|
foreach (keys %tuples) { |
||||
|
next if $tuples{$_} < 50; |
||||
|
printf "** %9.0f:\t%s\n", $tuples{$_}, $_; |
||||
|
} |
||||
|
|
@ -0,0 +1,72 @@ |
|||||
|
#!/bin/bash |
||||
|
# |
||||
|
# --- ROCK-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# Please add additional copyright information _after_ the line containing |
||||
|
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by |
||||
|
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! |
||||
|
# |
||||
|
# ROCK Linux: rock-src/package/base/oprofile/pulpstoned.sh |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf |
||||
|
# |
||||
|
# This program is free software; you can redistribute it and/or modify |
||||
|
# it under the terms of the GNU General Public License as published by |
||||
|
# the Free Software Foundation; either version 2 of the License, or |
||||
|
# (at your option) any later version. A copy of the GNU General Public |
||||
|
# License can be found at Documentation/COPYING. |
||||
|
# |
||||
|
# Many people helped and are helping developing ROCK Linux. Please |
||||
|
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM |
||||
|
# file for details. |
||||
|
# |
||||
|
# --- ROCK-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
period=600 |
||||
|
report_script=pulpstoner |
||||
|
report_dir=/var/log/pulpstone |
||||
|
pidfile=/var/run/pulpstoned.pid |
||||
|
|
||||
|
cd /; mkdir -p $report_dir |
||||
|
echo "pulpstone daemon: writing logs to $report_dir ..." |
||||
|
|
||||
|
( |
||||
|
|
||||
|
psd_end() { |
||||
|
opcontrol -h |
||||
|
echo "Shutting down on signal." |
||||
|
rm -f $pidfile |
||||
|
date +"=== <%Y/%m/%d %H:%M:%S> ===" |
||||
|
exit 0 |
||||
|
} |
||||
|
|
||||
|
trap psd_end INT TERM |
||||
|
echo $$ > $pidfile |
||||
|
|
||||
|
while true; do |
||||
|
now=`date +"%Y%m%d%H"` |
||||
|
exec >> $report_dir/$now.log 2>&1 |
||||
|
for x in $report_dir/*.log; do |
||||
|
[ "$x" = "$report_dir/$now.log" ] && continue |
||||
|
echo; echo "Uploading $report_dir/$now.log ..." |
||||
|
res="$( curl -s -F data=@$x http://www.rocklinux.net/pulpstone/upload.cgi )" |
||||
|
if [ "$res" = "ok" ]; then |
||||
|
echo "File upload succesfull." |
||||
|
mv $x ${x%.log}.old |
||||
|
else |
||||
|
echo "Error while uploading." |
||||
|
fi |
||||
|
done |
||||
|
date +"%n=== <%Y/%m/%d %H:%M:%S> ===" |
||||
|
opcontrol -s |
||||
|
opcontrol --reset |
||||
|
opcontrol --event="CPU_CLK_UNHALTED:100000:0:1:1" |
||||
|
for ((c=0; c<period; c++)); do sleep 1; done |
||||
|
opcontrol -h |
||||
|
date +"=== <%Y/%m/%d %H:%M:%S> ===" |
||||
|
nice -n 99 $report_script | unexpand -a |
||||
|
date +"=== <%Y/%m/%d %H:%M:%S> ===" |
||||
|
done |
||||
|
|
||||
|
) & |
||||
|
|
@ -0,0 +1,86 @@ |
|||||
|
#!/usr/bin/perl -w |
||||
|
# |
||||
|
# --- ROCK-COPYRIGHT-NOTE-BEGIN --- |
||||
|
# |
||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||
|
# Please add additional copyright information _after_ the line containing |
||||
|
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by |
||||
|
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! |
||||
|
# |
||||
|
# ROCK Linux: rock-src/package/base/oprofile/pulpstoner.pl |
||||
|
# ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf |
||||
|
# |
||||
|
# This program is free software; you can redistribute it and/or modify |
||||
|
# it under the terms of the GNU General Public License as published by |
||||
|
# the Free Software Foundation; either version 2 of the License, or |
||||
|
# (at your option) any later version. A copy of the GNU General Public |
||||
|
# License can be found at Documentation/COPYING. |
||||
|
# |
||||
|
# Many people helped and are helping developing ROCK Linux. Please |
||||
|
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM |
||||
|
# file for details. |
||||
|
# |
||||
|
# --- ROCK-COPYRIGHT-NOTE-END --- |
||||
|
|
||||
|
use English; |
||||
|
use strict; |
||||
|
|
||||
|
my $min_samples = 1000; |
||||
|
my $min_percent = 2; |
||||
|
my $min_points = 10; |
||||
|
|
||||
|
my %roots; |
||||
|
|
||||
|
my %percents; |
||||
|
my %files; |
||||
|
my %binaries; |
||||
|
my $bin; |
||||
|
|
||||
|
sub read_pkgdb($) { |
||||
|
my $root=$_[0]; |
||||
|
print "Reading package DB from /$root ...\n"; |
||||
|
open(F, "cat /${root}var/adm/flists/*|") || die $!; |
||||
|
while (<F>) { |
||||
|
chomp; @_ = split /:\s+/; |
||||
|
$files{${root}.$_[1]} = $_[0]; |
||||
|
} |
||||
|
close F; |
||||
|
} |
||||
|
read_pkgdb(""); |
||||
|
|
||||
|
my $pc = 0; |
||||
|
open(F, "opreport -f -n | sort -r -g -k 2|") || die $!; |
||||
|
for (<F>) { |
||||
|
@_ = split /\s+/; $pc+=$_[2]; |
||||
|
last if $_[1] < $min_samples; |
||||
|
last if $pc > 100-$min_percent; |
||||
|
next unless -f $_[3]; |
||||
|
$_[3] =~ s,^/,,; |
||||
|
$binaries{$_[3]} = $_[2]; |
||||
|
} |
||||
|
close F; |
||||
|
|
||||
|
foreach $bin (keys %binaries) { |
||||
|
if ( $bin =~ m,(.*/root/), and not defined $roots{$1} ) { |
||||
|
$roots{$1} = 1; |
||||
|
read_pkgdb($1); |
||||
|
} |
||||
|
if ( not defined $files{$bin} ) { |
||||
|
print "Not found in package db: $bin\n"; |
||||
|
next; |
||||
|
} |
||||
|
open(F, "opreport -g --symbols -n /$bin|") || die $!; |
||||
|
while (<F>) { |
||||
|
next if /\(no location information\)/; |
||||
|
my ($count, $percent, $src, $sym) = split /\s+/; $src =~ s/:.*//; |
||||
|
$percents{sprintf "%-14s\t%-22s\t%s", |
||||
|
$files{$bin}, $src, $bin} += $percent * $binaries{$bin}; |
||||
|
} |
||||
|
close F; |
||||
|
} |
||||
|
|
||||
|
foreach (keys %percents) { |
||||
|
next if $percents{$_} < $min_points; |
||||
|
printf "** %9.2f:\t%s\n", $percents{$_}, $_; |
||||
|
} |
||||
|
|
@ -0,0 +1,258 @@ |
|||||
|
** 1848: findutils frcode.c |
||||
|
** 3297: bash bison.simple |
||||
|
** 54: bash echo.def |
||||
|
** 144: make hash.c |
||||
|
** 112: glibc23 glob.c |
||||
|
** 7220: gzip deflate.c |
||||
|
** 3218: binutils hashtab.c |
||||
|
** 2718: bash make_cmd.c |
||||
|
** 2501: glibc23 strcpy.c |
||||
|
** 22239: glibc23 malloc.c |
||||
|
** 7703: bash shell.c |
||||
|
** 501: gcc3 cselib.c |
||||
|
** 21452: coreutils sort.c |
||||
|
** 3579: glibc23 loop.c |
||||
|
** 70: python ceval.c |
||||
|
** 410: bash general.c |
||||
|
** 55: perl5 doop.c |
||||
|
** 1807: bash print_cmd.c |
||||
|
** 620: perl5 pp.c |
||||
|
** 90: binutils elf-strtab.c |
||||
|
** 1124: gcc3 alias.c |
||||
|
** 534: bash input.c |
||||
|
** 16144: binutils elflink.h |
||||
|
** 92: gcc3 haifa-sched.c |
||||
|
** 14418: bzip2 decompress.c |
||||
|
** 457: subversion entries.c |
||||
|
** 102: libxml2 valid.c |
||||
|
** 97: binutils libbfd.c |
||||
|
** 617: gawk io.c |
||||
|
** 408: make variable.c |
||||
|
** 534: bash error.c |
||||
|
** 676: binutils write.c |
||||
|
** 730: gcc3 cppmacro.c |
||||
|
** 64: gcc3 mangle.c |
||||
|
** 1431: make rule.c |
||||
|
** 942: m4 input.c |
||||
|
** 1136: bash xmalloc.c |
||||
|
** 168: glibc23 dl-runtime.c |
||||
|
** 56: glibc23 strops.c |
||||
|
** 307: subversion io.c |
||||
|
** 113: glibc23 funlockfile.c |
||||
|
** 65: make function.c |
||||
|
** 106: findutils savedir.c |
||||
|
** 5087: glibc23 memcpy.c |
||||
|
** 56: grep dfa.c |
||||
|
** 1187: gcc3 bitmap.c |
||||
|
** 25378: bzip2 bzlib.c |
||||
|
** 80: bash fmtulong.c |
||||
|
** 2136: glibc23 weight.h |
||||
|
** 11789: binutils merge.c |
||||
|
** 136: gcc3 stor-layout.c |
||||
|
** 1376: make implicit.c |
||||
|
** 169: make expand.c |
||||
|
** 450: subversion svn_string.c |
||||
|
** 57: binutils dwarf2dbg.c |
||||
|
** 11280: glibc23 vfprintf.c |
||||
|
** 221: glibc23 memmove.c |
||||
|
** 614: perl5 bsd_glob.c |
||||
|
** 3829: bash copy_cmd.c |
||||
|
** 1188: gcc3 c-p10602.c |
||||
|
** 2897: gcc3 rtlanal.c |
||||
|
** 156: bash redir.c |
||||
|
** 971: findutils pred.c |
||||
|
** 1527: make read.c |
||||
|
** 3013: gawk node.c |
||||
|
** 62: glibc23 gconv_conf.c |
||||
|
** 1922: glibc23 printf-parse.h |
||||
|
** 109: glibc23 strrchr |
||||
|
** 598: gcc3 dwarf2out.c |
||||
|
** 148: libtiff deflate.c |
||||
|
** 2583: perl5 hv.c |
||||
|
** 72: gcc3 decl2.c |
||||
|
** 137: perl5 pp_ctl.c |
||||
|
** 314: gcc3 insn-recog.c |
||||
|
** 347: perl5 mg.c |
||||
|
** 206: m4 macro.c |
||||
|
** 874: binutils ldlang.c |
||||
|
** 73: gcc3 basic_string.tcc |
||||
|
** 1111: gcc3 fold-const.c |
||||
|
** 103: glibc23 memmem.c |
||||
|
** 640: gcc3 combine.c |
||||
|
** 95: gcc3 cfgcleanup.c |
||||
|
** 511: libxml2 parser.c |
||||
|
** 109: gcc3 insn-extract.c |
||||
|
** 269: gcc3 varasm.c |
||||
|
** 418: coreutils cksum.c |
||||
|
** 1336: gcc3 reload1.c |
||||
|
** 413: gcc3 tree-inline.c |
||||
|
** 3369: binutils tc-i386.c |
||||
|
** 38349: glibc23 strcmp.c |
||||
|
** 1047: binutils ehopt.c |
||||
|
** 187: gcc3 sched-deps.c |
||||
|
** 7416: bash execute_cmd.c |
||||
|
** 73: libxml2 tree.c |
||||
|
** 329: gcc3 final.c |
||||
|
** 13287: gzip match.S |
||||
|
** 3473: gcc3 ggc-page.c |
||||
|
** 986: gcc3 reload.c |
||||
|
** 980: perl5 toke.c |
||||
|
** 58: gcc3 genrtl.c |
||||
|
** 4157: gawk regex_internal.c |
||||
|
** 2063: glibc23 dl-lookup.c |
||||
|
** 162: coreutils linebuffer.c |
||||
|
** 243: perl5 av.c |
||||
|
** 235: gcc3 local-alloc.c |
||||
|
** 95: gcc3 global.c |
||||
|
** 304: bash flags.c |
||||
|
** 89: gcc3 class.c |
||||
|
** 1312: gzip bits.c |
||||
|
** 1031: perl5 op.c |
||||
|
** 310: make file.c |
||||
|
** 5201: subversion path.c |
||||
|
** 41635: sed regexec.c |
||||
|
** 109: coreutils uniq.c |
||||
|
** 241: gcc3 cfgbuild.c |
||||
|
** 152: binutils reloc.c |
||||
|
** 412: gawk builtin.c |
||||
|
** 1348: binutils elf32-i386.c |
||||
|
** 160: bash xstrchr.c |
||||
|
** 611: perl5 util.c |
||||
|
** 76: xfree86 infcodes.c |
||||
|
** 1091: gcc3 c-decl.c |
||||
|
** 136: glibc23 __memchr |
||||
|
** 14252: bash parse.y |
||||
|
** 277: gcc3 splay-tree.c |
||||
|
** 171: subversion skel.c |
||||
|
** 128: libxml2 parserInternals.c |
||||
|
** 149: aspell phonet.cpp |
||||
|
** 106: binutils elf.c |
||||
|
** 1574: bash hashlib.c |
||||
|
** 215: bash smatch.c |
||||
|
** 2025: gcc3 recog.c |
||||
|
** 26664: glibc23 memset.c |
||||
|
** 675: glibc23 dl-load.c |
||||
|
** 493: glibc23 spinlock.c |
||||
|
** 273: glibc23 specific.c |
||||
|
** 100: gcc3 loop.c |
||||
|
** 1101: glibc23 genops.c |
||||
|
** 1355: glibc23 _itoa.h |
||||
|
** 2685: oprofile opd_proc.c |
||||
|
** 2239: binutils symbols.c |
||||
|
** 247: bash eval.c |
||||
|
** 195: gcc3 simplify-rtx.c |
||||
|
** 110: glibc23 spinlock.h |
||||
|
** 3341: perl5 regexec.c |
||||
|
** 222: findutils find.c |
||||
|
** 164: perl5 gv.c |
||||
|
** 11659: binutils hash.c |
||||
|
** 94: subversion time.c |
||||
|
** 121: m4 builtin.c |
||||
|
** 527: gcc3 jump.c |
||||
|
** 128: gcc3 c-typeck.c |
||||
|
** 2613: gzip trees.c |
||||
|
** 104: gcc3 basic_string.h |
||||
|
** 1212: subversion lock.c |
||||
|
** 231: gcc3 spew.c |
||||
|
** 59: gcc3 call.c |
||||
|
** 112: glibc23 flockfile.c |
||||
|
** 73: libxml2 hash.c |
||||
|
** 2910: bash expr.c |
||||
|
** 121: bash common.c |
||||
|
** 825: gcc3 ggc-common.c |
||||
|
** 79: perl5 doio.c |
||||
|
** 84: gcc3 c-lex.c |
||||
|
** 446: findutils locate.c |
||||
|
** 877: sed execute.c |
||||
|
** 161: gcc3 optabs.c |
||||
|
** 129: coreutils cut.c |
||||
|
** 51: gcc3 cfg.c |
||||
|
** 6096: glibc23 skeleton.c |
||||
|
** 55: subversion diff.c |
||||
|
** 127: perl5 pad.c |
||||
|
** 4716: glibc23 do-rel.h |
||||
|
** 50: perl5 pp_sys.c |
||||
|
** 15161: bash subst.c |
||||
|
** 2127: binutils frags.c |
||||
|
** 154: bash display.c |
||||
|
** 79: gcc3 c-parse.y |
||||
|
** 347: subversion xml.c |
||||
|
** 318: glib glist.c |
||||
|
** 7273: glibc23 strncpy.c |
||||
|
** 117: gettext po-lex.c |
||||
|
** 148: gcc3 c-common.c |
||||
|
** 41153: sed regex_internal.c |
||||
|
** 7356: binutils expr.c |
||||
|
** 299: perl5 numeric.c |
||||
|
** 428: perl5 run.c |
||||
|
** 10723: binutils app.c |
||||
|
** 381: gcc3 pt.c |
||||
|
** 128: gcc3 insn-attrtab.c |
||||
|
** 3426: perl5 pp_hot.c |
||||
|
** 3914: gcc3 regclass.c |
||||
|
** 132: make dir.c |
||||
|
** 519: sed regcomp.c |
||||
|
** 10607: gawk regexec.c |
||||
|
** 206: coreutils md5.c |
||||
|
** 63: gcc3 cfgrtl.c |
||||
|
** 742: gcc3 function.c |
||||
|
** 1372: glibc23 strncmp.c |
||||
|
** 389: make misc.c |
||||
|
** 345: gcc3 p2092.c |
||||
|
** 109: gawk regcomp.c |
||||
|
** 7758: glibc23 mb_cur_max.c |
||||
|
** 351: gcc3 gcse.c |
||||
|
** 2001: gcc3 flow.c |
||||
|
** 1332: gcc3 tree.c |
||||
|
** 62: gcc3 regmove.c |
||||
|
** 443: perl5 perlio.c |
||||
|
** 13742: bash variables.c |
||||
|
** 11091: glibc23 do-lookup.h |
||||
|
** 5514: gawk array.c |
||||
|
** 1248: gcc3 hashtab.c |
||||
|
** 127: gawk re.c |
||||
|
** 114: librep lispcmds.c |
||||
|
** 634: perl5 perly.c |
||||
|
** 208: gcc3 cppfiles.c |
||||
|
** 415: gcc3 search.c |
||||
|
** 1346: gcc3 emit-rtl.c |
||||
|
** 155: glibc23 descr.h |
||||
|
** 241: gcc3 expr.c |
||||
|
** 4944: perl5 sv.c |
||||
|
** 1574: gcc3 hashtable.c |
||||
|
** 91: perl5 regcomp.c |
||||
|
** 614: gzip inflate.c |
||||
|
** 8404: binutils read.c |
||||
|
** 1317: gzip util.c |
||||
|
** 3625: gcc3 cse.c |
||||
|
** 9456: glibc23 wordcopy.c |
||||
|
** 2753: binutils elflink.c |
||||
|
** 559: perl5 scope.c |
||||
|
** 569: subversion utf.c |
||||
|
** 2213: glibc23 dl-hash.h |
||||
|
** 305: gcc3 rtl.c |
||||
|
** 7965: gawk eval.c |
||||
|
** 5926: bash jobs.c |
||||
|
** 181: aspell vector_hash-t.hpp |
||||
|
** 3805: glibc23 ctype.h |
||||
|
** 152: subversion adm_files.c |
||||
|
** 136: glibc23 rtld.c |
||||
|
** 380: gcc3 typeck.c |
||||
|
** 68501: bzip2 blocksort.c |
||||
|
** 1110: gcc3 i386.c |
||||
|
** 5424: gcc3 cpplex.c |
||||
|
** 360: bash pathexp.c |
||||
|
** 342: grep kwset.c |
||||
|
** 273: findutils basename.c |
||||
|
** 990: oprofile db_insert.c |
||||
|
** 177: gcc3 toplev.c |
||||
|
** 11539: bash sm_loop.c |
||||
|
** 1051: gawk field.c |
||||
|
** 314: gcc3 cpplib.c |
||||
|
** 558: bash dispose_cmd.c |
||||
|
** 893: gcc3 decl.c |
||||
|
** 103: glibc23 vfscanf.c |
||||
|
** 19475: bzip2 compress.c |
||||
|
** 5898: glibc23 fileops.c |
||||
|
** 844: libxml2 xpath.c |
||||
|
** 298: bash unwind_prot.c |