HP-UX process trace (tusc 사용한 process system call 분석 하는 방법)
IT,PC,모바일,스마트폰 정보와 팁 그리고 제품리뷰와 생활정보
HP-UX process trace (tusc 사용한 process system call 분석 하는 방법)
2011. 3. 7. 17:51
HP-UX 에서 process 에 대한 system call 을 분석 하기 위해서 tusc 라는 tool 을 사용 합니다..
간단하게 사용법을 알려 드립니다.. 일단 옵션 부터 보면
Usage: tusc [-<options>] <command [args ...]> -OR- <pid [pid ...]>
-a: show exec arguments
-A: append to output file
-b bsize: dump 'bsize' max bytes (-r/-w)
-c: count syscalls instead of printing trace
-C: like -c but also print high/low/average stats
-d [+][!][fd | all]: select only syscalls using fd
-e: show environment variables
-E: show syscall entries
-f: follow forks
-F: show kernel's ttrace feature level
-g: don't attach to members of my session
-h: show state of all processes when idle
-i: don't display interruptible syscalls
-I start[/stop]: single-step and show instructions
-k: keep alive (wait for *all* processes)
-l: print lwpids
-L [!]lwps: [un]select these lwps
-n: print process names
-o [file|fd]: send trace output to file or fd
-p: print pids
-Q: be quiet about some warnings
-r [!][fd | all]: dump read buffers
-R: show syscall restarts
-s [!]syscalls: [un]select these syscalls
-S [!]signals: [un]select these signals
-t: detach process if it becomes traced
-T timestamp: print time stamps
-u: print user thread IDs (pthreads)
-v: verbose (some system calls only)
-V: print version
-w [!][fd | all]: dump write buffers
-x: print raw (hex) arguments
-X: print data in an exportable format
-y: register verbosity (with -I)
-z: only show failing syscalls
위에 많은 옵션중에서 주로 사용 하는 옵션에 대해 간단하게 설명 하겠습니다..
-f : fork 되는 process 까지 추적해줍니다..
-p : 현재 trace 하고 있는 Process 의 PID 를 보여 줍니다.
-l : Thread ID 를 보여 줍니다.
-n : Process 의 Name 을 보여줍니다.
-v : verbose
-T : 시간을 표시 해줍니다.
T%X : hh:mm:ss 형태로 출력되며 최소 단위는 초(sec)임
-T "" : NNNNNNNNNN.nnnnnn 형태로 출력되는데,
NNNNNNNNNN은 초단위로 시스템booting이후 계속증가되는 값임
nnnnnn은 millisecond단위임
-o : output 파일을 지정해 줍니다. ( 지정 안하면 현재 화면에 뿌려 줍니다. )
위 옵션들을 조합해서 /tmp/hp/tusc -fplnvT%T -o /tmp/server_tusc.out 22696 & 요렇게 사용 하면 됩니다..
# tusc -fplnvT%T -o /tmp/server_tusc.out 22696 &
# tail -f /tmp/server_tusc.out
# tail -f /tmp/server_tusc.out
( Attached to process 22696 ("server -p 9999") [32-bit] )
17:15:52 [server][22696]{932617} select(29, 0x6dff1ccc, NULL, NULL, 0x6dff1cc4) .................................................................................... [sleeping]
nfds: 29
readfds: 4, 27, 28
writefds: NULL
errorfds: NULL
timeout.tv_sec: 500
timeout.tv_usec: 0
17:15:52 [server][22696]{932618} ksleep(PTH_CONDVAR_OBJECT, 0x40055d28, 0x40290b3c, NULL) .......................................................................... [sleeping]
17:15:52 [server][22696]{932619} lwp_sema_wait(0x6df5d854) ......................................................................................................... [sleeping]
17:15:52 [server][22696]{932620} read(7, 0x6ddb0518, 4) ............................................................................................................ [sleeping]
17:15:52 [server][22696]{932621} read(9, 0x6dd80518, 4) ............................................................................................................ [sleeping]
17:15:52 [server][22696]{932629} read(11, 0x6dd50518, 4) ........................................................................................................... [sleeping]
17:15:52 [server][22696]{932632} read(13, 0x6dd20518, 4) ........................................................................................................... [sleeping]
17:15:52 [server][22696]{932635} read(15, 0x6dcf0518, 4) ........................................................................................................... [sleeping]
17:15:52 [server][22696]{932649} read(17, 0x6dcc0518, 4) ........................................................................................................... [sleeping]
tusc 는 http://hpux.connect.org.uk/ 에서 받으실수 있습니다.
Skin By KEBIBLOG Ver 1.0 Copyright ⓒ KEBI BLOG. All rights reserved.