| (ns knossos-bench.core | |
| (:gen-class) | |
| (:require | |
| [clojure.string] | |
| [knossos.core] | |
| [knossos.history] | |
| [knossos.model])) | |
| (defmacro bench [expr] | |
| `(let [start# (System/nanoTime) | |
| result# ~expr] | |
| {:result result# :elapsed (- (System/nanoTime) start#)})) | |
| (defn check | |
| [history] | |
| (let | |
| [history+ (knossos.history/complete history) | |
| prefix (knossos.core/linearizable-prefix (knossos.model/cas-register) history+) | |
| ok (= (count history+) (count prefix))] | |
| ok)) | |
| (defn check-time | |
| [history] | |
| (bench (check history))) | |
| (defn -main | |
| [& args] | |
| (let | |
| [filename (first args) | |
| file (slurp filename) | |
| lines (clojure.string/split-lines file) | |
| history (map load-string lines)] | |
| (println | |
| (check-time history)) | |
| (shutdown-agents))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment