hns - 日記自動生成システム - Version 2.19.9

先月 2008年01月 来月
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Namazu for hns による簡易全文検索
詳しくは 詳細指定/ヘルプを参照して下さい
検索式:

2008年01月15日(火) 旧暦 [n年日記] [更新:"2008/01/15 12:23:28"]

#1 [NetBSD] kernel profiling for amd64

In English
In Japanese
名前は何でもいいけれど、例えば sys/arch/amd64/conf/GENERIC.PROF という名前で次の内容を用意して
include "arch/amd64/conf/GENERIC"
makeoptions     PROF="-pg"
options         GPROF
time sudo ./build.sh -m amd64 -j 4 -T /export/src/tooldir.NetBSD-4.99.49-x86_64 kernel=GENERIC.PROF
で、以前に見た気がするが:
/var/tmp//cci6nNif.s: Assembler messages:
/var/tmp//cci6nNif.s:189: Error: suffix or operands invalid for `pushf'
/var/tmp//cci6nNif.s:189: Error: suffix or operands invalid for `pop'
/var/tmp//cci6nNif.s:237: Error: suffix or operands invalid for `push'
/var/tmp//cci6nNif.s:237: Error: suffix or operands invalid for `popf'
/var/tmp//cci6nNif.s:283: Error: suffix or operands invalid for `push'
/var/tmp//cci6nNif.s:283: Error: suffix or operands invalid for `popf'
もう一度 nbmake
cd /export/src/sys/arch/amd64/compile/obj/GENERIC.PROF
sudo /export/src/tooldir.NetBSD-4.99.49-x86_64/bin/nbmake-amd64
もう一度
cd /export/src/sys/arch/amd64/compile/obj/GENERIC.PROF/lib/kern;
pts/0:makoto@berona 9:38:22/080115(...lib/kern)> sudo /export/src/tooldir.NetBSD-4.99.49-x86_64/bin/nbmake -f /export/src/sys/lib/libkern/Makefile KERNDIR=/export/src/sys/lib/libkern CC=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-gcc CFLAGS=\ -mcmodel=kernel\ -mno-red-zone\ -ffreestanding\ -fno-zero-initialized-in-bss\ \ \ -O2\ -fno-omit-frame-pointer\ -Werror\ -Wall\ -Wno-main\ -Wno-format-zero-length\ -Wpointer-arith\ -Wmissing-prototypes\ -Wstrict-prototypes\ -Wswitch\ -Wshadow\ -Wcast-qual\ -Wwrite-strings\ -Wno-sign-compare\ -Wno-pointer-sign\ -Wno-attributes\ \ -fno-strict-aliasing\ \ AS=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-as AFLAGS=\ -x\ assembler-with-cpp\ -traditional-cpp\ \ -D_LOCORE\ -Wa,-fatal-warnings\ LORDER=NM=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-nm\ MKTEMP=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/nbmktemp\ /export/src/tooldir.NetBSD-4.99.49-x86_64/bin/nblorder TSORT=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/nbtsort\ -q LD=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-ld STRIP=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-strip AR=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-ar NM=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-nm RANLIB=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-ranlib SIZE=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-size MACHINE=amd64 MACHINE_ARCH=x86_64 KERNCPPFLAGS=-Damd64\ -Dx86_64\ -I../../.\ -I/export/src/sys/contrib/dev/ath/netbsd\ -I/export/src/sys/../common/include\ -I/export/src/sys/arch\ -I/export/src/sys\ -nostdinc\ -DLKM\ -DGPROF\ -DMAXUSERS=32\ -D_KERNEL\ -D_KERNEL_OPT\ -I/export/src/sys/lib/libkern/../../../common/lib/libc/quad\ -I/export/src/sys/lib/libkern/../../../common/lib/libc/string\ -I/export/src/sys/lib/libkern/../../../common/lib/libc/arch/x86_64/string\ -I/export/src/sys/dist/ipf KERNMISCCPPFLAGS= LINTFLAGS=-bcehnxzFS libkern.po
更に cc だけ起動
/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-gcc -mcmodel=kernel -mno-red-zone -ffreestanding -fno-zero-initialized-in-bss -O2 -fno-omit-frame-pointer -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-sign-compare -Wno-pointer-sign -Wno-attributes -fno-strict-aliasing AS=/export/src/tooldir.NetBSD-4.99.49-x86_64/bin/x86_64--netbsd-as -I/export/src/sys/lib/libkern/arch/x86_64 -Damd64 -Dx86_64 -I../../. -I/export/src/sys/contrib/dev/ath/netbsd -I/export/src/sys/../common/include -I/export/src/sys/arch -I/export/src/sys -nostdinc -DLKM -DGPROF -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT -I/export/src/sys/lib/libkern/../../../common/lib/libc/quad p-I/export/src/sys/lib/libkern/../../../common/lib/libc/string -I/export/src/sys/lib/libkern/../../../common/lib/libc/arch/x86_64/string -I/export/src/sys/dist/ipf -I/export/src/sys/lib/libkern/../../../common/lib/libc/quad -I/export/src/sys/lib/libkern/../../../common/lib/libc/string -I/export/src/sys/lib/libkern/../../../common/lib/libc/arch/x86_64/string -I/export/src/sys/lib/libkern/../../../common/include -c -DGPROF -DPROF -pg /export/src/sys/lib/libkern/../../../common/lib/libc/gmon/mcount.c -o mcount.po
Following location are flagged:
    188 /APP    
    189         pushfl; popl %rax
    190 /NO_APP  

    236 /APP
    237         pushl %rax; popfl
    238 /NO_APP

    282 /APP
    283         pushl %rax; popfl
    284 /NO_APP
