Commit 90ddfe7a authored by John van Groningen's avatar John van Groningen

OS dependent code for the time profiler on windows

parent 08d7f242
definition module time_profile_os_dependent
PCorMac pc mac :== pc
clock_speed_and_profile_overhead :: (!Int,!Real,!Real);
get_compute_time_function :: !*File -> (!(Int,Int,Int) -> Real,!*File)
implementation module time_profile_os_dependent
import StdEnv
import code from "cpuspeed.obj"
PCorMac pc mac :== pc
define_fltused :: !Bool -> Bool
define_fltused n = code {
.export _fltused
:_fltused
pop_b 0
}
measure_clock_speed_and_profile_overhead :: (!Int,!Real,!Real)
measure_clock_speed_and_profile_overhead = code {
ccall measure_clock_speed_and_profile_overhead ":IRR"
}
clock_speed_and_profile_overhead :: (!Int,!Real,!Real)
clock_speed_and_profile_overhead
| define_fltused True
=: measure_clock_speed_and_profile_overhead
get_compute_time_function :: !*File -> (!(Int,Int,Int) -> Real,!*File)
get_compute_time_function file
# (_,clock_speed,overhead) = clock_speed_and_profile_overhead
= (compute_time_x86 (clock_speed*1.0E6) overhead,file)
TwoPower32Real:==4294967296.0
compute_time_x86 :: a .Real -> .((b,.Int,c) -> Real) | toReal a & toReal b & toReal c;
compute_time_x86 processor_clock profile_overhead
= \ (time_hi,time_lo,n_profiler_calls)
-> (toReal time_hi*TwoPower32Real + (if (time_lo>=0) (toReal time_lo) (TwoPower32Real+toReal time_lo)))/toReal processor_clock
- (toReal n_profiler_calls*profile_overhead/toReal processor_clock)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment