|
[ ghc-Bugs-715052 ] getCPUTime doesn't work: msg#00008lang.haskell.glasgow.bugs
Bugs item #715052, was opened at 2003-04-03 19:33 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=108032&aid=715052&group_id=8032 Category: Compiler Group: 5.04.3 >Status: Closed Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: getCPUTime doesn't work Initial Comment: I use GHC5.04.3 on windows XP. I want to getCPUTime function to get a number used as a random seed. The getCPUTime works well in GHCi(always increasing), but when compiled by ghc, the return value of getCPUTime is fixed to two values.This can be demonstrated by: import CPUTime main = do d<-getCPUTime print d         Liu Junfeng         liujf2003@xxxxxxxxxxxxxxxxx           2003-04-03 ---------------------------------------------------------------------- >Comment By: Sigbjorn Finne (sigbjorn) Date: 2003-04-04 07:33 Message: Logged In: YES user_id=232905 This is expected behaviour, as the value returned by CPUTime.getCPUTime is process-relative. You probably want to consult Time.getClockTime also when manufacturing the seed -- here's how (the non-exported) Random.mkStdRNG is defined: mkStdRNG :: Integer -> IO StdGen mkStdRNG o = do ct <- getCPUTime (TOD sec _) <- getClockTime return (createStdGen (sec * 12345 + ct + o)) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=108032&aid=715052&group_id=8032
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Profiling + External Core = trouble, Simon Peyton-Jones |
|---|---|
| Next by Date: | A big bug, Liu Junfeng |
| Previous by Thread: | [ ghc-Bugs-715052 ] getCPUTime doesn't work, SourceForge.net |
| Next by Thread: | A big bug, Liu Junfeng |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |