39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
extras
hostinfo
ports
posix
files
data-structures
tcp
))
(chicken-5
(import chicken.base
chicken.condition
chicken.file
chicken.pathname
|
>
|
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
extras
hostinfo
ports
posix
files
data-structures
directory-utils
tcp
))
(chicken-5
(import chicken.base
chicken.condition
chicken.file
chicken.pathname
|
1126
1127
1128
1129
1130
1131
1132
1133
1134
|
(sort (get-all-ips) ip-pref-less?))
(define (get-all-ips)
(map address-info-host
(filter (lambda (x)
(equal? (address-info-type x) "tcp"))
(address-infos (get-host-name)))))
)
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
|
(sort (get-all-ips) ip-pref-less?))
(define (get-all-ips)
(map address-info-host
(filter (lambda (x)
(equal? (address-info-type x) "tcp"))
(address-infos (get-host-name)))))
;;======================================================================
;; Other Utils
;;======================================================================
;; 1.db => (10 . 9) ;; (total . hits)
(define *journal-stats* (make-hash-table))
;; monte-carlo-esque random sampling of journal files
;; for all the files:
;; if .journal
;; update stats +1 +1
;; update stats +1 0
;;
(define (tt:write-load-tracking dbdir)
(let* ((cs (current-seconds))
(key (inexact->exact (quotient cs 10))))
(directory-fold
dbdir
(lambda (res fname)
(cons fname res))
'())))
)
|