Introduction
Introduction Statistics Contact Development Disclaimer Help
Add current page size in Kb and the whole bandwidth usage at the end - clic - C…
git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65…
Log
Files
Refs
Tags
README
LICENSE
---
commit 1f6eeef4e3b769c19b558f9218d618b59383a54d
parent e621aa67e792e7fa10c602cdf2820d652b3afe3e
Author: Solene Rapenne <[email protected]>
Date: Mon, 13 Aug 2018 12:33:37 +0200
Add current page size in Kb and the whole bandwidth usage at the end
Diffstat:
M clic.lisp | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/clic.lisp b/clic.lisp
@@ -63,6 +63,10 @@
;;; array of lines of last menu
(defparameter *previous-buffer* nil)
+;;; bandwidth usage counter
+(defparameter *total-bandwidth-in* 0)
+(defparameter *last-bandwidth-in* 0)
+
;;; a list containing the last viewed pages
(defparameter *history* '())
@@ -303,6 +307,7 @@
:fill-pointer 0
:initial-element nil
:adjustable t))
+ (setf *last-bandwidth-in* 0)
(let ((real-time (get-internal-real-time)))
;; we prepare informations about the connection
@@ -319,11 +324,15 @@
count line into lines
while line
do
+ ;; count bandwidth usage
+ (incf *total-bandwidth-in* (length line))
+ (incf *last-bandwidth-in* (length line))
;; increase array size if needed
(when (= lines (- (array-total-size *buffer*) 1))
(adjust-array *buffer* (+ 200 (array-total-size *buffer*))))
(vector-push line *buffer*)))
+
;; we store the duration of the connection
(setf *duration* (float (/ (- (get-internal-real-time) real-time)
internal-time-units-per-second)))))
@@ -707,13 +716,14 @@
(defun display-prompt()
(let ((last-page (car *history*)))
- (format t "~agopher://~a:~a/~a~a (~as) / (p)rev (r)edisplay (h)istory : "
+ (format t "~agopher://~a:~a/~a~a (~as, ~aKb) / (p)rev (r)edisplay (h)istor…
(if *kiosk-mode* "KIOSK " "")
(location-host last-page)
(location-port last-page)
(location-type last-page)
(location-uri last-page)
- *duration*))
+ *duration*
+ (floor (/ *last-bandwidth-in* 1024.0))))
(force-output))
(defun shell()
@@ -769,7 +779,8 @@
;; to look it here
(when (not (eq 'end (visit destination)))
;; we continue to the shell if we are in a terminal
- (shell))))
+ (shell)))
+ (format t "~a kB in.~%" (floor (/ *total-bandwidth-in* 1024.0))))
(pipe-to-stdout destination)))))
;; we allow ecl to use a new kind of argument
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.