Commit 80f7a209 authored by John van Groningen's avatar John van Groningen

move OS dependent code to module time_profile_os_dependent

parent 362d78b5
......@@ -29,7 +29,6 @@ g_profile_curried :: !.FormattedProfile !.FormattedProfile -> Bool;
//draw_profile_lines :: [.Int] ![.FormattedProfile] .Int .Int UpdateArea *Picture -> .Picture;
draw_profile_lines` :: .Int [.Int] ![.FormattedProfile] .Int .Int !UpdateArea *Picture -> *Picture;
clock_speed_and_profile_overhead :: (Int,Real,Real);
printTable :: Font !PrintSetup [.FormattedProfile] .FormattedProfile !*(PSt .a) -> *(PrintSetup,*PSt .a);
//--
......
......@@ -6,29 +6,30 @@ implementation module ShowProfile
//import expand_8_3_names_in_path
//import ArgEnv
//import StdDebug
import StdArray, StdBool, StdEnum, StdFile, StdFunc, StdList, StdMisc
import StdPicture, StdPrint, StdMaybe
import ExtNotice
import code from "cpuspeed.obj"
import time_profile_os_dependent
//import code from library "time_profiler_kernel_library"
//import code from library "shit_library"
ApplicationName :== "ShowTimeProfile"
HelpFileName :== ApplicationName +++ "Help"
PCorMac pc mac :== pc
//windowSize = {w=640,h=400}
//--
/*
:: *ProgState =
{ info :: ProfileInfo
, print_setup :: PrintSetup
, monaco_font :: !Font
, wind :: !Id
}
*/
:: ProfileInfo
= ProfileInfo [FormattedProfile] FormattedProfile
......@@ -276,32 +277,8 @@ open_profile file_name files
where
read_profile :: *File -> ([.Profile],.File);
read_profile file
// # (processor,processor_clock,bus_clock,file)
// = read_processor_information file
# (_,clock_speed,overhead)
= clock_speed_and_profile_overhead
= read_function_profiles (PCorMac
(compute_time_x86 (clock_speed*1.0E6) overhead)
undef//(compute_time processor processor_clock bus_clock)
) file
read_processor_information :: *File -> (Int,Int,Int,.File);
read_processor_information file
# (ok,processor,file)=freadi file
| not ok
= error file
# (ok,processor_clock,file)=freadi file
| not ok
= error file
# (ok,bus_clock,file)=freadi file
| not ok
= error file
# (ok,c,file) = freadc file
| not ok || c<>'\n'
= error file
= (processor,processor_clock,bus_clock,file)
where
error file = (0,1,1,file)
# (compute_time_function,file) = get_compute_time_function file
= read_function_profiles compute_time_function file
read_function_profiles :: (.(Int,Int,Int) -> .Real) *File -> ([.Profile],.File);
read_function_profiles compute_time_function file
......@@ -368,55 +345,6 @@ where
| not ok || c == ' ' || c == '\n' = (acc,file)
= read_function_name [c:acc] file
//-- Clock speed funs
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
//-- Compute time funs
TwoPower32Real:==4294967296.0
/*
PowerPC601GestaltNumber:==257
PowerPC750GestaltNumber:==264
PowerPC7400GestaltNumber:==268
PowerPC603604ProfileOverhead:==10.0
PowerPC750ProfileOverhead:==7.0
compute_time :: .Int a b -> .((c,.Int,d) -> Real) | toReal a & toReal b & toReal c & toReal d;
compute_time processor processor_clock bus_clock
| processor==PowerPC601GestaltNumber
= \ (time_hi,time_lo,n_profiler_calls)
-> toReal time_hi + (toReal time_lo / 1E+9) - (toReal n_profiler_calls*16.0/toReal processor_clock)
| processor>=PowerPC750GestaltNumber
= \ (time_hi,time_lo,n_profiler_calls)
-> ((toReal time_hi*TwoPower32Real + (if (time_lo>=0) (toReal time_lo) (TwoPower32Real+toReal time_lo)))*4.0)/toReal bus_clock
- (toReal n_profiler_calls*PowerPC750ProfileOverhead/toReal processor_clock)
= \ (time_hi,time_lo,n_profiler_calls)
-> ((toReal time_hi*TwoPower32Real + (if (time_lo>=0) (toReal time_lo) (TwoPower32Real+toReal time_lo)))*4.0)/toReal bus_clock
- (toReal n_profiler_calls*PowerPC603604ProfileOverhead/toReal processor_clock)
*/
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)
//-- Sorting funs
ge_profile_time :: !.FormattedProfile !.FormattedProfile -> Bool;
......
......@@ -6,7 +6,7 @@ import StdProcess, StdId, StdMenu, StdReceiver, StdMenuElement, StdFileSelect, S
import flexwin
import ExtNotice
import Help
import ShowProfile
import ShowProfile,time_profile_os_dependent
import Platform
ApplicationName :== "ShowTimeProfile"
......
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