DiffTime Macros

Provides simple macros to measure time differences.

Table of Contents

1 Introduction

Recently, I need to provide extremely simple way for my co-workers to measure latency of some code block. The targeted code are bother C and C++.

If the target code were some lisp codes (elisp, of course), I would provide something like:

(defmacro difftime (&rest body)
  (let ((begin (make-symbol "TIME_BEGIN")))
    `(let ((,begin (current-time)))
       (time-subtract (current-time) ,begin))))

;; For example
(setq time-difference 
       ;; do something which takes some times

comments powered by Disqus