From c7f1b547cb12837e58f4add1946047f0f173fe5c Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Wed, 3 Feb 2010 12:27:52 +0000 Subject: [PATCH] Statistical profiling fixes: - PM: get rid of umap warning - sprofalyze.pl: update with recently added servers and drivers - sprofalyze.pl: properly truncate process names for sample matching --- commands/profile/sprofalyze.pl | 36 ++++++++++++++++++++++++++-------- servers/pm/profile.c | 4 ++-- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/commands/profile/sprofalyze.pl b/commands/profile/sprofalyze.pl index 36caff904..87591e10a 100755 --- a/commands/profile/sprofalyze.pl +++ b/commands/profile/sprofalyze.pl @@ -20,32 +20,46 @@ $nm = "/usr/bin/nm -dn"; ); # Location of system executables within src. Add new servers/drivers here. +# This should be replaced with something less maintenance-prone some day. @exes = qw( kernel/kernel servers/ds/ds -servers/vfs/vfs -servers/mfs/mfs +servers/hgfs/hgfs servers/inet/inet +servers/ipc/ipc servers/is/is +servers/iso9660fs/isofs +servers/mfs/mfs +servers/pfs/pfs servers/pm/pm servers/rs/rs +servers/vfs/vfs servers/vm/vm servers/rs/service +drivers/amddev/amddev drivers/at_wini/at_wini +drivers/atl2/atl2 +drivers/audio/es1370/es1370 +drivers/audio/es1371/es1371 drivers/bios_wini/bios_wini +drivers/dec21140A/dec21140A drivers/dp8390/dp8390 drivers/dpeth/dpeth +drivers/e1000/e1000 +drivers/filter/filter drivers/floppy/floppy drivers/fxp/fxp drivers/lance/lance drivers/log/log drivers/memory/memory +drivers/orinoco/orinoco drivers/pci/pci drivers/printer/printer drivers/random/random drivers/rtl8139/rtl8139 +drivers/rtl8169/rtl8169 drivers/sb16/sb16_dsp drivers/sb16/sb16_mixer drivers/ti1225/ti1225 @@ -91,8 +105,16 @@ foreach $file (@files) { if (process_datafile($file)) { exit 1; } } -exit 0; - +exit 0; + + +sub short_name +{ + my $shortname = shift; + $shortname =~ s/^.*\///; + return substr($shortname, 0, 7); +} + sub read_symbols { @@ -104,6 +126,7 @@ sub read_symbols $shortname =~ s/^.*\///; print " " if $i <= $#exes; print $shortname; + $shortname = short_name($exe); $fullname = $src_root . $exe; @@ -198,9 +221,6 @@ sub process_datafile read(FILE, $buf, $SAMPLE_SIZE) == $SAMPLE_SIZE or die ("Short read."); ($exe, $pc) = unpack("Z8i", $buf); - # p_name "mem" refers to executable "memory". - $exe =~ s/^mem/memory/; - # We can access the hash by pc because they are all in there. if (!defined(${$exe."_hash"}{$pc})) { print "ERROR: Undefined in symbol table indexes: "; @@ -214,7 +234,7 @@ sub process_datafile # We only need to continue with executables that had any hits. my @actives = (); foreach my $exe (@exes) { - $exe =~ s/^.*\///; + $exe = short_name($exe); next if (!exists($res{$exe})); push(@actives, $exe); } diff --git a/servers/pm/profile.c b/servers/pm/profile.c index b63d48b50..c7a9b07ec 100644 --- a/servers/pm/profile.c +++ b/servers/pm/profile.c @@ -96,13 +96,13 @@ int info_size; phys_bytes p; /* Check if supplied pointers point into user process. */ - if ((r = sys_umap(who_e, D, (vir_bytes) m_in.PROF_CTL_PTR, + if ((r = sys_umap(who_e, VM_D, (vir_bytes) m_in.PROF_CTL_PTR, 1, &p)) != OK) { printf("PM: PROFILE: umap failed for process %d\n", who_e); return r; } - if ((r =sys_umap(who_e, D, (vir_bytes) m_in.PROF_MEM_PTR, + if ((r =sys_umap(who_e, VM_D, (vir_bytes) m_in.PROF_MEM_PTR, 1, &p)) != OK) { printf("PM: PROFILE: umap failed for process %d\n", who_e); return r; -- 2.44.0