Megatest

Check-in [bfecdf8412]
Login
Overview
Comment:Added text to lower-left on boxes (default location)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.61
Files: files | file ages | folders
SHA1: bfecdf8412ff212e17097585df0f861bdb145dcd
User & Date: mrwellan on 2016-07-18 15:11:17
Other Links: branch diff | manifest | tags
Context
2016-07-18
22:51
Basic addition of tree check-in: 313da35cc0 user: matt tags: v1.61
15:11
Added text to lower-left on boxes (default location) check-in: bfecdf8412 user: mrwellan tags: v1.61
2016-07-17
15:21
Added labels to the runs in run-times check-in: 497e6b28c3 user: matt tags: v1.61
Changes

Modified dashboard.scm from [b7658d69d4] to [75bd4420f9].

198
199
200
201
202
203
204
205




206
207
208
209
210
211
212
198
199
200
201
202
203
204

205
206
207
208
209
210
211
212
213
214
215







-
+
+
+
+







  states 
  status-ignore-hash
  statuses
  target
  test-patts
  tests
  tests-tree
  tot-runs   
  tot-runs
  view-changed
  xadj
  yadj
  )

(define (dboard:tabdat-target-string vec)
  (let ((targ (dboard:tabdat-target vec)))
    (if (list? targ)(string-intersperse targ "/") "no-target-specified")))

(define (dboard:tabdat-test-patts-use vec)    
236
237
238
239
240
241
242



243
244
245
246
247
248
249
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255







+
+
+







	      run-ids:              (make-hash-table)
	      run-keys:             (make-hash-table)
	      searchpatts:          (make-hash-table)
	      start-run-offset:     0
	      start-test-offset:    0
	      state-ignore-hash:    (make-hash-table)
	      status-ignore-hash:   (make-hash-table)
	      xadj:                 0
	      yadj:                 0
	      view-changed:         #t
	      )))
    (dboard:setup-tabdat dat)
    (dboard:setup-num-rows dat)
    dat))

(define (dboard:setup-tabdat tabdat)
  (dboard:tabdat-dbdir-set! tabdat (db:dbfile-path #f)) ;; (conc (configf:lookup *configdat* "setup" "linktree") "/.db"))
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036










1037
1038
1039


1040
1041
1042
1043
1044


1045
1046
1047
1048
1049
1050
1051
1033
1034
1035
1036
1037
1038
1039



1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057


1058
1059
1060
1061
1062
1063
1064
1065
1066







-
-
-
+
+
+
+
+
+
+
+
+
+



+
+



-
-
+
+







		     #:scrollbar "YES"
		     #:posx "0.5"
		     #:posy "0.5"
		     #:action (make-canvas-action
			       (lambda (c xadj yadj)
				 (if (not (dboard:tabdat-cnv tabdat))
				     (dboard:tabdat-cnv-set! tabdat c))
				 (let ((drawing (dboard:tabdat-drawing tabdat)))
				   #f ;; finish me!!
				   )))
				 (let ((drawing (dboard:tabdat-drawing tabdat))
				       (old-xadj (dboard:tabdat-xadj   tabdat))
				       (old-yadj (dboard:tabdat-yadj   tabdat)))
				   (if (not (and (eq? xadj old-xadj)(eq? yadj old-yadj)))
				       (begin
					 (print  "xadj: " xadj " yadj: " yadj "changed: "(eq? xadj old-xadj) " " (eq? yadj old-yadj))
					 (dboard:tabdat-view-changed-set! tabdat #t)
					 (dboard:tabdat-xadj-set! tabdat (* -500 (- xadj 0.5)))
					 (dboard:tabdat-yadj-set! tabdat (*  500 (- yadj 0.5)))
					 )))))
		     #:wheel-cb (lambda (obj step x y dir) ;; dir is 4 for up and 5 for down. I think.
				  (let* ((drawing (dboard:tabdat-drawing tabdat))
					 (scalex  (vg:drawing-scalex drawing)))
				    (dboard:tabdat-view-changed-set! tabdat #t)
				    (print "step: " step " x: " x " y: " y " dir: " dir " scalex: " scalex)
				    (vg:drawing-scalex-set! drawing
							    (+ scalex
							       (if (> step 0)
								   (* scalex 0.01)
								   (* scalex -0.01))))))
								   (* scalex  0.02)
								   (* scalex -0.02))))))
		     )))
       cnv-obj))))

;;======================================================================
;; S U M M A R Y 
;;======================================================================
;;
1907
1908
1909
1910
1911
1912
1913
1914

1915
1916
1917




1918


1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936

1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954

1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968



1969
1970



1971
1972
1973
1974
1975
1976
1977
1922
1923
1924
1925
1926
1927
1928

1929



1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953

1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971

1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983



