Megatest

Diff
Login

Differences From Artifact [a8b0c022e5]:

To Artifact [d0d48bccf9]:


1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
	(lambda ()(list (read)(read)(read))))))

;; get normalized cpu load by reading from /proc/loadavg and /proc/cpuinfo return all three values and the number of real cpus and the number of threads
;; returns alist '((adj-cpu-load . normalized-proc-load) ... etc.
;;  keys: adj-proc-load, adj-core-load, 1m-load, 5m-load, 15m-load
;;
(define (common:get-normalized-cpu-load remote-host)
  (or (common:get-cached-info remote-host "normalized-load")
      (let ((data (if remote-host
		      (with-input-from-pipe 
		       (conc "ssh " remote-host " cat /proc/loadavg;cat /proc/cpuinfo;echo end")
		       read-lines)
		      (append 
		       (with-input-from-file "/proc/loadavg" 
			 read-lines)







|







1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
	(lambda ()(list (read)(read)(read))))))

;; get normalized cpu load by reading from /proc/loadavg and /proc/cpuinfo return all three values and the number of real cpus and the number of threads
;; returns alist '((adj-cpu-load . normalized-proc-load) ... etc.
;;  keys: adj-proc-load, adj-core-load, 1m-load, 5m-load, 15m-load
;;
(define (common:get-normalized-cpu-load remote-host)
  (or (and remote-host (common:get-cached-info remote-host "normalized-load"))
      (let ((data (if remote-host
		      (with-input-from-pipe 
		       (conc "ssh " remote-host " cat /proc/loadavg;cat /proc/cpuinfo;echo end")
		       read-lines)
		      (append 
		       (with-input-from-file "/proc/loadavg" 
			 read-lines)
1510
1511
1512
1513
1514
1515
1516
1517

1518
1519
1520
1521
1522
1523
1524
1525
			  (append (list (cons 'adj-proc-load adj-proc-load)
					(cons 'adj-core-load adj-core-load))
				  (list (cons '1m-load (car loads))
					(cons '5m-load (cadr loads))
					(cons '15m-load (caddr loads)))
				  (list (cons 'proc act-proc)
					(cons 'core act-core)
					(cons 'phys act-phys)))))

		    (common:write-cached-info remote-host "normalized-load" result)
		    result)
		  (regex-case
		   hed
		   (load-rx  ( x l1 l5 l15 ) (loop (car tal)(cdr tal)(map string->number (list l1 l5 l15)) proc-num phys-num core-num))
		   (proc-rx  ( x p         ) (loop (car tal)(cdr tal) loads           (max-num p proc-num) phys-num core-num))
		   (phys-rx  ( x p         ) (loop (car tal)(cdr tal) loads           proc-num (max-num p phys-num) core-num))
		   (core-rx  ( x c         ) (loop (car tal)(cdr tal) loads           proc-num phys-num (max-num c core-num)))







|
>
|







1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
			  (append (list (cons 'adj-proc-load adj-proc-load)
					(cons 'adj-core-load adj-core-load))
				  (list (cons '1m-load (car loads))
					(cons '5m-load (cadr loads))
					(cons '15m-load (caddr loads)))
				  (list (cons 'proc act-proc)
					(cons 'core act-core)
					(cons 'phys act-phys))))
                         (the-host (or remote-host (current-host-name))))
		    (common:write-cached-info the-host "normalized-load" result)
		    result)
		  (regex-case
		   hed
		   (load-rx  ( x l1 l5 l15 ) (loop (car tal)(cdr tal)(map string->number (list l1 l5 l15)) proc-num phys-num core-num))
		   (proc-rx  ( x p         ) (loop (car tal)(cdr tal) loads           (max-num p proc-num) phys-num core-num))
		   (phys-rx  ( x p         ) (loop (car tal)(cdr tal) loads           proc-num (max-num p phys-num) core-num))
		   (core-rx  ( x c         ) (loop (car tal)(cdr tal) loads           proc-num phys-num (max-num c core-num)))