Commit 83ed9db0 authored by John van Groningen's avatar John van Groningen

count heap usage in words instead of bytes on the PC,

fix printing of heap allocation between 1<<31 and 1<<33 bytes.
parent a6650fa5
......@@ -54,7 +54,7 @@ PCorMac pc mac :== pc
, f_n_strict_calls :: Int
, f_n_lazy_calls :: Int
, f_n_curried_calls :: Int
, f_n_allocated_bytes :: Int
, f_n_allocated_words :: Int
, f_alloc_percentage :: Real
, f_time :: Real
, f_time_percentage :: Real
......@@ -426,7 +426,7 @@ le_profile_name :: !.FormattedProfile !.FormattedProfile -> Bool;
le_profile_name {f_function_name = name1} {f_function_name = name2} = name1 <= name2
ge_profile_byte :: !.FormattedProfile !.FormattedProfile -> Bool;
ge_profile_byte {f_n_allocated_bytes = byte1} {f_n_allocated_bytes = byte2} = byte1 >= byte2
ge_profile_byte {f_n_allocated_words = words1} {f_n_allocated_words = words2} = words1 >= words2
ge_profile_strict :: !.FormattedProfile !.FormattedProfile -> Bool;
ge_profile_strict {f_n_strict_calls = strict1} {f_n_strict_calls = strict2} = strict1 >= strict2
......@@ -450,7 +450,7 @@ le_module_name :: !.Profile !.Profile -> Bool;
le_module_name {module_name = name1} {module_name = name2} = name1 <= name2
g_profile_byte :: !.FormattedProfile !.FormattedProfile -> Bool;
g_profile_byte {f_n_allocated_bytes = byte1} {f_n_allocated_bytes = byte2} = byte1 > byte2
g_profile_byte {f_n_allocated_words = words1} {f_n_allocated_words = words2} = words1 > words2
g_profile_strict :: !.FormattedProfile !.FormattedProfile -> Bool;
g_profile_strict {f_n_strict_calls = strict1} {f_n_strict_calls = strict2} = strict1 > strict2
......@@ -656,7 +656,7 @@ format_profile total_strict_calls total_lazy_calls total_curried_calls total_all
, f_n_strict_calls = total_strict_calls
, f_n_lazy_calls = total_lazy_calls
, f_n_curried_calls = total_curried_calls
, f_n_allocated_bytes = PCorMac total_allocation (total_allocation<<2)
, f_n_allocated_words = total_allocation
, f_alloc_percentage = 100.0
, f_time = total_time
, f_time_percentage = 100.0
......@@ -667,13 +667,30 @@ where
, f_function_name = function_name
, f_time = time
, f_time_percentage = (time*100.0)/total_time
, f_n_allocated_bytes = PCorMac n_allocated_words (n_allocated_words<<2)
, f_n_allocated_words = n_allocated_words
, f_alloc_percentage = (toReal (n_allocated_words)*100.0)/toReal total_allocation
, f_n_strict_calls = n_strict_calls
, f_n_lazy_calls = n_lazy_calls
, f_n_curried_calls = n_curried_calls
}
n_words_to_n_bytes_string n_words
| n_words>0
| n_words<536870912 /* 1<<29 */
= toString (n_words<<2);
# n_words_d_25=n_words/25;
# r=n_words-25*n_words_d_25;
# r1=r/10;
# r0=r-10*r1;
= toString n_words_d_25+++{toChar (48+r1),toChar (48+r0)};
| n_words>= -536870912 /* -(1<<29) */
= toString (n_words<<2);
# n_words_d_25=n_words/25;
# r= ~(n_words-25*n_words_d_25);
# r1=r/10;
# r0=r-10*r1;
= toString n_words_d_25+++{toChar (48+r1),toChar (48+r0)};
//-- Draw funs
(>:) infixl
......@@ -701,7 +718,7 @@ where
draw_profile_lines _ [] y picture
= picture
draw_profile_lines background_box [{f_module_name,f_function_name,f_time,f_time_percentage,f_n_allocated_bytes,f_alloc_percentage,f_n_strict_calls,f_n_lazy_calls,f_n_curried_calls}:lines] y picture
draw_profile_lines background_box [{f_module_name,f_function_name,f_time,f_time_percentage,f_n_allocated_words,f_alloc_percentage,f_n_strict_calls,f_n_lazy_calls,f_n_curried_calls}:lines] y picture
| not (in_area y area)
= draw_profile_lines (not background_box) lines (y+line_height) picture
# y_pos
......@@ -727,7 +744,7 @@ where
>: drawAt {x=col1+5,y=y} cs2
>: drawLeft {x=col3-4,y=y} (format_real 0 1 6 1000000.0 f_time)
>: drawLeft {x=col4-4,y=y} (format_real 0 2 3 1000.0 f_time_percentage)
>: drawLeft {x=col5-4,y=y} (toString f_n_allocated_bytes)
>: drawLeft {x=col5-4,y=y} (n_words_to_n_bytes_string f_n_allocated_words)
>: drawLeft {x=col6-4,y=y} (format_real 0 2 3 1000.0 (f_alloc_percentage))
>: drawLeft {x=col7-4,y=y} (toString f_n_strict_calls)
>: drawLeft {x=col8-4,y=y} (toString f_n_lazy_calls)
......@@ -772,7 +789,7 @@ where
s f
y_pos picture
| s > f = picture
# {f_module_name,f_function_name,f_time,f_time_percentage,f_n_allocated_bytes,f_alloc_percentage,f_n_strict_calls,f_n_lazy_calls,f_n_curried_calls} = lines!!s
# {f_module_name,f_function_name,f_time,f_time_percentage,f_n_allocated_words,f_alloc_percentage,f_n_strict_calls,f_n_lazy_calls,f_n_curried_calls} = lines!!s
# picture
= case background_box of
True
......@@ -794,7 +811,7 @@ where
>: drawAt {x=col1+5,y=y_pos} cs2
>: drawClipLeft (col2+5) {x=col3-5,y=y_pos} (format_real 6 1 6 1000000.0 f_time)
>: drawClipLeft (col3+5) {x=col4-5,y=y_pos} (format_real 2 2 3 1000.0 f_time_percentage)
>: drawClipLeft (col4+5) {x=col5-5,y=y_pos} (format_string_r 12 (toString f_n_allocated_bytes))
>: drawClipLeft (col4+5) {x=col5-5,y=y_pos} (format_string_r 12 (n_words_to_n_bytes_string f_n_allocated_words))
>: drawClipLeft (col5+5) {x=col6-5,y=y_pos} (format_real 2 2 3 1000.0 (f_alloc_percentage))
>: drawClipLeft (col6+5) {x=col7-5,y=y_pos} (format_string_r 10 (toString f_n_strict_calls))
>: drawClipLeft (col7+5) {x=col8-5,y=y_pos} (format_string_r 10 (toString f_n_lazy_calls))
......
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