(setq hasMilliSecs (/= (getvar "MILLISECS") nil))
(setvar "LOGFILEMODE" 0)
(vl-load-com)

(if (and (not vle-displaypause) (findfile "vle-extension.lsp")) (load "vle-extension.lsp"))

(defun t_vle_displaypause ( count fptr / ename vlaen ptE1 ptE2 time1 time2 time3 time4 )

  (command "_zoom" "_window" "0,0" "100,100")

  ;;--- build data list
  (setq elistA '((0 . "LINE") (8 . "0") (62 . 4) (10 10 10 0) (11 90 60 0)))
  (setq ename (entmakex elistA))
  (setq vlaen (vlax-ename->vla-object ename))

  (setq ptE1 (vlax-3d-point 90 30 0))
  (setq ptE2 (vlax-3d-point 90 90 0))

  ;;--- now run test : no displayPause
  (setq time1 (getvar "MILLISECS"))
  (if (not time1) (setq time1 (getvar "TDUSRTIMER")))
  (if (not time1) (setq time1 0.0))

  (repeat (* count count)
    (vla-put-endpoint vlaen ptE1)
    (vla-put-endpoint vlaen ptE2)
  )

  (setq time2 (getvar "MILLISECS"))
  (if (not time2) (setq time2 (getvar "TDUSRTIMER")))
  (if (not time2) (setq time2 0.0))

  ;;--- now run test : using displayPause
  (vle-displaypause t)
  (setq time3 (getvar "MILLISECS"))
  (if (not time3) (setq time3 (getvar "TDUSRTIMER")))
  (if (not time3) (setq time3 0.0))

  (repeat (* count count)
    (vla-put-endpoint vlaen ptE1)
    (vla-put-endpoint vlaen ptE2)
  )
  (setq time4 (getvar "MILLISECS"))
  (if (not time4) (setq time4 (getvar "TDUSRTIMER")))
  (if (not time4) (setq time4 0.0))
  (vle-displaypause nil)

  ;;--- test results
  (setq bench$secsNorm (if hasMilliSecs (* 0.001 (- time2 time1)) (* 86400.0 (- time2 time1))))
  (setq bench$secsFast (if hasMilliSecs (* 0.001 (- time4 time3)) (* 86400.0 (- time4 time3))))
  (setq bench$seconds (+ bench$secsNorm bench$secsFast))
  ;;-----------------------------
  (entdel ename)
  ;;-----------------------------

  (princ (strcat "* (Standard) : " (rtos bench$secsNorm 2 3) "  VLE-DISPLAYPAUSE : " (rtos bench$secsFast 2 3) "\n"))
  (if fptr
    (princ (strcat "* (Standard) : " (rtos bench$secsNorm 2 3) "  VLE-DISPLAYPAUSE : " (rtos bench$secsFast 2 3) "\n") fptr)
  )

  bench$seconds
)


;; to increase/decrease the number of bench loops : > 1 increase < 1 decrease
(if (not $benchcyclesfactor) (setq $benchcyclesfactor 1))

;; to run this loaded test manually
(defun C:Run ()
  (setvar "cmdecho" 0)
  (print)
  (t_vle_displaypause (* 100 $benchcyclesfactor) nil)
  (setvar "cmdecho" 1)
  (princ)
)

;; to increase/decrease the number of bench loops : > 1 increase < 1 decrease
(if (not $benchcyclesfactor) (setq $benchcyclesfactor 1))

;; to run this loaded test manually
(defun C:Run ()
  (setvar "cmdecho" 0)
  (print)
  (t_vle_displaypause (* 100 $benchcyclesfactor) nil)
  (setvar "cmdecho" 1)
  (princ)
)
