#!/usr/bin/env pil
(de Mybench Prg
   (let U (usec)
      (prog1
         (run Prg 1)
         (out 2
            (prinl
               *Count
               " "
               (format (*/ (- (usec) U) 1000) 3) ) ) ) ) )

(de main ()
   (one *Count)
   (if
	   (and
         (cd "/root")
         (call 'rm '-rf 'Monocypher)
         (call 'git 'clone 'https://github.com/LoupVaillant/Monocypher)
         (cd "/root/Monocypher")

         (call 'pijul 'init '.)
         (in '(bash -c "git log -n 10 --pretty=format:\"%h:%s\" --reverse")
            (until (eof)
               (let L (line)
                  (setq Record
                     (pack
                        "pijul record -am "
                        "\""
                        (pack (head 7 L))
                        ":"
                        (pack (tail -8 L))
                        "\""
                        " 1>/dev/null 2>&1"
                     )
                  )

                  # (println 'Record Record)
                  (call 'git 'checkout '-q (pack (head 7 L)))
                  (call 'bash '-c "pijul add -r . 1>/dev/null 2>&1")
                  (Mybench (call 'sh '-c Record))

                  (inc '*Count)
               ) # let
            ) # until
         ) # in
      ) # and
	   (msg "ok")
	   (msg "fail")
	)
	(bye)
)