1984
1985
1986


1987
1988
1989
1990
1991
1992
1993
1994
1995
1996







-
+
-
-
-
+
+
+
+

+
+

















-
+

















-
+











-
-
-
+
+
+
-
-
+
+
+








(define (dashboard:run-times-tab-updater commondat tab-num)
  ;; each test is an object in the run component
  ;; each run is a component
  ;; all runs stored in runslib library
  (let ((tabdat        (dboard:common-get-tabdat commondat tab-num: tab-num))
	(canvas-margin 10)
	(start-row     0)) ;; each run starts in this row
	(start-row     0) ;; each run starts in this row
    (if tabdat
	(let* ((row-height 20)
	       (drawing    (dboard:tabdat-drawing tabdat))
	(row-height    10))
    (if (and tabdat
	     (dboard:tabdat-view-changed tabdat))
	(let* ((drawing    (dboard:tabdat-drawing tabdat))
	       (runslib    (vg:get/create-lib drawing "runslib"))) ;; creates and adds lib
	  (vg:drawing-xoff-set! drawing (dboard:tabdat-xadj tabdat))
	  (vg:drawing-yoff-set! drawing (dboard:tabdat-yadj tabdat))
	  (update-rundat tabdat
			 "%" ;; (hash-table-ref/default (dboard:tabdat-searchpatts tabdat) "runname" "%") 
			 100  ;; (dboard:tabdat-numruns tabdat)
			 "%" ;; (hash-table-ref/default (dboard:tabdat-searchpatts tabdat) "test-name" "%/%")
			 ;; (hash-table-ref/default (dboard:tabdat-searchpatts tabdat) "item-name" "%")
			 (let ((res '()))
			   (for-each (lambda (key)
				       (if (not (equal? key "runname"))
					   (let ((val (hash-table-ref/default (dboard:tabdat-searchpatts tabdat) key #f)))
					     (if val (set! res (cons (list key val) res))))))
				     (dboard:tabdat-dbkeys tabdat))
			   res))
	  (let ((allruns (dboard:tabdat-allruns tabdat))
		(rowhash (make-hash-table)) ;; store me in tabdat
		(cnv     (dboard:tabdat-cnv tabdat)))
	    (let-values (((sizex sizey sizexmm sizeymm) (canvas-size cnv))
			 ((originx originy)             (canvas-origin cnv)))
	      (print "allruns: " allruns)
	      ;; (print "allruns: " allruns)
	      (for-each
	       (lambda (rundat)
		 (if (vector? rundat)
		     (let* ((run      (vector-ref rundat 0))
			    (testsdat  (sort (vector-ref rundat 1)
					     (lambda (a b)
					       (< (db:test-get-event_time a)
						  (db:test-get-event_time b)))))
			    (key-val-dat (vector-ref rundat 2))
			    (run-id   (db:get-value-by-header run (dboard:tabdat-header tabdat) "id"))
			    (key-vals (append key-val-dat
					      (list (let ((x (db:get-value-by-header run (dboard:tabdat-header tabdat) "runname")))
						      (if x x "")))))
			    (run-key  (string-intersperse key-vals "\n"))
			    (run-full-name (string-intersperse key-vals "/"))
			    (runcomp  (vg:comp-new));; new component for this run
			    (rows-used (make-hash-table)) ;; keep track of what parts of the rows are used here row1 = (obj1 obj2 ...)
			    (row-height 4)
			    ;; (row-height 4)
			    (run-start  (apply min (map db:test-get-event_time testsdat)))
			    (run-end    (apply max (map (lambda (t)(+ (db:test-get-event_time t)(db:test-get-run_duration t))) testsdat)))
			    (timeoffset (- (+ originx canvas-margin) run-start))
			    (run-duration (- run-end run-start))
			    (timescale  (/ (- sizex (* 2 canvas-margin))
					   (if (> run-duration 0)
					       run-duration
					       (current-seconds)))) ;; a least lously guess
			    (maptime    (lambda (tsecs)(* timescale (+ tsecs timeoffset)))))
		       ;; (print "timescale: " timescale " timeoffset: " timeoffset " sizex: " sizex " originx: " originx)
		       (vg:add-comp-to-lib runslib run-full-name runcomp)
		       (vg:add-objs-to-comp runcomp (vg:make-text 
						     10
						     (- sizey (* start-row row-height))
		       (set! start-row (+ start-row 1))
		       (let ((x 10)
			     (y (- sizey (* start-row row-height))))
						     run-full-name
						     font: "Helvetica -10"))
			 (vg:add-objs-to-comp runcomp (vg:make-text x y run-full-name font: "Helvetica -10"))
			 (dashboard:add-bar rowhash start-row x (+ x 100)))
		       (set! start-row (+ start-row 1))
		       ;; get tests in list sorted by event time ascending
		       (for-each 
			(lambda (testdat)
			  (let* ((event-time   (maptime (db:test-get-event_time   testdat)))
				 (run-duration (* timescale (db:test-get-run_duration testdat)))
				 (end-time     (+ event-time run-duration))
				 (test-name    (db:test-get-testname     testdat))
1985
1986
1987
1988
1989
1990
1991
1992
1993


1994
1995








1996
1997
1998
1999
2000
2001
2002
2004
2005
2006
2007
2008
2009
2010


2011
2012


2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027







-
-
+
+
-
-
+
+
+
+
+
+
+
+







			    (let loop ((rownum start-row)) ;; (+ start-row 1)))
			      (set! start-row (max rownum start-row)) ;; track the max row used
			      (if (dashboard:row-collision rowhash rownum event-time end-time)
				  (loop (+ rownum 1))
				  (let* ((lly (- sizey (* rownum row-height)))
					 (uly (+ lly row-height)))
				    (dashboard:add-bar rowhash rownum event-time end-time)
				    (vg:add-objs-to-comp runcomp (vg:make-rect event-time lly end-time uly
									       fill-color: 
				    (vg:add-objs-to-comp runcomp
							 (vg:make-rect event-time lly end-time uly
									       ;; (string->number (string-substitute " " "" (car name-color))))))))
									       (vg:iup-color->number (car name-color)))))))
								       fill-color: (vg:iup-color->number (car name-color))
								       text: (conc test-name "/" item-path)
								       font: "Helvetica -10")
							 ;; (vg:make-text (+ event-time 2)
							 ;;               (+ lly 2)
							 ;;               (conc test-name "/" item-path)
							 ;;               font: "Helvetica -10")
							 ))))
			    ;; (print "test-name: " test-name " event-time: " event-time " run-duration: " run-duration)
			    ))
			testsdat)
		       ;; instantiate the component 
		       (let* ((extents (vg:components-get-extents drawing runcomp))
			      (llx     (list-ref extents 0))
			      (lly     (list-ref extents 1))
2011
2012
2013
2014
2015
2016
2017
2018


2019
2020
2021
2022
2023
2024
2025
2036
2037
2038
2039
2040
2041
2042

2043
2044
2045
2046
2047
2048
2049
2050
2051







-
+
+







			 (print " run-full-name: " run-full-name)
			 ;; (vg:instantiate drawing "runslib" run-full-name "wrongname" offx 0))))) 
			 (vg:instantiate drawing "runslib" run-full-name run-full-name 0 0))))) 
			;;		 scalex: scalex scaley: 1)))))
	       allruns)
	      (vg:drawing-cnv-set! (dboard:tabdat-drawing tabdat)(dboard:tabdat-cnv tabdat)) ;; cnv-obj)
	      (canvas-clear! (dboard:tabdat-cnv tabdat)) ;; -obj)
	      (print "All objs: " (vg:draw (dboard:tabdat-drawing tabdat) #t))
	      (print "Number of objs: " (length (vg:draw (dboard:tabdat-drawing tabdat) #t)))
	      (dboard:tabdat-view-changed-set! tabdat #f)
	      )))
	(print "no tabdat for run-times-tab-updater"))))

