mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-08 05:27:33 +02:00
Added staging area
This commit is contained in:
parent
75b50d8269
commit
282bfc5b5a
3 changed files with 30346 additions and 0 deletions
8
tests/debug/diviter/Makefile
Normal file
8
tests/debug/diviter/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
diviter: diviter.c
|
||||||
|
cc diviter.c -O2 -fPIC -Wall -I/usr/local/include -L/usr/local/lib -Wl,--export-dynamic -c -o diviter.o
|
||||||
|
cc diviter.o /usr/local/share/cyclone/scheme/cyclone/common.o /usr/local/share/cyclone/scheme/base.o /usr/local/share/cyclone/scheme/time.o /usr/local/share/cyclone/scheme/write.o /usr/local/share/cyclone/scheme/char.o /usr/local/share/cyclone/scheme/read.o -pthread -lcyclone -lck -lm -ltommath -ldl -O2 -fPIC -Wall -I/usr/local/include -L/usr/local/lib -Wl,--export-dynamic -o diviter
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf diviter *.o
|
30240
tests/debug/diviter/diviter.c
Normal file
30240
tests/debug/diviter/diviter.c
Normal file
File diff suppressed because it is too large
Load diff
98
tests/debug/diviter/diviter.scm
Normal file
98
tests/debug/diviter/diviter.scm
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
;;; DIVITER -- Benchmark which divides by 2 using lists of n ()'s.
|
||||||
|
|
||||||
|
(import (scheme base) (scheme read) (scheme write) (scheme time))
|
||||||
|
|
||||||
|
(define (create-n n)
|
||||||
|
(do ((n n (- n 1))
|
||||||
|
(a '() (cons '() a)))
|
||||||
|
((= n 0) a)))
|
||||||
|
|
||||||
|
(define (iterative-div2 l)
|
||||||
|
(do ((l l (cddr l))
|
||||||
|
(a '() (cons (car l) a)))
|
||||||
|
((null? l) a)))
|
||||||
|
|
||||||
|
(define (main)
|
||||||
|
(let* ((count 1000000) ;(read))
|
||||||
|
(input1 1000 ) ;(read))
|
||||||
|
(output 500 ) ;(read))
|
||||||
|
(s2 (number->string count))
|
||||||
|
(s1 (number->string input1))
|
||||||
|
(ll (create-n (hide count input1)))
|
||||||
|
(name "diviter"))
|
||||||
|
(run-r7rs-benchmark
|
||||||
|
(string-append name ":" s1 ":" s2)
|
||||||
|
count
|
||||||
|
(lambda ()
|
||||||
|
(iterative-div2 ll))
|
||||||
|
(lambda (result) (equal? (length result) output)))))
|
||||||
|
|
||||||
|
;;; The following code is appended to all benchmarks.
|
||||||
|
|
||||||
|
;;; Given an integer and an object, returns the object
|
||||||
|
;;; without making it too easy for compilers to tell
|
||||||
|
;;; the object will be returned.
|
||||||
|
|
||||||
|
(define (hide r x)
|
||||||
|
(call-with-values
|
||||||
|
(lambda ()
|
||||||
|
(values (vector values (lambda (x) x))
|
||||||
|
(if (< r 100) 0 1)))
|
||||||
|
(lambda (v i)
|
||||||
|
((vector-ref v i) x))))
|
||||||
|
|
||||||
|
;;; Given the name of a benchmark,
|
||||||
|
;;; the number of times it should be executed,
|
||||||
|
;;; a thunk that runs the benchmark once,
|
||||||
|
;;; and a unary predicate that is true of the
|
||||||
|
;;; correct results the thunk may return,
|
||||||
|
;;; runs the benchmark for the number of specified iterations.
|
||||||
|
|
||||||
|
(define (run-r7rs-benchmark name count thunk ok?)
|
||||||
|
|
||||||
|
;; Rounds to thousandths.
|
||||||
|
(define (rounded x)
|
||||||
|
(/ (round (* 1000 x)) 1000))
|
||||||
|
|
||||||
|
(display "Running ")
|
||||||
|
(display name)
|
||||||
|
(newline)
|
||||||
|
(flush-output-port (current-output-port))
|
||||||
|
(let* ((j/s (jiffies-per-second))
|
||||||
|
(t0 (current-second))
|
||||||
|
(j0 (current-jiffy)))
|
||||||
|
(let loop ((i 0)
|
||||||
|
(result #f))
|
||||||
|
(cond ((< i count)
|
||||||
|
(loop (+ i 1) (thunk)))
|
||||||
|
((ok? result)
|
||||||
|
(let* ((j1 (current-jiffy))
|
||||||
|
(t1 (current-second))
|
||||||
|
(jifs (- j1 j0))
|
||||||
|
(secs (inexact (/ jifs j/s)))
|
||||||
|
(secs2 (rounded (- t1 t0))))
|
||||||
|
(display "Elapsed time: ")
|
||||||
|
(write secs)
|
||||||
|
(display " seconds (")
|
||||||
|
(write secs2)
|
||||||
|
(display ") for ")
|
||||||
|
(display name)
|
||||||
|
(newline)
|
||||||
|
(display "+!CSVLINE!+")
|
||||||
|
(display (this-scheme-implementation-name))
|
||||||
|
(display ",")
|
||||||
|
(display name)
|
||||||
|
(display ",")
|
||||||
|
(display secs)
|
||||||
|
(newline)
|
||||||
|
(flush-output-port (current-output-port)))
|
||||||
|
result)
|
||||||
|
(else
|
||||||
|
(display "ERROR: returned incorrect result: ")
|
||||||
|
(write result)
|
||||||
|
(newline)
|
||||||
|
(flush-output-port (current-output-port))
|
||||||
|
result)))))
|
||||||
|
(define (this-scheme-implementation-name)
|
||||||
|
(string-append "cyclone-" (Cyc-version)))
|
||||||
|
(main)
|
Loading…
Add table
Reference in a new issue