counting concurrent users...need advice.

Bob Stockler bob at trebor.iglou.com
Fri Aug 27 18:08:50 PDT 2004


On Fri, Aug 27, 2004 at 05:44:06PM -0400, Mark Luljak wrote:
| When asked his whereabouts on Fri, Aug 27, 2004 at 11:34:05AM -0400,
| Bob Stockler took the fifth, drank it, and then slurred:
| > On Fri, Aug 27, 2004 at 09:24:41AM -0400, Mark Luljak wrote:
| > | 
| > | Basically, I need a way to chart usage of fP in a concurrent user count
| > | sense.  That's the short story.
| > [snip]
| > 
| > How about a script that periodically pipes the output of 'ps'
| > (with the arguments appropriate to the OS) into programming that
| > counts the instances of [dr]clerk or [dr]report executing, and
| > keeps track of the maximum?
| 
| That would be fine if not for granularity issues.  You could have two long
| jobs that take a minute and a half each, and you poll once a minute, so
| you'd always see those two, but you're only getting a snapshot.  Inside
| that minute of granularity, another ten 5-second instances could have hit
| the system at the same time dead in the middle of your non-polling time,
| and you'd never know you'd hit 12 instead of 2.
| 
| It really wants internal tracking that's externally accessible.
| 
| Anything else, from using ps to /proc, would end up being a non-sleeping
| polling loop that would eat CPU practically in realtime and degrade system
| performance--while -still- having the potential for missing instances if
| they were brief enough.  Not good.

I thought you were looking for something that would run for
just a litte while to tell one how many user licenses to buy.
In that case, something like this:

  #!/bin/ksh
  typeset -i fP_Use=0
  typeset -i Max_fP_Use=0
  while :
  do eval `
       ps -ef |
       mawk ' /[dr]clerk|[dr]report/ { n++ } END { print "fP_Use=" n }'
     `
     (( $fP_Use > $Max_fP_Use )) && Max_fP_Use=$fP_Use
     echo "Max_fP_Use = $Max_fP_Use"
     sleep 10
  done

wouldn't be too expensive to run, even if the sleep time were
reduced to 5, 4, 3, 2 or 1 (or maybe even eliminated).

Bob (who, admitedly, doesn't undestand the problem)

-- 
Bob Stockler - bob at trebor.iglou.com
Author: MENU EDIT II - The BEST Creator/Editor/Manager for filePro User Menus.
Fully functional (time-limited) demos available by email request (specify OS).


More information about the Filepro-list mailing list