Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!gateway!dsys.icst.nbs.GOV!rbj From: rbj@dsys.icst.nbs.GOV (Root Boy Jim) Newsgroups: comp.emacs Subject: updated tools Message-ID: <8905181354.AA08250@dsys.icst.nbs.gov> Date: 18 May 89 13:54:26 GMT Sender: news@bbn.COM Organization: National Institute of Standards and Technology formerly National Bureau of Standards Lines: 40 ? From: Barry Margolin ? In article <8905111747.AA17268@dsys.icst.nbs.gov> rbj@dsys.icst.nbs.GOV (Root Boy Jim) writes: ? >(defun prof (count exp) ? > "Return the number of seconds required to execute COUNT ? >iterations of EXP. Don't use this around midnight!" ? > (let ((beg (time-of-day))) ? > (while (> count 0) ? > (eval exp) ? > (setq count (1- count))) ? > (- (time-of-day) beg))) ? Here's a version that works around midnight: ? (defun prof (count exp) ? "Return the number seconds required to execute COUNT interations of EXP. ? It's correct if it takes less than 24 hours." ? (let ((beg (time-of-day))) ? (while (> count 0) ? (eval exp) ? (setq count (1- count))) ? (mod (- (time-of-day) beg) (* 24 60 60)))) Not quite. I just typed (mod -7 4) and got -3 instead of 1. It would seem that the (mod ...) form should be: (if (>= beg 0) beg (+ beg (* 24 60 60))) ? It's correct if it takes less than 24 hours." Yeah, but if it takes longer, it ain't interactive :-) ? Barry Margolin ? Thinking Machines Corp. ? barmar@think.com ? {uunet,harvard}!think!barmar Root Boy Jim is what I am Are you what you are or what?