Those lines are derived from: src/sys/arch/amd64/include/profile.h
    135 static inline u_long
    136 mcount_read_psl(void)
    137 {
    138         u_long  ef;
    139
    140         __asm volatile("pushfl; popl %0" : "=r" (ef));
    141         return (ef);
    142 }

    144 static inline void
    145 mcount_write_psl(u_long ef)
    146 {
    147         __asm volatile("pushl %0; popfl" : : "r" (ef)); 
    148 }
oshimaya さんの 2006/04/19 の日記 にも同じ字がある。あれ、自分で メール を書いている ? でも ef が何故 ax に変わるのかな ? CPUID instruction という種類のもの ? もしかして patch
Profiling kernel, textsize=6140264 [ffffffff80100000..ffffffff806db168]
   118  11:33   sudo kgmon -b
   119  11:33   sudo ./build.sh -m amd64 -j 4 -T /export/src/tooldir.NetBSD-4.99.49-x86_64 kernel=GENERIC.PROF
   120  11:42   sudo kgmon -h
   121  11:42   sudo kgmon -p
   126  11:44   gprof /netbsd gmon.out > gmon.txt
   127  11:46   less gmon.txt
Flat profile:
Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 80.37    390.90   390.90                             x86_stihlt
  1.68    399.05     8.15                             mutex_enter
  1.46    406.16     7.11                             Xspllower
  1.34    412.69     6.53  5817777     0.00     0.00  sse2_zero_page
  0.87    416.93     4.24 11307330     0.00     0.00  pmap_enter
  0.71    420.37     3.44 30737349     0.00     0.00  pvtree_SPLAY
  0.61    423.36     2.99  7294905     0.00     0.01  uvm_fault_internal
  0.60    426.27     2.91                             mutex_spin_enter
  0.59    429.13     2.86  2555182     0.00     0.00  copyout
  0.50    431.58     2.45   420077     0.01     0.01  _kernel_lock
  0.43    433.66     2.08 51671343     0.00     0.00  lockmgr
  0.41    435.64     1.98                             calltrap
  0.38    437.50     1.86 25561689     0.00     0.00  pool_cache_get_paddr
  0.37    439.32     1.82                             x86_pause
  0.36    441.07     1.75  6560728     0.00     0.00  uvm_pagealloc_pgfl
  0.33    442.69     1.62 10687457     0.00     0.00  cache_lookup
  0.31    444.20     1.51  5833980     0.00     0.00  pmap_zero_page
sys/arch/amd64/amd64/cpufunc.S:
   310  NENTRY(x86_stihlt)
   311          pushq   %rbp
   312          movq    %rsp, %rbp
   313          sti
   314          hlt
   315          leave
   316          ret
But the calls (call count) is not shown, so, is this just a wait ? No, the blank on 'calls' means not-profiled.
stiSet Interrupt flag
hltHalt
leaveHigh Level Procedure Exit
x86 Assembly Language Reference Manual



最近の日記
2024年05月08日
comparison on ./buildsh tools
2024年05月06日
py-setuptools (python 3.11.9)
make release took 1 hours and 10 min
qemu invocation for 10.99.10
2024年05月05日
Windows 10 version
serial connection
bc bench
2024年05月04日
Trial on 10.99.10
another version (later trial) to succeed
2024年04月29日
dkim
以上、1 日分です。
タイトル一覧
カテゴリ分類
Powered by hns-2.19.9, HyperNikkiSystem Project

Count.cgi (since 2000/02/05)