Purpose: often one needs to know something about the system on which the application is running to do the right thing. Here are some ways to get info.---- Here's a simple Tcl script which outputs a number of pieces of information:
#! /usr/tcl84/bin/tclsh
puts "This is Tcl version $tcl_version , patchleve $tcl_patchLevel" puts "[info nameofexecutable] is [info tclversion] patch [info patchlevel]" puts "Directory(s) where package require will search:" puts "$auto_path" puts "tcl_libPath = $tcl_libPath" puts "tcl_pkgPath = $tcl_pkgPath" puts "tcl_library = $tcl_library" puts "info library = [info library]" puts "Shared libraries are expected to use [info sharedlibextension]" puts "platform information:" parray tcl_platform
A good start is to look at what version of Tcl you've got:
info patchlevel
Then look at the contents of the tcl_platform global array:
parray tcl_platform
See tcl_platform for a list of the output of this command on various systems.
See info library for [what??]. See auto_path for [what??]. See tcl_pkgPath for [what??]. See tcl_libPath for [what??].
Now, if you are running Unix, you can obtain even more configuration information:
exec uname -a
And for Solaris users, you can find out your processor speed using the following magic incantation:
exec psrinfo -v
(the executable is located in /usr/sbin on this machine at least... :^)
On Linux, you can work out your basic memory usage profile using:
exec free
Unix systems with the luxury of a SYSV ps (like both IRIX and Solaris) can use it to discover useful info about the Tcl process itself:
exec /bin/ps -p [pid] -o {pid sz rss util pcpu time etime comm}
And there is also sysconf which is exposed on IRIX systems but not Solaris AFAICT...
exec sysconf
Actually, solaris has sysinfo, but it's not all that useful ;^)
I am rather partial to:
set name xterm exec /bin/ps -Ao fname,pid,pcpu,pmem,vsz,rss,etime | grep $name
-PSE
See Measuring your Application's CPU Utilization for a related discussion.
Please extend this page with goodies and snippets from other OSes that I know less well! DKF
For all versions of Windows, download applications from: [L1 ]
CL maintains an exhausting, if not exhaustive, list of ways to calculate memory characteristics under various Unix flavors at [L2 ]. Several of these commands give configuration information beyond memory.