본문으로 바로가기

sgxTools

category 카테고리 없음 2024. 6. 28. 12:03

http://www.osn.de/user/finzel/html/sgxTools.html

 

sgxTools는 Tcl 스크립트 오류 체크 툴로써 Tcl 스크립트의 잠재적인 버그를 동적으로 체크하는 대단히 유용한 툴입니다. Windows/Unix/Linux에서 사용 가능하며, Tcl/Tk8.0 이상에서 사용가능 합니다. sgxTools는 아래의 툴로 구성됩니다.

  • sgxXP - 코드 프로파일
  • sgxCT - 코드 트레이스
  • sgxRSM - 리소스 측정
  • sgxTVC - 변수 정합성 테스트
  • sgxDbg - 디버그 프러시저

sgxCP

Tcl 스크립트를 프로파일하는 툴입니다. 아래의 예는 demo.tcl 파일을 프로파일 합니다.

package require sgxCP
::sgxCP::init
source demo.tcl
puts stderr [::sgxCP::print]

프로파일의 결과는 프러시저 마다 출력됩니다. 프러시저의 콜(call) 횟수와 실행시간이 표시됩니다. 마지막으로 한 번도 사용되지 않은 프러시저도 표시해줍니다.

Profiling information for ::pong 
------------------------- 
             Total calls:  3 
    Caller distribution: 
                           3     ::ping 
           Compile time:  14166 
           Total runtime:  43629 
        Average runtime:  14543 
           Runtime StDev:  367 
         Runtime cov(%):  2.5 
   Total descendant time:  42594 
Average descendant time:  14198 
Descendants: 
                          3     ::ping 

Never used:     1 proc(s) 
        ::pongping

sgxCT

Tcl 스크립트를 트레이스를 하기 위한 툴입니다. 아래의 예는 demo.tcl 파일을 트레이스 합니다. 정규표현을 사용하여, 트레이스하고 싶은 프러시저를 정의하는 것도 가능합니다.

package require sgxCT
::sgxCT::Init {p.*g} stderr
source demo.tcl
::sgxCT::Summary {p.*g}

트레이스의 결과로 프러시저의 콜과 리턴의 관계가 출력됩니다. 프로시져의 네스팅(nesting) 레벨, 인자, 리턴값이 표시됩니다. Summary는 프로시져의 콜횟수와, 호출의 관계가 표시됩니다.

# Call Trace    regexp: 'p.*g' 

mode    level   proc    args/return 
call    1       ::pingpong 
call    2       ::ping  1 
call    3       ::pong  1 
call    4       ::ping  2 
call    5       ::pong  2 
call    6       ::ping  3 
call    7       ::pong  3 
call    8       ::ping  4 

         BANG    4 

return  8       ::ping  BANG 
return  7       ::pong  3 
return  6       ::ping  3 
return  5       ::pong  2 
return  4       ::ping  2 
return  3       ::pong  1 
return  2       ::ping  1 
return  1       ::pingpong      1 

# Call Trace Summary    regexp: 'p.*g' 

         # called: 
        4       ::ping 
        1       ::pingpong 
        3       ::pong 

         # caller: 
        4       ::ping 
        1       ::pingpong 
        3       ::pong 

         # callings: 
        1       ::ping          ::BANG 
        3       ::ping          ::pong 
        1       ::pingpong      ::ping 
        3       ::pong          ::ping 
        1       ./test/test_ct.dat        ::pingpong 

         # unused: 
        0       ::pongping

sgxRSM

Tcl 스크립트의 리소스를 측정하는 툴입니다. 아래의 예는 demo.tcl을 측정합니다.

package require sgxRSM
::sgxRSM::_Files_ demo.tcl

측정 결과는, 커맨드와 프로시져 콜 횟수가 프로셔져 마다 출력됩니다. 마지막의 summary로는 커맨드의 프로시져 콜 총횟수가 표시됩니다.

# ------------------------------------------------ 
Proc :   test_tvc 
FPM  :   3   FRPM :   1   FC   :   22 
LOC  :   142   eLOC :   57   SCUM :   149.1% 

Calls:   62 
   3   append 
   1   array 
   3   break 
   1   expr 
   1   for 
   3   foreach 
   3   global 
   1   if 
   2   incr 
   1   info 
   3   lappend 
   4   list 
   1   regexp 
   1   regsub 
   1   return 
   1   scan 
   16   set 
   1   string 
   7   subst 
   3   unset 
   2   upvar 
   3   variable 
# ------------------------------------------------

sgxTVC

Tcl 스크립트에 사용된 변수의 정합성을 테스트하는 툴입니다. 아래의 예는 demo.tcl 파일을 테스트합니다.

package require sgxTVC
::sgxTVC::_Files_ demo.tcl

테스트 결과는, 에러와 경고가 있는 변수의 리스트가 출력됩니다.

test_tvc   error   undef_14   variable undefined used by incr 
test_tvc   error   undef_15   variable undefined used by unset 
test_tvc   error   undef_16   variable undefined used by array 
test_tvc   error   undef_17   variable undefined used by info 
test_tvc   warning   append   bad style variable 
test_tvc   warning   lappend   bad style variable 
test_tvc   warning   incr   bad style variable 
test_tvc   error   unused_01   variable undefined used by append 
test_tvc   error   unused_02   variable undefined used by lappend 
test_tvc   error   unused_00   argument unused 
test_tvc   error   proc   argument unused 
test_tvc   warning   proc   bad style argument 
test_tvc   error   append   variable unused 
test_tvc   warning   append   bad style variable 
test_tvc   error   lappend   variable unused 
test_tvc   warning   lappend   bad style variable 
test_tvc   warning   set   bad style variable 
test_tvc   error   incr   variable unused 
test_tvc   warning   incr   bad style variable

sgxTools 2.1 버전을 올립니다.

sgxTools-2.1.tgz
0.13MB

 

공식 웹사이트가 폐쇠되어 아키이빙된 싸이트를 pdf로 만들어 올립니다.

SoftGuard - Extension _ Programming Tools.pdf
0.18MB