njPipes - a status report

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

njPipes - a status report

Ed Tomlinson
Hi,

As you may have noticed I have released a new njPipes version.  You might
be wondering about the state of njPipes.  The core functions, supporting
the pipe calls (readto, peekto, output, addpipe, etc), seem to be quite stable.  
I have not had to make any changes (except to add pipe debugging aids) to them
since September 1998.  The support functions are also solid.  These are used
to ease stage writing by providing standard methods for processing ranges,
delimited strings, and a few other goodies.  The stages are not in quite as
good shape.  They function well enough, if the options you are using have
been well tested.   About a hundread stages are included in the package.

Java performance has also improved, resulting in much faster pipe processing.
There is over an order of magnitude increase in performance between JDK 1.1.7
on a P100 and JDK 1.2.1 (NT) on a PII 266.  I have benchmarked rates of about
60,000 context switches per second on the PII system.  Meaning a simple three
stage pipeline can process 100000 objects in under 6 seconds.

Too give an idea of the type of pipes that njPipes can now handle a NetRexx
example follows.  This could also have been coded in java - the njPipes processor
can generate the java code too.  You still need a complete NetRexx installation
since the pipes themselves get translated into NetRexx code.

-------------------------------------------------------------------------------
-- tcpecho.njp watch a sapgui session

/*
 *  Copyright (C) 1999  Edward J. Tomlinson, [hidden email]
 *  Distributed under the GNU GENERAL PUBLIC LICENSE with NO WARANTEES of ANY kind.
 */

-- usage: java watch watched_port view_port sapserver 3200+sap_system_number

-- setup a sapgui(s) to connect to the view_port and watched_port.  Then connect
-- the sessions.  Note the view_port session must connect first, the gui will
-- not start until the watched_port session connects.  The port number is
-- 3200 plus the system number (ie. in the gui setup set the system number
-- to 20 to use 3220 as a watched-port...).  Typing stop will shutdown the
-- server when the last session ends.

pipe (watch stall 30000 end ? debug 3 )

      console !      -- type stop to quit this
      find stop!
   g: gate,
?
      literal !      -- limit us to 5 broadcast/viewer sessions
      dup 4 !
   c: fanin !
      tcplisten {2} timeout 2000 backlog 1 !       -- the viewer
   g: !
   o: fanout !                                     -- enable a broadcaster
   e: tcpecho {},
?
   o: !
      tcplisten {1} timeout 2000 backlog 1 !       -- the broadcaster
   e:,
?
   e: !             -- pass objects that tcpecho produces
      elastic !
   g: !             -- when terminating to tcplisten so
   c:               -- it can start sessions


import pipes.

options binary

class tcpecho extends stage

method run() public

   parse arg() . . rsys rport
   do
      loop forever
         peekto()                        -- wait for it...

         addpipe (watch stall 15000 end ? debug 0)

           *out0: !
         v: fanin !
            tcpdata !                    -- echo broadcast to this session
            hole,
       ?                                 -- and ignore any user input
           *out1: !
         b: fanin !                      -- echo to the sap server
            tcpdata !
            tcpclient {rsys} {rport} linger 1000 !
         o: fanout !
            elastic !                    -- pass sap server output
         b:,
       ?
         o: !
            elastic !                    -- to the viewer too
         v:,
       ?
         o: !
            hole !                       -- wait for this to end
            append literal !
         i: faninany !
           *out2:,
       ?                                -- and pass an obj back to watch
           *out2: !
           i:

         selectOutput(0)                 -- accept the viewer
         callpipe (bridge1 stall 15000 end ? debug 0)
            *in0: ! take first 1 ! *out0:

         severOutput()

         selectOutput(1)                 -- and the broadcaster
         callpipe (bridge2 stall 15000 end ? debug 0)
            *in1: ! take first 1 ! *out1:

         severOutput()
      end
   catch StageError
      rc = rc()
   end
exit(rc*(rc<>12))
-------------------------------------------------------------------------------

Comments, suggestions, submitted stages, examples or tests (failing or not) are
always welcome.

TIA,




Ed Tomlinson <[hidden email]> http://www.cam.org/~tomlins/njpipes.html
Montreal, Canada

To obtain my public key mail me with a subject of: PGP Key

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>