Megatest

Check-in [922bad348b]
Login
Overview
Comment:Added more info to the graph spec page
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.61
Files: files | file ages | folders
SHA1: 922bad348b529217029f02c2dc60a299c51c96fd
User & Date: mrwellan on 2016-07-26 09:46:37
Other Links: branch diff | manifest | tags
Context
2016-07-26
16:22
Added first point check-in: 34979b6b32 user: mrwellan tags: v1.61
09:46
Added more info to the graph spec page check-in: 922bad348b user: mrwellan tags: v1.61
02:26
Almost useful now check-in: 46fe8c7d3d user: matt tags: v1.61
Changes

Modified dashboard.scm from [643a6831c5] to [7ee7c0b41a].

2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633

2634


2635
2636
2637
2638
2639
2640
2641


2642
2643
2644


2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655

2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672

2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
  (let* ((parts (string-split dbstr ":"))
	 (dbpth (if (< (length parts) 2) ;; assume then a filename was provided
		    dbstr
		    (if (equal? (car parts) "sqlite3")
			(cadr parts)
			(begin
			  (debug:print 0 *default-log-port* "ERROR: I only know sqlite3 databases for now: " dbstr)
			  (cadr parts))))))
    (if (file-read-access? dbpth)
	(let ((db (sqlite3:open-database dbpth))) ;; (open-database dbpth)))
	  (sqlite3:set-busy-handler! db (make-busy-timeout 10000))
	  db))))




