Megatest

Check-in [067b4c3661]
Login
Overview
Comment:Use the hostname for host load cache when running get load locally.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65
Files: files | file ages | folders
SHA1: 067b4c3661c6a97f88ff34072107ee601e782183
User & Date: mrwellan on 2018-02-04 21:13:26
Other Links: branch diff | manifest | tags
Context
2018-02-04
23:10
lowered priority on some messages from get/write info. Fixed variable name. check-in: 3321c2c522 user: matt tags: v1.65
21:13
Use the hostname for host load cache when running get load locally. check-in: 067b4c3661 user: mrwellan tags: v1.65
2018-02-03
22:11
Added general small data caching mechanism and setup for caching normalized cpu load check-in: cd9d9347c2 user: matt tags: v1.65
Changes

Modified common.scm from [a8b0c022e5] to [d0d48bccf9].

1470
1471
1472
1473
1474
1475
1476
1477

1478
1479
1480
1481
1482
1483
1484
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")
  (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
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)))))
		    (common:write-cached-info remote-host "normalized-load" result)
					(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)))