File: valcall.scm

package info (click to toggle)
snd 26.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 44,044 kB
  • sloc: ansic: 291,996; lisp: 260,569; ruby: 71,134; sh: 3,293; fortran: 2,342; csh: 1,067; cpp: 294; makefile: 294; python: 87; xml: 27; javascript: 1
file content (155 lines) | stat: -rw-r--r-- 4,852 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
;;; reset names: back-to-v-10

(define file-names '(("cb.scm" . "v-cb")
		     ("concordance.scm" . "v-str")
		     ("dup.scm" . "v-dup")
		     ("fbench.scm" . "v-fb")
		     ("full-snd-test.scm" . "v-sg")
		     ("lt.scm" . "v-lt")
		     ("make-index.scm" . "v-index")
		     ("s7test.scm" . "v-test")
		     ("snd-test.scm" . "v-call")
		     ("tall.scm" . "v-all")
		     ("tari.scm" . "v-ari")
		     ("tauto.scm" . "v-auto")
		     ("tbig.scm" . "v-big")
		     ("tbit.scm" . "v-bit")
		     ("tcase.scm" . "v-case")
		     ("tclo.scm" . "v-clo")
		     ("tcomplex.scm" . "v-complex")
		     ("tcopy.scm" . "v-cop")
		     ("teq.scm" . "v-eq")
		     ("test-all.scm" . "v-b")
		     ("texit.scm" . "v-exit")
		     ("tfft.scm" . "v-fft")
		     ("tform.scm" . "v-form")
		     ("tgc.scm" . "v-gc")
		     ("tgen.scm" . "v-gen")
		     ("tgsl.scm" . "v-gsl")
		     ("thash.scm" . "v-hash")
		     ("thook.scm" . "v-hook")
		     ("timp.scm" . "v-imp")
		     ("tio.scm" . "v-io")
		     ("titer.scm" . "v-iter")
		     ("tlamb.scm" . "v-lamb")
		     ("tleft.scm" . "v-left")
		     ("tlet.scm" . "v-let")
		     ("tlimit.scm" . "v-limit")
		     ("tlist.scm" . "v-list")
		     ("tload.scm" . "v-load")
		     ("tmac.scm" . "v-mac")
		     ("tmap-hash.scm" . "v-map-hash")
		     ("tmap.scm" . "v-map")
		     ("tmat.scm" . "v-mat")
		     ("tmisc.scm" . "v-misc")
		     ("tmock.scm" . "v-mock")
		     ("tmv.scm" . "v-mv")
		     ("tnum.scm" . "v-num")
		     ("tobj.scm" . "v-obj")
		     ("tpeak.scm" . "v-peak")
		     ("trclo.scm" . "v-rclo")
		     ("tread.scm" . "v-read")
		     ("trec.scm" . "v-rec")
		     ("tref.scm" . "v-ref")
		     ("tset.scm" . "v-set")
		     ("tshoot.scm" . "v-shoot")
		     ("tsort.scm" . "v-sort")
		     ("tstar.scm" . "v-star")
		     ("tvect.scm" . "v-vect")
		     ))

(define (last-callg)
  (let ((name (system "ls callg*" #t)))
    (let ((len (length name)))
      (do ((i 0 (+ i 1)))
	  ((or (= i len)
	       (char-whitespace? (name i)))
	   (substring name 0 i))))))

(define (next-file f)
  (let ((name (system (format #f "ls -t ~A*" f) #t)))
    (let ((len (length name)))
      (do ((i 0 (+ i 1)))
	  ((or (= i len)
	       (and (char-numeric? (name i))
		    (char-numeric? (name (+ i 1)))))
	   (+ 1 (string->number (substring name i (+ i 2)))))))))

(define (call-valgrind)
  (for-each
   (lambda (caller+file)
     (system "rm callg*")
     (format *stderr* "~%~NC~%~NC ~A ~NC~%~NC~%" 40 #\- 16 #\- (cadr caller+file) 16 #\- 40 #\-)
     (system (format #f "valgrind --tool=callgrind ./~A ~A" (car caller+file) (cadr caller+file)))

     (let ((outfile (cdr (assoc (cadr caller+file) file-names))))
       (let ((next (next-file outfile)))
	 (system (format #f "callgrind_annotate --auto=yes --show-percs=no --threshold=100 ~A > ~A~D" (last-callg) outfile next))
	 (format *stderr* "~NC ~A~D -> ~A~D: ~NC~%" 8 #\space outfile (- next 1) outfile next 8 #\space)
	 (system (format #f "./snd compare-calls.scm -e '(compare-calls \"~A~D\" \"~A~D\")'" outfile (- next 1) outfile next)))))

   (list (list "repl" "tpeak.scm")
	 (list "repl" "tref.scm")
	 (list "repl" "tlimit.scm")
	 (list "snd -noinit" "make-index.scm")
	 (list "repl" "tmock.scm")
	 (list "repl" "tvect.scm")
	 (list "repl" "thook.scm")
	 (list "repl" "tauto.scm")
	 (list "repl" "texit.scm")
	 (list "repl" "lt.scm")
	 (list "repl" "s7test.scm")
	 (list "repl" "dup.scm")
	 (list "repl" "tread.scm")
	 (list "repl" "tcopy.scm")
	 (list "repl" "trclo.scm")
	 (list "repl" "fbench.scm")
	 (list "repl" "tmat.scm")
	 (list "repl" "tload.scm")
	 (list "repl" "tsort.scm")
	 (list "repl" "titer.scm")
	 (list "repl" "tio.scm")
	 (list "repl" "tbit.scm")
	 (list "repl" "teq.scm")
	 (list "repl" "tobj.scm")
	 (list "repl" "tmac.scm")
	 (list "repl" "tcomplex.scm")
	 (list "repl" "tmap.scm")
	 (list "repl" "tcase.scm")
	 (list "repl" "tlet.scm")
	 (list "repl" "tfft.scm")
	 (list "repl" "tshoot.scm")
	 (list "repl" "tstar.scm")
	 (list "repl" "tnum.scm")
	 (list "repl" "concordance.scm")
	 (list "repl" "tlist.scm")
	 (list "repl" "trec.scm")
	 (reader-cond ((not (provided? 'gmp)) (list "repl" "tari.scm")))
	 (list "repl" "tgc.scm")
	 (list "repl" "tgsl.scm")
	 (list "repl" "tset.scm")
	 (list "repl" "tleft.scm")
	 (list "repl" "tmisc.scm")
	 (list "repl" "tclo.scm")
	 (list "repl" "tlamb.scm")
	 (list "repl" "tform.scm")
	 (list "repl" "thash.scm")
	 (list "repl" "cb.scm")
	 (list "repl" "tmap-hash.scm")
	 (list "snd -noinit" "tgen.scm")    ; repl here + cload sndlib was slower
	 (list "snd -noinit" "tall.scm")
	 (list "repl" "timp.scm")
	 (list "repl" "tmv.scm")
	 (list "snd -l" "snd-test.scm")
	 (list "snd -l" "full-snd-test.scm")
	 (list "repl" "tbig.scm")
	 )))

(call-valgrind)

(when (file-exists? "test.table")
  (system "mv test.table old-test.table"))
(load "compare-calls.scm")
(combine-latest)

(exit)