From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,47a06d19e281eb8d X-Google-Attributes: gidf7344,public X-Google-Thread: 111731,47a06d19e281eb8d X-Google-Attributes: gid111731,public X-Google-Thread: f6134,47a06d19e281eb8d X-Google-Attributes: gidf6134,public X-Google-Thread: 1164f8,47a06d19e281eb8d X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1994-03-12 08:24:35 PST Xref: gmd.de comp.org.decus:2969 comp.os.vms:42288 comp.sys.dec:14277 comp.unix.advocacy:1116 Newsgroups: comp.org.decus,comp.os.vms,comp.sys.dec,comp.unix.advocacy Path: gmd.de!xlink.net!howland.reston.ans.net!noc.near.net!mv!fastball.unimaster.com!cherkus From: cherkus@fastball.unimaster.com (Dave Cherkus) Subject: UNIX ^T Status Function (was Re: Is VMS Dying?) Message-ID: Nntp-Posting-Host: fastball.unimaster.com Sender: usenet@mv.mv.com (System Administrator) Reply-To: cherkus@UniMaster.COM Organization: UniMaster, Inc. Date: Sat, 12 Mar 1994 16:24:35 GMT References: <1994Feb26.204059.4068@mixcom.mixcom.com> <1994Mar4.010658.1@nebula> <1994Mar6.154156.17891@dxcern.cern.ch> <1994Mar7.082703.18762@avatar.montagar.com> <1994Mar8.130206.888@dxcern.cern.ch> <1994Mar8.152203.3774@inmos.co.uk> In article <1994Mar8.152203.3774@inmos.co.uk>, hughm@inmos.co.uk (Hugh McIntyre) writes: |> In article <1994Mar8.130206.888@dxcern.cern.ch>, lishka@dxcern.cern.ch (Chris Lishka) writes: |> |> Agreed: Unix does really need a ^T equivalent. I remember back in |> |> college [insert violin music] using Unix on a Gould machine, in which |> |> somebody had hacked ^T to run uptime. |> |> I seem to remember from University that an early (pre-V7!) version of Unix did |> include ^T support as part of the TTY driver (at the same level as ^C/^Z |> support). Apparently it was removed for performance reasons, although there |> may also be a risk of the kernel getting stuck waiting to write to a hung TTY. |> |> Hugh. How about trying it on your shiny new Alpha? It's there, but not really documented ('man stty' kind of hints about the 'status' or 'info' function but really doesn't tell you how to use it). Issue the command: axposf.pa.dec.com> stty status ^t then hit Ctrl-T a few times: axposf.pa.dec.com> load: 1.46 cmd: csh 6163 [ttyin] 0.12u 0.12s 0% 248k load: 1.46 cmd: csh 6163 [ttyin] 0.12u 0.12s 0% 248k load: 1.46 cmd: csh 6163 [ttyin] 0.12u 0.12s 0% 248k load: 1.46 cmd: csh 6163 [ttyin] 0.12u 0.12s 0% 248k load: 1.46 cmd: csh 6163 [ttyin] 0.12u 0.12s 0% 248k Let's check the output some: axposf.pa.dec.com> uptime 07:51 up 11 days, 16:13, 19 users, load average: 3.00, 3.00, 3.00 Well, the load average (1.46) doesn't correspond to anything uptime has to report... axposf.pa.dec.com> ps l UID PID PPID CP PRI NI VSZ RSS WCHAN STAT TT TIME COMMAND 10096 6163 6161 0 44 0 1.75M 424K - R + q3 0:00.25 -csh (csh) axposf.pa.dec.com> ps u USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND cherkus 6163 0.0 0.2 1.75M 424K q3 R + 07:38:07 0:00.26 -csh (csh) The cmd name (csh) and pid (6163) is correct. The event being waited for (ttyin) is reasonable while the shell is waiting for my keystrokes. The ps output indicates csh was not waiting (i.e. was runnable) at the time ps checked the process table, which is also reasonable. The time (0.12u + 0.12s = 0:00.24) is reasonable; the two ps commands indicate 0:00.25 and 0:00.26 which indicates that the shell did have to run .01 second to start ps. The memory usages don't seem to agree (248k vs. 424K). The two major things that don't agree (load average and memory usage) could be because of a bug, or because they are calculating the usages differently. To show the command is useful, put some other job in the foreground and hit Ctrl-T a few times as it runs: axposf.pa.dec.com> find / -name \* -print >& /dev/null load: 1.56 cmd: find 6299 [event] 0.03u 0.25s 0% 160k load: 1.56 cmd: find 6299 [running] 0.04u 0.26s 0% 160k load: 1.56 cmd: find 6299 [running] 0.04u 0.26s 0% 160k load: 1.54 cmd: find 6299 [event] 0.04u 0.27s 0% 160k load: 1.54 cmd: find 6299 [event] 0.04u 0.29s 0% 160k load: 1.53 cmd: find 6299 [event] 0.05u 0.38s 0% 160k load: 1.53 cmd: find 6299 [event] 0.06u 0.40s 0% 160k load: 1.53 cmd: find 6299 [event] 0.06u 0.43s 0% 160k load: 1.51 cmd: find 6299 [event] 0.07u 0.46s 0% 160k load: 1.51 cmd: find 6299 [event] 0.07u 0.49s 0% 160k load: 1.51 cmd: find 6299 [event] 0.08u 0.54s 0% 160k load: 1.50 cmd: find 6299 [event] 0.08u 0.58s 1% 160k load: 1.50 cmd: find 6299 [event] 0.10u 0.71s 1% 160k load: 1.59 cmd: find 6299 [event] 0.10u 0.75s 1% 160k load: 1.59 cmd: find 6299 [event] 0.12u 0.87s 1% 160k load: 1.57 cmd: find 6299 [event] 0.13u 0.94s 1% 160k You can see that 'find' spends some time running and a fair amount of time waiting for an event (i.e. disk I/O). If you knew how long your program took to run, this function could help you determine how much longer it would take to finish. I guess this post is appropriate for the vms-unix flame war because it shows yet another nifty unix function yet it also shows an poorly documented function that does not seem to provide information that is entirely consistent with other system functions. Oh, well, I guess we gotta use up all of the internet's bandwidth somehow! -- Dave Cherkus UniMaster, Inc. cherkus@unimaster.com