*** What is this? [#oe481973]
This package provides commands for show/kill process on Windows2000/XP.
ps command can get some details such as %cpu, PPID, exe file path, memory etc...

*** License [#o750eabc]
BSD-Style License

*** Source & Binary [#yfe08456]
http://reddog.s35.xrea.com/software/process1.0.zip

*** Command [#k2d7e660]
 ps ?options?
 kill ?pid?

*** ps options [#cb116ea6]
- -exe ~
exefile name
- -path ~
exefile full path (long name)
- -ppid ~
parent process id
- -priority ~
priority base
- -thread ~
thread count
- -ctime ~
created datetime. If we cannot get it, it will be ''0''.
- -ktime ~
kernel time. If we cannot get it, it will be -1.
- -utime ~
user time. If we cannot get it, it will be -1.
- -%cpu ~
Percentage of CPU usage from created time to the present time. If we cannot get it, it will be -1.
- -%cpu msec ~
Percentage of CPU usage in milli seconds. If we cannot get it, it will be -1.
- -%size ~
Percentage of real memory (working set) used.  If we cannot get it, it will be -1.
- -%vsize ~
Percentage of virtual memory (page file) used.  If we cannot get it, it will be -1.
- -size ~
real memory size (byte). If we cannot get it, it will be -1.
- -peaksize ~
real memory peal size (byte). If we cannot get it, it will be -1.
- -vsize ~
virtual memory size (byte). If we cannot get it, it will be -1.
- -peakvsize~
virtual memory peak size (byte). If we cannot get it, it will be -1.
- -pagefault ~
pagefault count. If we cannot get it, it will be -1.
- -user ~
account user name
- -domain ~
account domain name
- -version ~
exe version
- -plainlist ~
output plain list

*** Example1 [#ob241f99]
 package require Process
 # Show Process List
 ps -exe -%cpu -%size
 ps -exe -ppid
 kill 1024
 ...

*** Example2 [#fa342965]
 proc plist {} {
 	puts [format {%4s %-8s  %6s  %6s   %5s %s} \
 			PID USER %CPU %MEM SIZE CMD]
 	foreach {pid user pcpu pmem mem exe} \
 		[ps -user -%cpu -%size -size -exe -plainlist] {
 		if {$pcpu < 0} {set pcpu 0}
 		if {$pmem < 0} {set pmem 0}
 		puts [format {%4d %-8s %6.1f%% %6.1f%% %5dKB %s} \
 			$pid $user $pcpu $pmem [expr $mem/1024] $exe]
 	}
 }
 plist

  PID USER        %CPU    %MEM    SIZE CMD
    0             0.0%    0.0%    -1KB [System Process]
    8             0.0%    0.0%   252KB System
  156 SYSTEM      0.0%    0.1%   436KB SMSS.EXE
  180             0.0%    0.0%    -1KB CSRSS.EXE
  176 SYSTEM      0.0%    0.7%  3728KB WINLOGON.EXE
  228 SYSTEM      0.0%    1.0%  5368KB SERVICES.EXE
  240 SYSTEM      0.0%    0.2%  1056KB LSASS.EXE
  420 SYSTEM      0.0%    0.5%  2600KB svchost.exe
  448 SYSTEM      0.0%    0.6%  3348KB spoolsv.exe
  484 SYSTEM      0.0%    1.0%  5360KB svchost.exe
  512 SYSTEM      0.0%    0.7%  3616KB mdm.exe
  624 SYSTEM      0.0%    0.6%  3064KB NAVAPSVC.EXE
  ...
***Example3 [#z44d4c20]
 package require tablelist
 package require Process
 
 set lvar {}
 
 button .update -text Update -command {
 	set lvar [ps -%cpu 500 -size -exe]
 	catch {.table sortbycolumn [.table sortcolumn] -[.table sortorder]}
 	update
 }
 scrollbar .y -command {.table yview}
 tablelist::tablelist .table -listvariable lvar \
 	-showarrow yes -yscrollcommand {.y set} \
 	-labelcommand tablelist::sortByColumn \
 	-columns {6 PID 10 %CPU 10 Memory 32 Name} -width 70
 .table columnconfigure 0 -align right -sortmode integer
 .table columnconfigure 1 -align right -sortmode real -formatcommand formatPer
 .table columnconfigure 2 -align right -sortmode integer -formatcommand  formatSize
 .table columnconfigure 3 -sortmode ascii
 
 pack .update -side bottom -fill x
 pack .table -side left -expand yes -fill both
 pack .y -side right -fill y
 
 proc formatPer {var} {
 	if {$var < 0} {
 		return {}
 	}
 	return "[format %3.2f $var] %"
 }
 
 proc formatSize {var} {
 	if {$var < 0} {
 		return {}
 	}
 	return "[expr $var / 1024] KB"
 }

#ref(process1.gif,nolink,left)

*** Comment [#p1b8db4e]
- huw4wknbpbbfa karate supplies karate supplies -- [[karate supplies]] &new{2007-12-26 (Wed) 01:43:12};

#comment
----
[[CategoryTclTk]] [[CategorySoft]]
[[Tclでプロセス管理]]


HTML convert time: 0.010 sec.