(define (dashboard:runs-tab-updater commondat tab-num)
  (let ((tabdat (dboard:common-get-tabdat commondat tab-num: tab-num)))
    (update-rundat tabdat (hash-table-ref/default (dboard:tabdat-searchpatts tabdat) "runname" "%") (dboard:tabdat-numruns tabdat)
		   (hash-table-ref/default (dboard:tabdat-searchpatts tabdat) "test-name" "%/%")

Modified vg-test.scm from [cf20aed8f3] to [f9d534031a].

9
10
11
12
13
14
15
16
17


18
19
20
21
22
23
24
9
10
11
12
13
14
15


16
17
18
19
20
21
22
23
24







-
-
+
+







 vg:grow-rect
 vg:components-get-extents)

(define d1 (vg:drawing-new))
(define l1 (vg:lib-new))
(define c1 (vg:comp-new))
(define c2 (vg:comp-new))
(let ((r1 (vg:make-rect 20 20 40 40))
      (r2 (vg:make-rect 40 40 80 80))
(let ((r1 (vg:make-rect 20 20 40 40 text: "r1" font: "Helvetica, -20"))
      (r2 (vg:make-rect 40 40 80 80 text: "r2" font: "Helvetica, -10"))
      (t1 (vg:make-text 40 40 "The middle" font: "Helvetica, -10")))
  (vg:add-objs-to-comp c1 r1 r2 t1))

;; add the c1 component to lib l1 with name firstcomp
(vg:add-comp-to-lib l1 "firstcomp" c1)
(vg:add-comp-to-lib l1 "secondcomp" c2)

Modified vg.scm from [db56d4940e] to [a343609fb9].

97
98
99
100
101
102
103
104
105


106
107
108
109
110
111
112
97
98
99
100
101
102
103


104
105
106
107
108
109
110
111
112







-
-
+
+








;;   (vg:inst-apply-scale 
;;    inst
;;    (vg:drawing-apply-scale drawing lstxy)))

;; make a rectangle obj
;;
(define (vg:make-rect x1 y1 x2 y2 #!key (line-color #f)(fill-color #f))
  (make-vg:obj type: 'r pts: (list x1 y1 x2 y2) text: #f line-color: line-color fill-color: fill-color))
(define (vg:make-rect x1 y1 x2 y2 #!key (line-color #f)(fill-color #f)(text #f)(font #f))
  (make-vg:obj type: 'r pts: (list x1 y1 x2 y2) text: text font: font line-color: line-color fill-color: fill-color))

;; make a text obj
;;
(define (vg:make-text x1 y1 text #!key (line-color #f)(fill-color #f)
		      (angle #f)(scale-with-zoom #f)(font #f)
		      (font-size #f))
  (make-vg:obj type: 't pts: (list x1 y1) text: text 
226
227
228
229
230
231
232
233

234
235
236
237
238
239
240
226
227
228
229
230
231
232

233
234
235
236
237
238
239
240







-
+







    ((r)(vg:map-rect drawing inst obj))
    ((t)(vg:map-text drawing inst obj))
    (else #f)))

;; given a drawing and a inst map a rectangle to it screen coordinates
;;
(define (vg:map-rect drawing inst obj)
  (let ((res (make-vg:obj type:       'r
  (let ((res (make-vg:obj type:       'r ;; is there a defstruct copy?
			  fill-color: (vg:obj-fill-color obj)
			  text:       (vg:obj-text       obj)
			  line-color: (vg:obj-line-color obj)
			  font:       (vg:obj-font       obj)))
	(pts (vg:obj-pts obj)))
    (vg:obj-pts-set! res (vg:drawing-inst-apply-scale-offset drawing inst pts))
    (vg:drawing-cache-set! drawing (cons res (vg:drawing-cache drawing) ))
309
310
311
312
313
314
315


316
317
318
319
320
321






322
323
324
325
326
327
328
329
330
331
332
333
334







335
336
337
338
339
340
341
309
310
311
312
313
314
315
316
317






318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335

336
337
338
339
340
341
342
343
344
345
346
347
348
349







+
+
-
-
-
-
-
-
+
+
+
+
+
+












-
+
+
+
+
+
+
+







;; scale and offset
;;
(define (vg:draw-rect drawing obj #!key (draw #t))
  (let* ((cnv (vg:drawing-cnv drawing))
	 (pts (vg:drawing-apply-scale drawing (vg:obj-pts obj)))
	 (fill-color (vg:obj-fill-color obj))
	 (line-color (vg:obj-line-color obj))
	 (text       (vg:obj-text obj))
	 (font       (vg:obj-font obj))
	 (llx (car pts))
	 (lly (cadr pts))
	 (ulx (caddr pts))
	 (uly (cadddr pts))
	 (w   (- ulx llx))
	 (h   (- uly lly)))
	 (llx        (car pts))
	 (lly        (cadr pts))
	 (ulx        (caddr pts))
	 (uly        (cadddr pts))
	 (w          (- ulx llx))
	 (h          (- uly lly)))
    (if draw 
	(let ((prev-background-color (canvas-background cnv))
	      (prev-foreground-color (canvas-foreground cnv)))
	  (if fill-color
	      (begin
		(canvas-foreground-set! cnv fill-color)
		(canvas-box! cnv llx ulx lly uly))) ;; docs are all over the place on this one.;; w h)
	  (if line-color
	      (canvas-foreground-set! cnv line-color)
	      (if fill-color
		  (canvas-foreground-set! cnv prev-foreground-color)))
	  (canvas-rectangle! cnv llx ulx lly uly)
	  (canvas-foreground-set! cnv prev-foreground-color)))
	  (canvas-foreground-set! cnv prev-foreground-color)
	  (if text 
	      (let* ((prev-font    (canvas-font cnv))
		     (font-changed (and font (not (equal? font prev-font)))))
		(if font-changed (canvas-font-set! cnv font))
		(canvas-text! cnv (+ 2 llx)(+ 2 lly) text)
		(if font-changed (canvas-font-set! cnv prev-font))))))
    pts)) ;; return extents 

;; given a rect obj draw it on the canvas applying first the drawing
;; scale and offset
;;
(define (vg:draw-text drawing obj #!key (draw #t))
  (let* ((cnv        (vg:drawing-cnv drawing))