-
Notifications
You must be signed in to change notification settings - Fork 29
/
chart.lisp
29 lines (27 loc) · 1.01 KB
/
chart.lisp
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
(ql:quickload :adw-charting-vecto)
(ql:quickload :cl-ppcre)
(ql:quickload :local-time)
(use-package :adw-charting)
(defun make-chart ()
(let ((writes nil) (reads nil))
(with-open-file (in "stats.csv")
(do ((line (read-line in nil :eof) (read-line in nil :eof)))
((eql line :eof))
(let ((triple (cl-ppcre:split (format nil "~A" #\Tab) line)))
(push (list (parse-integer (nth 0 triple))
(parse-integer (nth 1 triple)))
writes)
(push (list (parse-integer (nth 0 triple))
(parse-integer (nth 2 triple)))
reads))))
(with-chart (:line 1600 900)
(set-axis :x "Time"
:angle t
:label-formatter
(lambda (time)
(local-time:to-rfc3339-timestring
(local-time:universal-to-timestamp time))))
(add-series "Writes" writes)
(add-series "Reads" reads)
(set-axis :y "Count")
(save-file "stats.png"))))