anchor.diff:      ;; swap buffers
       (glut:swap-buffers)
       ;; display frame rate
  -    (measure-framerate counter)
  -    (display-framerate (nbody-demo-num-bodies nbody-demo)
  -                       (get-framerate counter))))
  +    (measure-framerate-counter counter)
  +    (display-framerate counter (nbody-demo-num-bodies nbody-demo))))
   
   (defmethod glut:reshape ((w nbody-window) width height)
     ;; configure on projection mode
  
positive.code:      (unwind-protect (progn ,@body)
         (release-framerate-counter ,var))))
  
  (defun get-framerate (counter)
    (framerate-counter-fps counter))
  
  (defun measure-framerate (counter)
    (symbol-macrolet ((timer (framerate-counter-timer counter))
                      (fps-count (framerate-counter-fps-count counter))
                      (fps-limit (framerate-counter-fps-limit counter))
                      (fps (framerate-counter-fps counter)))
      (incf fps-count)
      (when (>= fps-count fps-limit)
        (stop-timer timer)
        (synchronize-timer timer)
        (let ((milliseconds (/ (elapsed-time timer) fps-count)))
          (start-timer timer)
          (setf fps (/ 1.0 (/ milliseconds 1000.0))
                fps-count 0
                fps-limit (max fps 1.0))))))
  
  
  ;;;
  
negative.code: 
  (defvar *flops-per-interaction* 20)
  
  (defun compute-pref-stats (counter num-bodies interactions)
    (let* ((interactions-per-second
             (/ (* num-bodies num-bodies interactions)
                (/ 1.0 fps)
                1.0e9))
           (gflops (* interactions-per-second *flops-per-interaction*)))
      (values interactions-per-second gflops)))
  
  (let ((previous 0.0))
    (defun display-framerate (counter num-bodies)
      (let ((fps (fps-counter-fps counter)))
        (when (/= fps previous)
          (setf previous fps)
          (multiple-value-bind (interactions-per-second gflops)
              (compute-pref-stats counter num-bodies 1)
            (let ((msg (format nil "CUDA N-Body (~A bodies): ~,1F fps | ~,1F BIPS | ~,1F GFLOP/s | single precision~%"
                             num-bodies fps interactions-per-second gflops)))
              (format t msg)
              (glut:set-window-title msg)))))))
  
  
  ;;;
  