Megatest

Check-in [7953e9dc31]
Login
Overview
Comment:Added utility for testing chicken scheme memory allocation
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.65
Files: files | file ages | folders
SHA1: 7953e9dc317d38b0b7596c1249c2251c5a8528e4
User & Date: mrwellan on 2017-12-18 15:31:13
Other Links: branch diff | manifest | tags
Context
2017-12-18
15:39
Added couple lines of helpful hints in the mem allocation script check-in: 596110698a user: mrwellan tags: v1.65
15:31
Added utility for testing chicken scheme memory allocation check-in: 7953e9dc31 user: mrwellan tags: v1.65
2017-12-15
16:47
added css to static html genration check-in: 4a97fe2a81 user: pjhatwal tags: v1.65
Changes

Added utils/memproblem.scm version [42d02bf430].













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
(use posix numbers srfi-4)

(define num-iter (or (if (> (length (argv)) 2)
                        (string->number (cadr (argv)))
                        #f)
                    43)) ;; Gigs memory to try to allocate
;; (print "Allocating up to " memsize "G memory. Note that due to the usage of the heap this will actually use up to " (* 2 memsize) "G")

(define (get-free)
  (let ((indat (with-input-from-pipe
                "free"
                read-lines)))
    (map string->number
         (cdr 
          (string-split
           (cadr indat))))))

(define-inline (cached dat)(list-ref dat 5))
(define-inline (used   dat)(list-ref dat 1))
(define-inline (free   dat)(list-ref dat 2))

(define-inline (k->G val)(/ val 1e6))
(define-inline (G->k val)(* val 1e6))

(define start-time (current-milliseconds))

(let loop ((n      0)
           (dat    (get-free))
           (stuff  '()))
  (let ((bigvec (make-u32vector 200000000)))
    (print n " Elapsed time: " (/ (- (current-milliseconds) start-time) 1000) " s "
           "Cached: " (k->G (cached dat)) " G "
           "Used:   " (k->G (used   dat)) " G ")
    (if (< n num-iter)
        (loop (+ n 1)(get-free) (cons bigvec stuff)))))

(exit)