summaryrefslogtreecommitdiff
path: root/ebus-racket/debug_db/test.rkt
blob: c180058c1623503cfe437a5fe36a01c5c87fc2d6 (plain)
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
#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)