-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compare: Update for head-to-head comparisons
* Improve parallel algorithm so that it reports progress and displays startup and completion messages * Lookup clients in dynamic variable and minimize the creation of client instances * Use closed intervals for ranges * Use keyword arguments in float-integer/range/parallel
- Loading branch information
Showing
4 changed files
with
178 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(in-package #:quaviver/compare) | ||
|
||
(defun run-program-capture (command &key directory) | ||
"Run a program and capture the output as a string." | ||
(ignore-errors | ||
(multiple-value-bind (standard-output error-output code) | ||
(uiop:run-program command | ||
:directory directory | ||
:ignore-error-status t | ||
:output '(:string :stripped t) | ||
:error-output '(:string :stripped t)) | ||
(declare (ignore error-output)) | ||
(when (zerop code) | ||
standard-output)))) | ||
|
||
(defun cpu-count () | ||
(loop for command in #+bsd '("sysctl -n hw.physicalcpu" | ||
"sysctl -n hw.ncpu" | ||
"sysctl -n hw.ncpufound") | ||
#-bsd '("nproc --all") | ||
for output = (run-program-capture command) | ||
when output | ||
return (parse-integer output :junk-allowed t))) | ||
|
||
(defun internal-time (stream value colon at &rest args) | ||
(declare (ignore colon at args)) | ||
(multiple-value-bind (minutes seconds) | ||
(floor (floor value internal-time-units-per-second) | ||
60) | ||
(multiple-value-bind (hours minutes) | ||
(floor minutes 60) | ||
(format stream "~d:~2,'0d:~2,'0d" | ||
hours minutes seconds)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters