[nio-cvs] r44 - in branches/home/psmith/restructure: . src/buffer src/compat src/io src/protocol/yarpc src/statemachine

psmith at common-lisp.net psmith at common-lisp.net
Fri Jan 19 00:11:09 UTC 2007


Author: psmith
Date: Thu Jan 18 19:11:08 2007
New Revision: 44

Added:
   branches/home/psmith/restructure/src/compat/utils.lisp
Modified:
   branches/home/psmith/restructure/run-yarpc-client.lisp
   branches/home/psmith/restructure/run-yarpc.lisp
   branches/home/psmith/restructure/src/buffer/buffer.lisp
   branches/home/psmith/restructure/src/compat/nio-compat-package.lisp
   branches/home/psmith/restructure/src/compat/nio-compat.asd
   branches/home/psmith/restructure/src/io/async-fd.lisp
   branches/home/psmith/restructure/src/io/nio-server.lisp
   branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp
   branches/home/psmith/restructure/src/statemachine/state-machine.lisp
Log:
Moved verbose messages to nio-debug



Modified: branches/home/psmith/restructure/run-yarpc-client.lisp
==============================================================================
--- branches/home/psmith/restructure/run-yarpc-client.lisp	(original)
+++ branches/home/psmith/restructure/run-yarpc-client.lisp	Thu Jan 18 19:11:08 2007
@@ -1,4 +1,4 @@
-(push :nio-debug *features*)
+;(push :nio-debug *features*)
 (require :asdf)
 (require :nio-yarpc)
 
@@ -6,7 +6,7 @@
 (sb-thread:make-thread #'(lambda()(nio:start-server 'identity 'identity nil :host "127.0.0.1" :port 9897)) :name "nio-server")
 (sleep 4)
 (let ((sm (nio:add-connection "127.0.0.1" 16323 'nio-yarpc:yarpc-client-state-machine)))
-
-(loop
-  (format t "toplevel adding conn ~A~%" sm)
-  (format t "Result of remote-execute ~A~%" (nio-yarpc:remote-execute sm "(nio-yarpc:test-rpc-list)"))))
+  (format t "~A toplevel adding conn ~A~%" (nio-compat:get-readable-time) sm)
+  (loop
+    (format t "~A toplevel Submitting job~%" (nio-compat:get-readable-time) )
+    (format t "~A Result of remote-execute ~A~%" (nio-compat:get-readable-time) (nio-yarpc:remote-execute sm "(nio-yarpc:test-rpc-list)"))))

Modified: branches/home/psmith/restructure/run-yarpc.lisp
==============================================================================
--- branches/home/psmith/restructure/run-yarpc.lisp	(original)
+++ branches/home/psmith/restructure/run-yarpc.lisp	Thu Jan 18 19:11:08 2007
@@ -1,11 +1,11 @@
-(push :nio-debug *features*)
+;(push :nio-debug *features*)
 (require :asdf)
 (require :nio-yarpc)
 
 (sb-thread:make-thread #'(lambda()(nio:start-server 'identity 'identity 'nio-yarpc:yarpc-state-machine :host "127.0.0.1")) :name "nio-server")
 (loop
     ;;block waiting for jobs
-    (format t "Server toplevel waiting for job~%" )
+    (format t "~A Server toplevel waiting for job~%" (nio-compat:get-readable-time))
     (destructuring-bind (job result-queue) (nio-compat:take nio-yarpc:job-queue)
-      (format t "Server received job ~A~%" job)
+      (format t "~A Server received job ~A~%" (nio-compat:get-readable-time) job)
       (nio-compat:add result-queue (nio-yarpc:execute-call job))))

Modified: branches/home/psmith/restructure/src/buffer/buffer.lisp
==============================================================================
--- branches/home/psmith/restructure/src/buffer/buffer.lisp	(original)
+++ branches/home/psmith/restructure/src/buffer/buffer.lisp	Thu Jan 18 19:11:08 2007
@@ -159,13 +159,13 @@
 ;; Write bytes from vector vec to bytebuffer
 (defmethod bytebuffer-write-vector((bb byte-buffer) vec)
   :documentation "Returns number of bytes written to bytebuffer"
-  (format t "bytebuffer-write-vector - called with ~A ~A"bb vec)
+#+nio-debug    (format t "bytebuffer-write-vector - called with ~A ~A"bb vec)
 ;  (if (> (remaining bb) 0)
 ;      0
       (progn	
 ;	(clear bb)
 	(let ((bytes-written (cffi:mem-write-vector vec (buffer-buf bb) :unsigned-char (length vec) (buffer-position bb))))
-	  (format t "bytebuffer-write-vector -  byteswritten: ~A~%" bytes-written)
+#+nio-debug  	  (format t "bytebuffer-write-vector -  byteswritten: ~A~%" bytes-written)
 	  (inc-position bb bytes-written)
 	  bytes-written)))
 ;)

Modified: branches/home/psmith/restructure/src/compat/nio-compat-package.lisp
==============================================================================
--- branches/home/psmith/restructure/src/compat/nio-compat-package.lisp	(original)
+++ branches/home/psmith/restructure/src/compat/nio-compat-package.lisp	Thu Jan 18 19:11:08 2007
@@ -33,4 +33,7 @@
 	     
 	     ;;concurrent-queue
 	     concurrent-queue add take
+	     
+	     ;;utils
+	     get-readable-time
 	     ))

Modified: branches/home/psmith/restructure/src/compat/nio-compat.asd
==============================================================================
--- branches/home/psmith/restructure/src/compat/nio-compat.asd	(original)
+++ branches/home/psmith/restructure/src/compat/nio-compat.asd	Thu Jan 18 19:11:08 2007
@@ -7,6 +7,7 @@
     :components ((:file "nio-compat-package")
 		 (:file "errno" :depends-on ("nio-compat-package"))
 		 (:file "concurrent-queue" :depends-on ("nio-compat-package"))
+		 (:file "utils" :depends-on ("nio-compat-package"))
 		 )
 
     :depends-on ())

Added: branches/home/psmith/restructure/src/compat/utils.lisp
==============================================================================
--- (empty file)
+++ branches/home/psmith/restructure/src/compat/utils.lisp	Thu Jan 18 19:11:08 2007
@@ -0,0 +1,38 @@
+#|
+Copyright (c) 2007
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+|#
+
+(in-package :nio-compat)
+
+(declaim (optimize (debug 3) (speed 3) (space 0)))
+
+(defun get-readable (format-string &optional (time (get-universal-time)))
+  (multiple-value-bind (second minute hour date month year) (decode-universal-time time)
+    (with-output-to-string (out)
+      (format out format-string year month date hour minute second))))
+
+(defun get-readable-time ( &optional (time (get-universal-time)))
+  (get-readable "~A/~2,'0d/~2,'0d ~2,'0d:~2,'0d:~2,'0d" time))

Modified: branches/home/psmith/restructure/src/io/async-fd.lisp
==============================================================================
--- branches/home/psmith/restructure/src/io/async-fd.lisp	(original)
+++ branches/home/psmith/restructure/src/io/async-fd.lisp	Thu Jan 18 19:11:08 2007
@@ -110,7 +110,7 @@
 ;;  "Read more data from STATE-MACHINE."
 (defun read-more (state-machine)
   (with-slots (foreign-read-buffer read-fd) state-machine
-  (format t "read-more called with ~A~%" state-machine)
+#+nio-debug  (format t "read-more called with ~A~%" state-machine)
 
 #+nio-debug      (format t "read-more - calling read() into ~A~%" foreign-read-buffer) 
     (let ((new-bytes (%read read-fd (buffer-buf foreign-read-buffer) (remaining foreign-read-buffer))))

Modified: branches/home/psmith/restructure/src/io/nio-server.lisp
==============================================================================
--- branches/home/psmith/restructure/src/io/nio-server.lisp	(original)
+++ branches/home/psmith/restructure/src/io/nio-server.lisp	Thu Jan 18 19:11:08 2007
@@ -90,7 +90,7 @@
     (catch 'poll-error-exit
       (handler-bind ((poll-error #'(lambda (cond) 
 				     (declare (ignore cond))
-				     (format t "Poll-error, exiting..~%")
+				     (format t "Poll-error (errno ~A), exiting..~%" (get-errno))
 				     (throw 'poll-error-exit nil))))
        
 	(loop 

Modified: branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp
==============================================================================
--- branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp	(original)
+++ branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp	Thu Jan 18 19:11:08 2007
@@ -59,11 +59,11 @@
   (format stream "#<CALL-METHOD-PACKET ~A >" (call-string packet)))
 
 (defmethod write-bytes((packet call-method-packet) buf)
-  (format t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
-;  (nio-buffer:flip buf)
+#+nio-debug  (format t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
   (nio-buffer:bytebuffer-write-vector buf #(#x0))
   (nio-buffer:bytebuffer-write-string buf (call-string packet))
-  (format t "yarpc-packet-factory:write-bytes - written ~A~%" buf)  )
+#+nio-debug    (format t "yarpc-packet-factory:write-bytes - written ~A~%" buf)  
+)
   
 
 (defclass method-response-packet (packet)
@@ -77,7 +77,8 @@
   (format stream "#<METHID-RESPONSE-PACKET ~A >" (response packet)))
 
 (defmethod write-bytes((packet method-response-packet) buf)
-  (format t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
+#+nio-debug    (format t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
   (nio-buffer:bytebuffer-write-vector buf #(#x1))
   (nio-buffer:bytebuffer-write-string buf (write-to-string (response packet)))
-  (format t "yarpc-packet-factory:write-bytes - written ~A~%" buf)  )
+#+nio-debug    (format t "yarpc-packet-factory:write-bytes - written ~A~%" buf)  
+)

Modified: branches/home/psmith/restructure/src/statemachine/state-machine.lisp
==============================================================================
--- branches/home/psmith/restructure/src/statemachine/state-machine.lisp	(original)
+++ branches/home/psmith/restructure/src/statemachine/state-machine.lisp	Thu Jan 18 19:11:08 2007
@@ -57,7 +57,7 @@
 (defmethod process-read((sm state-machine))
   (with-slots (foreign-read-buffer) sm
     (let ((incoming-packet (get-packet (get-packet-factory sm) foreign-read-buffer)))
-      (format t "state-machine::process-read - incoming packet: ~A~%" incoming-packet)
+      (format t "~A state-machine::process-read - incoming packet: ~A~%" (nio-compat:get-readable-time) incoming-packet)
       (when incoming-packet 
       	  (when (not (process-incoming-packet sm incoming-packet))
       	    (close-sm sm))))))
@@ -67,7 +67,7 @@
 (defmethod process-write((sm state-machine))
   (with-slots (foreign-write-buffer) sm
   (let ((outgoing-packet (process-outgoing-packet sm)))
-    (format t "state-machine::process-write - outgoing packet: ~A~%" outgoing-packet)
+    (format t "~A state-machine::process-write - outgoing packet: ~A~%" (nio-compat:get-readable-time) outgoing-packet)
     (when outgoing-packet (write-bytes outgoing-packet foreign-write-buffer)))))
 
 



More information about the Nio-cvs mailing list