diff options
author | Random Hacker <random_hacker@xapek.org> | 2012-03-11 02:18:49 +0100 |
---|---|---|
committer | Random Hacker <random_hacker@xapek.org> | 2012-03-11 02:18:49 +0100 |
commit | 4fd8059dd0da27de72bbcabdda8907a65e858f92 (patch) | |
tree | aa34a7e78d49403229ce7c438af1836cfc17ad02 /ebus-racket/debug_db/test.rkt | |
parent | b5c5e835c64f0aa51387fca574b883a4228218e9 (diff) | |
download | ebus-alt-4fd8059dd0da27de72bbcabdda8907a65e858f92.tar.gz ebus-alt-4fd8059dd0da27de72bbcabdda8907a65e858f92.zip |
ebus-racket: db tests
Diffstat (limited to 'ebus-racket/debug_db/test.rkt')
-rw-r--r-- | ebus-racket/debug_db/test.rkt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ebus-racket/debug_db/test.rkt b/ebus-racket/debug_db/test.rkt new file mode 100644 index 0000000..c180058 --- /dev/null +++ b/ebus-racket/debug_db/test.rkt @@ -0,0 +1,32 @@ +#lang racket/base + +(define (benchmark func name) + (define output-file (open-output-file (string-append "benchmark_" name ".log"))) + (define (log counter) + (let ([message (format "name=~a time=~a counter=~a current-memory-use=~a~n" + name (current-milliseconds) + counter (current-memory-use))]) + (display message) + (display message output-file))) + (let loop ([counter 1]) + (let ([x (func)]) + (when (= 0 (modulo counter 500)) + (log counter)) + (when (<= counter 125000) + (loop (+ counter 1)))))) + + + +;;(require (prefix-in db: db)) (define name "db-5.2.1") +;;(require (prefix-in db: (file "~/github.com_plt_racket/collects/db/main.rkt"))) (define name "db-git-09bed0d") +(require (prefix-in db: (planet ryanc/db:1:4))) (define name "ryanc/db_1_4") + +(define pgc + (db:postgresql-connect + #:user "ebus" #:database "ebus" #:password "ebus" #:server "10.2.2.26")) + +(define (pgc-test) + (db:query-value pgc "SELECT 1")) + +(benchmark pgc-test name) + |