(define (dboard:graph-read-data cmdstring tstart tend)
  (let* ((parts (string-split cmdstring))) ;; spaces not allowed
    (if (< (length parts) 4) ;; sqlite3:path tablename timefieldname field1 field2 ...
	(debug:print 0 *default-log-port* "ERROR: malformed graph line: " cmdstring)
	(let* ((dbdef  (car parts))
	       (tablen (cadr parts))
	       (timef  (caddr parts))


	       (fields (cdddr parts))
	       (db     (dboard:graph-db-open dbdef))
	       (res    (make-hash-table)))


	  (for-each
	   (lambda (fieldname) ;; fields
	     (let ((qrystr (conc "SELECT " timef ",var,val FROM " tablen " WHERE var='" fieldname "' AND " timef " >= " tstart " AND " timef " <= " tend " ORDER BY " timef " ASC")))
	       (print "qrystr: " qrystr)
	       (hash-table-set! res fieldname ;; (fetch-rows (sql db qrystr)))))
				(sqlite3:fold-row
				 (lambda (res t var val)
				   (cons (vector t var val) res))
				 '() db qrystr))))
	   fields)
	  res))))

	  
;; graph data 
;;  tsc=timescale, tfn=function; time->x
;;
(define (dboard:graph commondat tabdat tabnum llx lly ulx uly tstart tend tsc tfn compname cmargin)
  (let* ((dwg (dboard:tabdat-drawing tabdat))
	 (lib (vg:get/create-lib dwg "runslib"))
	 (cnv (dboard:tabdat-cnv tabdat))
	 (dur (- tstart tend)) ;; time duration
	 (cmp (vg:get-component dwg "runslib" compname))
	 (cfg (configf:get-section *configdat* "graph")))
    (vg:add-obj-to-comp
     cmp 
     (vg:make-rect-obj llx lly ulx uly))
    (for-each 
     (lambda (cf)
       (let* ((alldat  (dboard:graph-read-data (cadr cf) tstart tend)))

	 (for-each
	  (lambda (fieldn)
	    (let* ((dat     (hash-table-ref alldat fieldn ))
		   (vals    (map (lambda (x)(vector-ref x 2)) dat)))
	      (if (not (null? vals))
		  (let* ((maxval  (apply max vals))
			 (minval  (apply min vals))
			 (yoff    (- lly minval))
			 (yscale  (/ (- maxval minval)(- uly lly)))
			 (yfunc   (lambda (y)(* (+ y yoff) yscale))))
		    ;; (print (car cf) ": " (hash-table->alist
		    (for-each
		     (lambda (dpt)
		       (let* ((tval  (vector-ref dpt 0))
			      (yval  (vector-ref dpt 2))
			      (stval (tfn tval))
			      (syval (yfunc yval)))
			 (vg:add-obj-to-comp
			  cmp 
			  (vg:make-rect-obj (- stval 2) lly (+ stval 2)(+ lly (* yval yscale))
					    fill-color: (vg:rgb->number 50 50 50)))))
		     dat))))) ;; for each data point in the series
	  (hash-table-keys alldat))))
     cfg)))
	 

;; run times tab
;;
(define (dashboard:run-times-tab-layout-updater commondat tabdat tab-num)
  ;; each test is an object in the run component







|
|


|
>

>
>


|

|
|
|
>
>
|


>
>
|
|
|
|
|
|
|
|
|
|
|
>
|
















>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
  (let* ((parts (string-split dbstr ":"))
	 (dbpth (if (< (length parts) 2) ;; assume then a filename was provided
		    dbstr
		    (if (equal? (car parts) "sqlite3")
			(cadr parts)
			(begin
			  (debug:print 0 *default-log-port* "ERROR: I only know sqlite3 databases for now: " dbstr)
			  #f)))))
    (if (and dbpth (file-read-access? dbpth))
	(let ((db (sqlite3:open-database dbpth))) ;; (open-database dbpth)))
	  (sqlite3:set-busy-handler! db (make-busy-timeout 10000))
	  db)
	#f)))

;; sqlite3:path tablename timefieldname varfieldname field1 field2 ...
;;
(define (dboard:graph-read-data cmdstring tstart tend)
  (let* ((parts (string-split cmdstring))) ;; spaces not allowed
    (if (< (length parts) 6) ;; sqlite3:path tablename timefieldname varfname valfname field1 field2 ...
	(debug:print 0 *default-log-port* "ERROR: malformed graph line: " cmdstring)
	(let* ((dbdef  (list-ref parts 0))
	       (tablen (list-ref parts 1))
	       (timef  (list-ref parts 2))
	       (varfn  (list-ref parts 3))
	       (valfn  (list-ref parts 4))
	       (fields (cdr  (cddddr parts)))
	       (db     (dboard:graph-db-open dbdef))
	       (res    (make-hash-table)))
	  (if db
	      (begin
		(for-each
		 (lambda (fieldname) ;; fields
		   (let ((qrystr (conc "SELECT " timef "," varfn "," valfn " FROM " tablen " WHERE " varfn "='" fieldname "' AND " timef " >= " tstart " AND " timef " <= " tend " ORDER BY " timef " ASC")))
		     (print "qrystr: " qrystr)
		     (hash-table-set! res fieldname ;; (fetch-rows (sql db qrystr)))))
				      (sqlite3:fold-row
				       (lambda (res t var val)
					 (cons (vector t var val) res))
				       '() db qrystr))))
		 fields)
		res)
	      #f)))))
  
;; graph data 
;;  tsc=timescale, tfn=function; time->x
;;
(define (dboard:graph commondat tabdat tabnum llx lly ulx uly tstart tend tsc tfn compname cmargin)
  (let* ((dwg (dboard:tabdat-drawing tabdat))
	 (lib (vg:get/create-lib dwg "runslib"))
	 (cnv (dboard:tabdat-cnv tabdat))
	 (dur (- tstart tend)) ;; time duration
	 (cmp (vg:get-component dwg "runslib" compname))
	 (cfg (configf:get-section *configdat* "graph")))
    (vg:add-obj-to-comp
     cmp 
     (vg:make-rect-obj llx lly ulx uly))
    (for-each 
     (lambda (cf)
       (let* ((alldat  (dboard:graph-read-data (cadr cf) tstart tend)))
	 (if alldat
	     (for-each
	      (lambda (fieldn)
		(let* ((dat     (hash-table-ref alldat fieldn ))
		       (vals    (map (lambda (x)(vector-ref x 2)) dat)))
		  (if (not (null? vals))
		      (let* ((maxval  (apply max vals))
			     (minval  (apply min vals))
			     (yoff    (- lly minval))
			     (yscale  (/ (- maxval minval)(- uly lly)))
			     (yfunc   (lambda (y)(* (+ y yoff) yscale))))
			;; (print (car cf) ": " (hash-table->alist
			(for-each
			 (lambda (dpt)
			   (let* ((tval  (vector-ref dpt 0))
				  (yval  (vector-ref dpt 2))
				  (stval (tfn tval))
				  (syval (yfunc yval)))
			     (vg:add-obj-to-comp
			      cmp 
			      (vg:make-rect-obj (- stval 2) lly (+ stval 2)(+ lly (* yval yscale))
						fill-color: (vg:rgb->number 50 50 50)))))
			 dat))))) ;; for each data point in the series
	      (hash-table-keys alldat)))))
     cfg)))
	 

;; run times tab
;;
(define (dashboard:run-times-tab-layout-updater commondat tabdat tab-num)
  ;; each test is an object in the run component
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
							      text: run-full-name
							      line-color:  (vg:rgb->number  255 0 255 a: 128))))
					;  (vg:components-get-extents d1 c1)))
			    ;; this is the box around the run
			    (mutex-lock! mtx)
			    (vg:add-obj-to-comp runcomp outln)
			    (mutex-unlock! mtx)
			    (dboard:tabdat-max-row-set! tabdat (+ (dboard:tabdat-max-row tabdat) 2))
			    
			    ;; this is where we have enough info to place the graph
			    (dboard:graph commondat tabdat tab-num llx uly ulx (+ uly graph-height) run-start run-end timescale maptime run-full-name canvas-margin)

			    ;; (vg:instance-move drawing run-full-name 0 (dboard:tabdat-max-row tabdat))
			    ))
			;; end of the run handling loop 
			(if (gotoescape tabdat escape) ;; (dboard:tabdat-layout-update-ok tabdat)
			    (let ((newdoneruns (cons rundat doneruns)))
			      (if (null? runtal)
				  (begin







<
<


|







2897
2898
2899
2900
2901
2902
2903


2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
							      text: run-full-name
							      line-color:  (vg:rgb->number  255 0 255 a: 128))))
					;  (vg:components-get-extents d1 c1)))
			    ;; this is the box around the run
			    (mutex-lock! mtx)
			    (vg:add-obj-to-comp runcomp outln)
			    (mutex-unlock! mtx)


			    ;; this is where we have enough info to place the graph
			    (dboard:graph commondat tabdat tab-num llx uly ulx (+ uly graph-height) run-start run-end timescale maptime run-full-name canvas-margin)
			    (dboard:tabdat-max-row-set! tabdat (+ (dboard:tabdat-max-row tabdat)(quotient (+ graph-height 40) row-height)))
			    ;; (vg:instance-move drawing run-full-name 0 (dboard:tabdat-max-row tabdat))
			    ))
			;; end of the run handling loop 
			(if (gotoescape tabdat escape) ;; (dboard:tabdat-layout-update-ok tabdat)
			    (let ((newdoneruns (cons rundat doneruns)))
			      (if (null? runtal)
				  (begin

Modified tests/fullrun/megatest.config from [18954d97bb] to [73b1295a6b].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[fields]
sysname TEXT
fsname TEXT
datapath TEXT

[graph]
g1 sqlite3:../../example.db alldat event_time stuff

# refareas can be searched to find previous runs
# the path points to where megatest.db exists
[refareas]
area1 /tmp/oldarea/megatest

[include ./configs/mt_include_1.config]






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
[fields]
sysname TEXT
fsname TEXT
datapath TEXT

[graph]
g1 sqlite3:../../example.db alldat event_time var val stuff

# refareas can be searched to find previous runs
# the path points to where megatest.db exists
[refareas]
area1 /tmp/oldarea/megatest

[include ./configs/mt_include_1.config]