Re: [Freedos-user] hardware timer QueryPerformanceCounter
I defer to your greater knowledge, obviously. It's just that messing with the PIT can conflict with other things, so you have to be careful (or so I thought). There are issues with the PIT if you reprogram it, but you don't have to do that to use it. You can simply access the PIT countdown register any time you want. -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] hardware timer QueryPerformanceCounter
1). I wouldn't use the PIT, sounds unreliable, using the PIT can be made reliable; has worked flawless for over 20 years since some 80286 but then again, I don't know how anyways. ;-) 3). RDTSC (586+) is probably not what you want, esp. due to early 586-686 time duration limitations and later SMP having issues SMP is never an issue in DOS Tom -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] hardware timer QueryPerformanceCounter
Hi, On Sat, Mar 24, 2012 at 6:20 AM, Tom Ehlert t...@drivesnapshot.de wrote: 1). I wouldn't use the PIT, sounds unreliable, using the PIT can be made reliable; has worked flawless for over 20 years since some 80286 I defer to your greater knowledge, obviously. It's just that messing with the PIT can conflict with other things, so you have to be careful (or so I thought). 3). RDTSC (586+) is probably not what you want, esp. due to early 586-686 time duration limitations and later SMP having issues SMP is never an issue in DOS You mean FreeDOS, not DOS proper, esp. since there is no reason (besides common implementations) that it lacks such support. I'm not sure if RDOS has it, and who knows what the others (e.g. Real/32) have. I'm not up for testing everything! ;-) Anyways, I was just trying to be exhaustive, saying that you can't expect it to work 100% the same in all scenarios and OSes, but I lack the experience to say specifically. It's more complex than it sounds. -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] hardware timer QueryPerformanceCounter
Nanosecond resolution is a little tough, but microsecond is pretty easy just using the PIT. Is microsecond good enough for your purposes? -- View this message in context: http://old.nabble.com/hardware-timer-QueryPerformanceCounter-tp33536190p33544671.html Sent from the FreeDOS - User mailing list archive at Nabble.com. -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] hardware timer QueryPerformanceCounter
Hi, I really hate to be somebody replying to this, esp. due to my inexperience, but since I've already (briefly) mentioned such in private email today, what's one more? ;-) So corrections heavily welcome. 1). I wouldn't use the PIT, sounds unreliable, but then again, I don't know how anyways. ;-) 2). Check DJGPP's sources for gettimeofday() or clock() or uclock() and see what it does. Probably just uses BIOS int 0x1A. 3). RDTSC (586+) is probably not what you want, esp. due to early 586-686 time duration limitations and later SMP having issues with different cores having different skewed timers ... but, they may? have fixed that in latest cpus to be more consistent (I'm not sure). Though this may be a bit less precise than the ultimate best way (which is ... ?? dunno). 4). ACPI / APM / power management can muck with this too. The Intel P4 can slow down on high heat levels, newer x86 can disable some cores, and also some support Turbo Boost, which means you can speed up single core (allegedly) if you enable P0 state. I've not tried, though. 5). RDPMC is a PPro instruction for reading performance monitor counter(s), and I blindly assume this is what Windows uses with their QueryPerformanceCounter(), though I expect you could find out specifically if you searched online in the right place. http://en.wikipedia.org/wiki/Turbo_Boost http://www.rcollins.org/p6/opcodes/RDPMC.html http://en.wikipedia.org/wiki/Time_Stamp_Counter http://www.delorie.com/bin/cvsweb.cgi/djgpp/src/libc/pc_hw/timer/uclock.c?rev=1.5 P.S. For some reason, I vaguely get the idea that the FreeBASIC (DOS sub)forum has something about this. Or maybe it's just their experience in weird arcane areas like this. So you could try asking them.http://www.freebasic.net/forum/ On Fri, Mar 23, 2012 at 4:57 PM, BretJ bretj...@juno.com wrote: Nanosecond resolution is a little tough, but microsecond is pretty easy just using the PIT. Is microsecond good enough for your purposes? -- View this message in context: http://old.nabble.com/hardware-timer-QueryPerformanceCounter-tp33536190p33544671.html Sent from the FreeDOS - User mailing list archive at Nabble.com. -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user
Re: [Freedos-user] hardware timer QueryPerformanceCounter
1). I wouldn't use the PIT, sounds unreliable, but then again, I don't know how anyways. ;-) Strictly in terms of reliability, it's probably the best choice of all. It exists and provides consistent timing on all computers, even those with lowly 8088 CPU's. You don't need to worry about adjusting or calculating anything to account for APM/ACPI or CPU/HW variability or ... The only real issue you will run into is when trying to run in a VM, since it is emulated. If you're using real DOS that's not an issue. -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Freedos-user mailing list Freedos-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-user