## Timing by profiling

Expand Messages
• I wonder whether let print_differentEls al1 al2 = List.iter2 (fun a b - if (a=b) then () else print_endline (string_of_int b)) (List.rev al1) (List.rev al2);;
Message 1 of 1 , Feb 27, 2003
I wonder whether

let print_differentEls al1 al2 = List.iter2 (fun a b -> if (a=b) then () else
print_endline (string_of_int b)) (List.rev al1) (List.rev al2);;

is more efficient than

let print_differentEls al1 al2 = List.iter (fun el -> match el with None -> ()
| Some r -> print_endline (string_of_int r)) (List.rev_map2 (fun a b -> if
(a=b) then None else Some b) al1 al2);;

To test this, I've thought about timing the two of them. I've never timed
anything in Ocaml, I thought that "profiling" would make it.

So I've written two samples
---------------------------------------------
checkout1.ml
---------------------------------------------
let l1 = [10;9;8;7;6;5;4;3;2;1;0] in

let l2 = [100;9;80;7;60;5;40;3;20;1;0] in

let print_differentEls al1 al2 = List.iter2 (fun a b -> if (a=b) then () else
print_endline (string_of_int b)) (List.rev al1) (List.rev al2)
in

for i=0 to 100000 do
print_differentEls l1 l2
done;;
---------------------------------------------

and

---------------------------------------------
checkout2.ml
---------------------------------------------
let l1 = [10;9;8;7;6;5;4;3;2;1;0] in

let l2 = [100;9;80;7;60;5;40;3;20;1;0] in

let print_differentEls al1 al2 = List.iter (fun el -> match el with None -> ()
| Some r -> print_endline (string_of_int r)) (List.rev_map2 (fun a b -> if
(a=b) then None else Some b) al1 al2)
in

for i=0 to 100000 do
print_differentEls l1 l2
done;;
---------------------------------------------

and then I've used commands

\$ ocamlopt -p checkout1.ml -o checkout1.opt
\$ gprof checkout1.opt > gprof_checkout1.txt

\$ ocamlopt -p checkout2.ml -o checkout2.opt
\$ gprof checkout2.opt > gprof_checkout2.txt

Obtaining the two files that I join. What should I be attentive to, to
understand what form works quicker?

Ernesto

----------

Flat profile:

Each sample counts as 0.00195312 seconds.
no time accumulated

% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 29 0.00 0.00 caml_alloc
0.00 0.00 0.00 11 0.00 0.00 Checkout1__fun_65
0.00 0.00 0.00 11 0.00 0.00 caml_apply2
0.00 0.00 0.00 10 0.00 0.00 modify
0.00 0.00 0.00 6 0.00 0.00 classify_float
0.00 0.00 0.00 6 0.00 0.00 ge_float
0.00 0.00 0.00 6 0.00 0.00 nativeint_format
0.00 0.00 0.00 5 0.00 0.00 Pervasives__bool_of_string_151
0.00 0.00 0.00 5 0.00 0.00 Pervasives__open_out_bin_202
0.00 0.00 0.00 5 0.00 0.00 Pervasives__print_string_285
0.00 0.00 0.00 5 0.00 0.00 alloc_shr
0.00 0.00 0.00 5 0.00 0.00 alloc_small
0.00 0.00 0.00 5 0.00 0.00 alloc_string
0.00 0.00 0.00 5 0.00 0.00 allocate_block
0.00 0.00 0.00 5 0.00 0.00 caml_flush
0.00 0.00 0.00 5 0.00 0.00 caml_output_partial
0.00 0.00 0.00 5 0.00 0.00 ext_table_free
0.00 0.00 0.00 5 0.00 0.00 final_register
0.00 0.00 0.00 5 0.00 0.00 finalize_channel
0.00 0.00 0.00 5 0.00 0.00 init_signals
0.00 0.00 0.00 5 0.00 0.00 minor_collection
0.00 0.00 0.00 5 0.00 0.00 parse_format
0.00 0.00 0.00 5 0.00 0.00 parse_long
0.00 0.00 0.00 5 0.00 0.00 putword
0.00 0.00 0.00 5 0.00 0.00 shrink_heap
0.00 0.00 0.00 4 0.00 0.00 gc_get
0.00 0.00 0.00 3 0.00 0.00 alloc_channel
0.00 0.00 0.00 3 0.00 0.00 alloc_custom
0.00 0.00 0.00 3 0.00 0.00 is_printable
0.00 0.00 0.00 2 0.00 0.00 List__nth_68
0.00 0.00 0.00 2 0.00 0.00 alloc
0.00 0.00 0.00 2 0.00 0.00 callback2_exn
0.00 0.00 0.00 2 0.00 0.00 caml_flush_partial
0.00 0.00 0.00 2 0.00 0.00 do_write
0.00 0.00 0.00 2 0.00 0.00 flush_partial
0.00 0.00 0.00 2 0.00 0.00 open_descriptor_in
0.00 0.00 0.00 1 0.00 0.00 Checkout1__print_differentEls_58
0.00 0.00 0.00 1 0.00 0.00 List__rev_map2_122
0.00 0.00 0.00 1 0.00 0.00 List__stable_sort_271
0.00 0.00 0.00 1 0.00 0.00 Pervasives__code_begin
0.00 0.00 0.00 1 0.00 0.00 Pervasives__do_at_exit_329
0.00 0.00 0.00 1 0.00 0.00 Pervasives__open_out_gen_196
0.00 0.00 0.00 1 0.00 0.00 Std_exit__entry
0.00 0.00 0.00 1 0.00 0.00 callback3
0.00 0.00 0.00 1 0.00 0.00 callbackN
0.00 0.00 0.00 1 0.00 0.00 caml_alloc2
0.00 0.00 0.00 1 0.00 0.00 channel_size
0.00 0.00 0.00 1 0.00 0.00 clip_heap_chunk_size
0.00 0.00 0.00 1 0.00 0.00 compare_channel
0.00 0.00 0.00 1 0.00 0.00 do_local_roots
0.00 0.00 0.00 1 0.00 0.00 enter_blocking_section
0.00 0.00 0.00 1 0.00 0.00 fatal_error_arg
0.00 0.00 0.00 1 0.00 0.00 final_custom_operations
0.00 0.00 0.00 1 0.00 0.00 finish_major_cycle
0.00 0.00 0.00 1 0.00 0.00 fl_allocate
0.00 0.00 0.00 1 0.00 0.00 fl_init_merge
0.00 0.00 0.00 1 0.00 0.00 garbage_collection
0.00 0.00 0.00 1 0.00 0.00 gc_major_slice
0.00 0.00 0.00 1 0.00 0.00 init_custom_operations
0.00 0.00 0.00 1 0.00 0.00 init_major_heap
0.00 0.00 0.00 1 0.00 0.00 is_stack_overflow
0.00 0.00 0.00 1 0.00 0.00 minmax_table
0.00 0.00 0.00 1 0.00 0.00 norm_pfree
0.00 0.00 0.00 1 0.00 0.00 parse_camlrunparam
0.00 0.00 0.00 1 0.00 0.00 random_level
0.00 0.00 0.00 1 0.00 0.00 realloc_ref_table
0.00 0.00 0.00 1 0.00 0.00 scanmult
0.00 0.00 0.00 1 0.00 0.00 startup__code_begin
0.00 0.00 0.00 1 0.00 0.00 sys_error
0.00 0.00 0.00 1 0.00 0.00 sys_get_argv

% the percentage of the total running time of the
time program used by this function.

cumulative a running sum of the number of seconds accounted
seconds for by this function and those listed above it.

self the number of seconds accounted for by this
seconds function alone. This is the major sort for this
listing.

calls the number of times this function was invoked, if
this function is profiled, else blank.

self the average number of milliseconds spent in this
ms/call function per call, if this function is profiled,
else blank.

total the average number of milliseconds spent in this
ms/call function and its descendents per call, if this
function is profiled, else blank.

name the name of the function. This is the minor sort
for this listing. The index shows the location of
the function in the gprof listing. If the index is
in parenthesis it shows where it would appear in
the gprof listing if it were to be printed.

Call graph (explanation follows)

granularity: each sample hit covers 4 byte(s) no time propagated

index % time self children called name
0.00 0.00 1/29 Pervasives__open_out_200 [170]
0.00 0.00 1/29 caml_main [246]
0.00 0.00 2/29 Pervasives__code_begin [40]
0.00 0.00 5/29 Pervasives__bool_of_string_151 [8]
0.00 0.00 5/29 Pervasives__flush_all_206 [135]
0.00 0.00 5/29 Pervasives__print_int_287 [183]
0.00 0.00 10/29 Pervasives__entry [132]
[1] 0.0 0.00 0.00 29 caml_alloc [1]
-----------------------------------------------
0.00 0.00 11/11 List__rev_map2_122 [38]
[2] 0.0 0.00 0.00 11 Checkout1__fun_65 [2]
0.00 0.00 5/5 Pervasives__bool_of_string_151 [8]
-----------------------------------------------
0.00 0.00 11/11 List__rev_map2_122 [38]
[3] 0.0 0.00 0.00 11 caml_apply2 [3]
-----------------------------------------------
0.00 0.00 1/10 register_global_root [523]
0.00 0.00 1/10 init_major_heap [60]
0.00 0.00 1/10 set_minor_heap_size [544]
0.00 0.00 1/10 hash_value_name [366]
0.00 0.00 3/10 is_printable [29]
0.00 0.00 3/10 alloc_custom [28]
[4] 0.0 0.00 0.00 10 modify [4]
-----------------------------------------------
0.00 0.00 1/6 parse_camlrunparam [64]
0.00 0.00 5/6 parse_long [23]
[5] 0.0 0.00 0.00 6 classify_float [5]
-----------------------------------------------
0.00 0.00 6/6 Pervasives__entry [132]
[6] 0.0 0.00 0.00 6 ge_float [6]
0.00 0.00 6/6 nativeint_format [7]
-----------------------------------------------
0.00 0.00 6/6 ge_float [6]
[7] 0.0 0.00 0.00 6 nativeint_format [7]
-----------------------------------------------
0.00 0.00 5/5 Checkout1__fun_65 [2]
[8] 0.0 0.00 0.00 5 Pervasives__bool_of_string_151 [8]
0.00 0.00 5/5 parse_format [22]
0.00 0.00 5/29 caml_alloc [1]
-----------------------------------------------
0.00 0.00 5/5 Pervasives__print_int_287 [183]
[9] 0.0 0.00 0.00 5 Pervasives__open_out_bin_202 [9]
-----------------------------------------------
0.00 0.00 5/5 List__rev_map2_122 [38]
[10] 0.0 0.00 0.00 5 Pervasives__print_string_285 [10]
-----------------------------------------------
0.00 0.00 5/5 alloc_custom [28]
[11] 0.0 0.00 0.00 5 alloc_shr [11]
-----------------------------------------------
0.00 0.00 5/5 alloc_final [207]
[12] 0.0 0.00 0.00 5 alloc_small [12]
-----------------------------------------------
0.00 0.00 5/5 parse_format [22]
[13] 0.0 0.00 0.00 5 alloc_string [13]
-----------------------------------------------
0.00 0.00 5/5 allocation_color [210]
[14] 0.0 0.00 0.00 5 allocate_block [14]
-----------------------------------------------
0.00 0.00 5/5 Pervasives__print_int_287 [183]
[15] 0.0 0.00 0.00 5 caml_flush [15]
-----------------------------------------------
0.00 0.00 5/5 Pervasives__flush_all_206 [135]
[16] 0.0 0.00 0.00 5 caml_output_partial [16]
-----------------------------------------------
0.00 0.00 5/5 fl_allocate [55]
[17] 0.0 0.00 0.00 5 ext_table_free [17]
-----------------------------------------------
0.00 0.00 5/5 finalize_channel [19]
[18] 0.0 0.00 0.00 5 final_register [18]
0.00 0.00 5/5 shrink_heap [25]
-----------------------------------------------
0.00 0.00 1/5 compare_channel [49]
0.00 0.00 2/5 alloc_channel [27]
0.00 0.00 2/5 caml_out_channels_list [250]
[19] 0.0 0.00 0.00 5 finalize_channel [19]
0.00 0.00 5/5 final_register [18]
-----------------------------------------------
0.00 0.00 5/5 init_gc [371]
[20] 0.0 0.00 0.00 5 init_signals [20]
-----------------------------------------------
0.00 0.00 5/5 alloc_custom [28]
[21] 0.0 0.00 0.00 5 minor_collection [21]
-----------------------------------------------
0.00 0.00 5/5 Pervasives__bool_of_string_151 [8]
[22] 0.0 0.00 0.00 5 parse_format [22]
0.00 0.00 5/5 parse_long [23]
0.00 0.00 5/5 alloc_string [13]
-----------------------------------------------
0.00 0.00 5/5 parse_format [22]
[23] 0.0 0.00 0.00 5 parse_long [23]
0.00 0.00 5/6 classify_float [5]
-----------------------------------------------
0.00 0.00 5/5 caml_output [251]
[24] 0.0 0.00 0.00 5 putword [24]
-----------------------------------------------
0.00 0.00 5/5 final_register [18]
[25] 0.0 0.00 0.00 5 shrink_heap [25]
-----------------------------------------------
0.00 0.00 1/4 gc_major_slice [58]
0.00 0.00 1/4 gc_compaction [352]
0.00 0.00 2/4 init_gc [371]
[26] 0.0 0.00 0.00 4 gc_get [26]
-----------------------------------------------
0.00 0.00 1/3 Pervasives__open_out_200 [170]
0.00 0.00 2/3 Pervasives__entry [132]
[27] 0.0 0.00 0.00 3 alloc_channel [27]
0.00 0.00 2/2 open_descriptor_in [36]
0.00 0.00 2/5 finalize_channel [19]
-----------------------------------------------
0.00 0.00 3/3 final_custom_operations [53]
[28] 0.0 0.00 0.00 3 alloc_custom [28]
0.00 0.00 5/5 alloc_shr [11]
0.00 0.00 5/5 minor_collection [21]
0.00 0.00 3/10 modify [4]
-----------------------------------------------
0.00 0.00 1/3 compare_channel [49]
0.00 0.00 2/3 open_descriptor_in [36]
[29] 0.0 0.00 0.00 3 is_printable [29]
0.00 0.00 3/10 modify [4]
-----------------------------------------------
0.00 0.00 2/2 Checkout1__print_differentEls_58 [37]
[30] 0.0 0.00 0.00 2 List__nth_68 [30]
-----------------------------------------------
0.00 0.00 2/2 caml_out_channels_list [250]
[31] 0.0 0.00 0.00 2 alloc [31]
-----------------------------------------------
0.00 0.00 1/2 minmax_table [62]
0.00 0.00 1/2 init_atoms [368]
[32] 0.0 0.00 0.00 2 callback2_exn [32]
-----------------------------------------------
0.00 0.00 2/2 Pervasives__code_begin [40]
[33] 0.0 0.00 0.00 2 caml_flush_partial [33]
0.00 0.00 2/2 flush_partial [35]
-----------------------------------------------
0.00 0.00 2/2 flush_partial [35]
[34] 0.0 0.00 0.00 2 do_write [34]
0.00 0.00 1/1 channel_size [47]
-----------------------------------------------
0.00 0.00 2/2 caml_flush_partial [33]
[35] 0.0 0.00 0.00 2 flush_partial [35]
0.00 0.00 2/2 do_write [34]
-----------------------------------------------
0.00 0.00 2/2 alloc_channel [27]
[36] 0.0 0.00 0.00 2 open_descriptor_in [36]
0.00 0.00 2/3 is_printable [29]
-----------------------------------------------
0.00 0.00 1/1 startup__code_begin [68]
[37] 0.0 0.00 0.00 1 Checkout1__print_differentEls_58 [37]
0.00 0.00 2/2 List__nth_68 [30]
0.00 0.00 1/1 List__rev_map2_122 [38]
-----------------------------------------------
0.00 0.00 1/1 Checkout1__print_differentEls_58 [37]
[38] 0.0 0.00 0.00 1 List__rev_map2_122 [38]
0.00 0.00 11/11 Checkout1__fun_65 [2]
0.00 0.00 11/11 caml_apply2 [3]
0.00 0.00 5/5 Pervasives__print_string_285 [10]
-----------------------------------------------
0.00 0.00 1/1 startup__code_begin [68]
[39] 0.0 0.00 0.00 1 List__stable_sort_271 [39]
-----------------------------------------------
0.00 0.00 1/1 Std_exit__entry [43]
[40] 0.0 0.00 0.00 1 Pervasives__code_begin [40]
0.00 0.00 2/2 caml_flush_partial [33]
0.00 0.00 2/29 caml_alloc [1]
-----------------------------------------------
0.00 0.00 1/1 startup__code_begin [68]
[41] 0.0 0.00 0.00 1 Pervasives__do_at_exit_329 [41]
-----------------------------------------------
0.00 0.00 1/1 Std_exit__entry [43]
[42] 0.0 0.00 0.00 1 Pervasives__open_out_gen_196 [42]
-----------------------------------------------
0.00 0.00 1/1 startup__code_begin [68]
[43] 0.0 0.00 0.00 1 Std_exit__entry [43]
0.00 0.00 1/1 Pervasives__code_begin [40]
0.00 0.00 1/1 Pervasives__open_out_gen_196 [42]
-----------------------------------------------
0.00 0.00 1/1 callbackN [45]
[44] 0.0 0.00 0.00 1 callback3 [44]
-----------------------------------------------
0.00 0.00 1/1 Pervasives__entry [132]
[45] 0.0 0.00 0.00 1 callbackN [45]
0.00 0.00 1/1 callback3 [44]
-----------------------------------------------
0.00 0.00 1/1 Pervasives__entry [132]
[46] 0.0 0.00 0.00 1 caml_alloc2 [46]
-----------------------------------------------
0.00 0.00 1/1 do_write [34]
[47] 0.0 0.00 0.00 1 channel_size [47]
0.00 0.00 1/1 garbage_collection [57]
0.00 0.00 1/1 enter_blocking_section [51]
-----------------------------------------------
0.00 0.00 1/1 init_gc [371]
[48] 0.0 0.00 0.00 1 clip_heap_chunk_size [48]
0.00 0.00 1/1 finish_major_cycle [54]
-----------------------------------------------
0.00 0.00 1/1 Pervasives__entry [132]
[49] 0.0 0.00 0.00 1 compare_channel [49]
0.00 0.00 1/3 is_printable [29]
0.00 0.00 1/5 finalize_channel [19]
-----------------------------------------------
0.00 0.00 1/1 register_global_root [523]
[50] 0.0 0.00 0.00 1 do_local_roots [50]
-----------------------------------------------
0.00 0.00 1/1 channel_size [47]
[51] 0.0 0.00 0.00 1 enter_blocking_section [51]
-----------------------------------------------
0.00 0.00 1/1 realloc_ref_table [66]
[52] 0.0 0.00 0.00 1 fatal_error_arg [52]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [64]
[53] 0.0 0.00 0.00 1 final_custom_operations [53]
0.00 0.00 3/3 alloc_custom [28]
-----------------------------------------------
0.00 0.00 1/1 clip_heap_chunk_size [48]
[54] 0.0 0.00 0.00 1 finish_major_cycle [54]
-----------------------------------------------
0.00 0.00 1/1 init_major_heap [60]
[55] 0.0 0.00 0.00 1 fl_allocate [55]
0.00 0.00 5/5 ext_table_free [17]
-----------------------------------------------
0.00 0.00 1/1 init_major_heap [60]
[56] 0.0 0.00 0.00 1 fl_init_merge [56]
-----------------------------------------------
0.00 0.00 1/1 channel_size [47]
[57] 0.0 0.00 0.00 1 garbage_collection [57]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [64]
[58] 0.0 0.00 0.00 1 gc_major_slice [58]
0.00 0.00 1/4 gc_get [26]
-----------------------------------------------
0.00 0.00 1/1 Pervasives__entry [132]
[59] 0.0 0.00 0.00 1 init_custom_operations [59]
-----------------------------------------------
0.00 0.00 1/1 gc_compaction [352]
[60] 0.0 0.00 0.00 1 init_major_heap [60]
0.00 0.00 1/1 fl_allocate [55]
0.00 0.00 1/1 fl_init_merge [56]
0.00 0.00 1/10 modify [4]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [64]
[61] 0.0 0.00 0.00 1 is_stack_overflow [61]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [64]
[62] 0.0 0.00 0.00 1 minmax_table [62]
0.00 0.00 1/2 callback2_exn [32]
-----------------------------------------------
0.00 0.00 1/1 gc_compaction [352]
[63] 0.0 0.00 0.00 1 norm_pfree [63]
-----------------------------------------------
0.00 0.00 1/1 List__entry [81]
[64] 0.0 0.00 0.00 1 parse_camlrunparam [64]
0.00 0.00 1/6 classify_float [5]
0.00 0.00 1/1 final_custom_operations [53]
0.00 0.00 1/1 scanmult [67]
0.00 0.00 1/1 gc_major_slice [58]
0.00 0.00 1/1 minmax_table [62]
0.00 0.00 1/1 is_stack_overflow [61]
-----------------------------------------------
0.00 0.00 1/1 register_named_value [524]
[65] 0.0 0.00 0.00 1 random_level [65]
-----------------------------------------------
0.00 0.00 1/1 round_heap_chunk_size [529]
[66] 0.0 0.00 0.00 1 realloc_ref_table [66]
0.00 0.00 1/1 fatal_error_arg [52]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [64]
[67] 0.0 0.00 0.00 1 scanmult [67]
-----------------------------------------------
0.00 0.00 1/1 caml_c_call [228]
[68] 0.0 0.00 0.00 1 startup__code_begin [68]
0.00 0.00 1/1 Pervasives__do_at_exit_329 [41]
0.00 0.00 1/1 List__stable_sort_271 [39]
0.00 0.00 1/1 Checkout1__print_differentEls_58 [37]
0.00 0.00 1/1 Std_exit__entry [43]
-----------------------------------------------
0.00 0.00 1/1 List__entry [81]
[69] 0.0 0.00 0.00 1 sys_error [69]
-----------------------------------------------
0.00 0.00 1/1 caml_main [246]
[70] 0.0 0.00 0.00 1 sys_get_argv [70]
-----------------------------------------------

This table describes the call tree of the program, and was sorted by
the total amount of time spent in each function and its children.

Each entry in this table consists of several lines. The line with the
index number at the left hand margin lists the current function.
The lines above it list the functions that called this function,
and the lines below it list the functions this one called.
This line lists:
index A unique number given to each element of the table.
Index numbers are sorted numerically.
The index number is printed next to every function name so
it is easier to look up where the function in the table.

% time This is the percentage of the `total' time that was spent
in this function and its children. Note that due to
different viewpoints, functions excluded by options, etc,
these numbers will NOT add up to 100%.

self This is the total amount of time spent in this function.

children This is the total amount of time propagated into this
function by its children.

called This is the number of times the function was called.
If the function called itself recursively, the number
only includes non-recursive calls, and is followed by
a `+' and the number of recursive calls.

name The name of the current function. The index number is
printed after it. If the function is a member of a
cycle, the cycle number is printed between the
function's name and the index number.

For the function's parents, the fields have the following meanings:

self This is the amount of time that was propagated directly
from the function into this parent.

children This is the amount of time that was propagated from
the function's children into this parent.

called This is the number of times this parent called the
function `/' the total number of times the function
was called. Recursive calls to the function are not
included in the number after the `/'.

name This is the name of the parent. The parent's index
number is printed after it. If the parent is a
member of a cycle, the cycle number is printed between
the name and the index number.

If the parents of the function cannot be determined, the word
`<spontaneous>' is printed in the `name' field, and all the other
fields are blank.

For the function's children, the fields have the following meanings:

self This is the amount of time that was propagated directly
from the child into the function.

children This is the amount of time that was propagated from the
child's children to the function.

called This is the number of times the function called
this child `/' the total number of times the child
was called. Recursive calls by the child are not
listed in the number after the `/'.

name This is the name of the child. The child's index
number is printed after it. If the child is a
member of a cycle, the cycle number is printed
between the name and the index number.

If there are any cycles (circles) in the call graph, there is an
entry for the cycle-as-a-whole. This entry shows who called the
cycle (as parents) and the members of the cycle (as children.)
The `+' recursive calls entry shows the number of function calls that
were internal to the cycle, and the calls entry for each member shows,
for that member, how many times it was called from other members of
the cycle.

Index by function name

[2] Checkout1__fun_65 [3] caml_apply2 [59] init_custom_operations
[37] Checkout1__print_differentEls_58 [15] caml_flush [60] init_major_heap
[30] List__nth_68 [33] caml_flush_partial [20] init_signals
[38] List__rev_map2_122 [16] caml_output_partial [29] is_printable
[39] List__stable_sort_271 [47] channel_size [61] is_stack_overflow
[8] Pervasives__bool_of_string_151 [5] classify_float [62] minmax_table
[40] Pervasives__code_begin [48] clip_heap_chunk_size [21] minor_collection
[41] Pervasives__do_at_exit_329 [49] compare_channel [4] modify
[9] Pervasives__open_out_bin_202 [50] do_local_roots [7] nativeint_format
[42] Pervasives__open_out_gen_196 [34] do_write [63] norm_pfree
[10] Pervasives__print_string_285 [51] enter_blocking_section [36] open_descriptor_in
[43] Std_exit__entry [17] ext_table_free [64] parse_camlrunparam
[31] alloc [52] fatal_error_arg [22] parse_format
[27] alloc_channel [53] final_custom_operations [23] parse_long
[28] alloc_custom [18] final_register [24] putword
[11] alloc_shr [19] finalize_channel [65] random_level
[12] alloc_small [54] finish_major_cycle [66] realloc_ref_table
[13] alloc_string [55] fl_allocate [67] scanmult
[14] allocate_block [56] fl_init_merge [25] shrink_heap
[32] callback2_exn [35] flush_partial [68] startup__code_begin
[44] callback3 [57] garbage_collection [69] sys_error
[45] callbackN [26] gc_get [70] sys_get_argv
[1] caml_alloc [58] gc_major_slice
[46] caml_alloc2 [6] ge_float

----------

Flat profile:

Each sample counts as 0.00195312 seconds.
no time accumulated

% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 28 0.00 0.00 caml_alloc3
0.00 0.00 0.00 12 0.00 0.00 Checkout2__fun_69
0.00 0.00 0.00 11 0.00 0.00 caml_apply2
0.00 0.00 0.00 10 0.00 0.00 modify
0.00 0.00 0.00 8 0.00 0.00 final_register
0.00 0.00 0.00 6 0.00 0.00 lt_float
0.00 0.00 0.00 6 0.00 0.00 nativeint_format
0.00 0.00 0.00 5 0.00 0.00 Pervasives__open_out_gen_196
0.00 0.00 0.00 5 0.00 0.00 Pervasives__print_char_283
0.00 0.00 0.00 5 0.00 0.00 Pervasives__string_of_bool_149
0.00 0.00 0.00 5 0.00 0.00 alloc_shr
0.00 0.00 0.00 5 0.00 0.00 alloc_small
0.00 0.00 0.00 5 0.00 0.00 alloc_string
0.00 0.00 0.00 5 0.00 0.00 allocate_block
0.00 0.00 0.00 5 0.00 0.00 caml_flush_partial
0.00 0.00 0.00 5 0.00 0.00 caml_output_partial
0.00 0.00 0.00 5 0.00 0.00 classify_float
0.00 0.00 0.00 5 0.00 0.00 empty_minor_heap
0.00 0.00 0.00 5 0.00 0.00 ext_table_add
0.00 0.00 0.00 5 0.00 0.00 finalize_channel
0.00 0.00 0.00 5 0.00 0.00 gc_get
0.00 0.00 0.00 5 0.00 0.00 init_signals
0.00 0.00 0.00 5 0.00 0.00 parse_format
0.00 0.00 0.00 5 0.00 0.00 parse_long
0.00 0.00 0.00 5 0.00 0.00 putword
0.00 0.00 0.00 5 0.00 0.00 shrink_heap
0.00 0.00 0.00 3 0.00 0.00 compare_channel
0.00 0.00 0.00 3 0.00 0.00 is_printable
0.00 0.00 0.00 2 0.00 0.00 List__tl_65
0.00 0.00 0.00 2 0.00 0.00 alloc
0.00 0.00 0.00 2 0.00 0.00 bitvect_test
0.00 0.00 0.00 2 0.00 0.00 callback_exn
0.00 0.00 0.00 2 0.00 0.00 caml_channel_size_64
0.00 0.00 0.00 2 0.00 0.00 channel_binary_mode
0.00 0.00 0.00 2 0.00 0.00 do_local_roots
0.00 0.00 0.00 2 0.00 0.00 final_custom_operations
0.00 0.00 0.00 2 0.00 0.00 fl_allocate
0.00 0.00 0.00 2 0.00 0.00 flush_partial
0.00 0.00 0.00 1 0.00 0.00 List__map2_113
0.00 0.00 0.00 1 0.00 0.00 List__stable_sort_271
0.00 0.00 0.00 1 0.00 0.00 Pervasives__\$40_164
0.00 0.00 0.00 1 0.00 0.00 Pervasives__at_exit_326
0.00 0.00 0.00 1 0.00 0.00 Pervasives__code_begin
0.00 0.00 0.00 1 0.00 0.00 Std_exit__entry
0.00 0.00 0.00 1 0.00 0.00 callback2
0.00 0.00 0.00 1 0.00 0.00 callback3_exn
0.00 0.00 0.00 1 0.00 0.00 callbackN
0.00 0.00 0.00 1 0.00 0.00 caml_alloc
0.00 0.00 0.00 1 0.00 0.00 caml_alloc2
0.00 0.00 0.00 1 0.00 0.00 channel_size
0.00 0.00 0.00 1 0.00 0.00 execute_signal
0.00 0.00 0.00 1 0.00 0.00 fatal_error
0.00 0.00 0.00 1 0.00 0.00 finish_major_cycle
0.00 0.00 0.00 1 0.00 0.00 float_of_bytes
0.00 0.00 0.00 1 0.00 0.00 gc_full_major
0.00 0.00 0.00 1 0.00 0.00 init_atoms
0.00 0.00 0.00 1 0.00 0.00 init_major_heap
0.00 0.00 0.00 1 0.00 0.00 is_stack_overflow
0.00 0.00 0.00 1 0.00 0.00 parse_camlrunparam
0.00 0.00 0.00 1 0.00 0.00 realloc_ref_table
0.00 0.00 0.00 1 0.00 0.00 startup__code_begin
0.00 0.00 0.00 1 0.00 0.00 sys_error
0.00 0.00 0.00 1 0.00 0.00 sys_get_argv
0.00 0.00 0.00 1 0.00 0.00 urge_major_slice

% the percentage of the total running time of the
time program used by this function.

cumulative a running sum of the number of seconds accounted
seconds for by this function and those listed above it.

self the number of seconds accounted for by this
seconds function alone. This is the major sort for this
listing.

calls the number of times this function was invoked, if
this function is profiled, else blank.

self the average number of milliseconds spent in this
ms/call function per call, if this function is profiled,
else blank.

total the average number of milliseconds spent in this
ms/call function and its descendents per call, if this
function is profiled, else blank.

name the name of the function. This is the minor sort
for this listing. The index shows the location of
the function in the gprof listing. If the index is
in parenthesis it shows where it would appear in
the gprof listing if it were to be printed.

Call graph (explanation follows)

granularity: each sample hit covers 4 byte(s) no time propagated

index % time self children called name
0.00 0.00 1/28 Pervasives__open_out_gen_196 [8]
0.00 0.00 2/28 Pervasives__code_begin [43]
0.00 0.00 5/28 Pervasives__string_of_bool_149 [10]
0.00 0.00 5/28 Pervasives__open_out_bin_202 [167]
0.00 0.00 5/28 Pervasives__print_string_285 [181]
0.00 0.00 10/28 Pervasives__entry [128]
[1] 0.0 0.00 0.00 28 caml_alloc3 [1]
-----------------------------------------------
0.00 0.00 1/12 startup__code_begin [61]
0.00 0.00 11/12 List__rev_map2_122 [108]
[2] 0.0 0.00 0.00 12 Checkout2__fun_69 [2]
0.00 0.00 5/5 Pervasives__string_of_bool_149 [10]
-----------------------------------------------
0.00 0.00 11/11 List__rev_map2_122 [108]
[3] 0.0 0.00 0.00 11 caml_apply2 [3]
-----------------------------------------------
0.00 0.00 1/10 register_global_root [524]
0.00 0.00 1/10 init_major_heap [57]
0.00 0.00 1/10 set_minor_heap_size [546]
0.00 0.00 1/10 callbackN [47]
0.00 0.00 3/10 is_printable [28]
0.00 0.00 3/10 alloc_custom [201]
[4] 0.0 0.00 0.00 10 modify [4]
-----------------------------------------------
0.00 0.00 3/8 final_custom_operations [36]
0.00 0.00 5/8 finalize_channel [20]
[5] 0.0 0.00 0.00 8 final_register [5]
0.00 0.00 5/5 shrink_heap [26]
0.00 0.00 5/5 alloc_shr [11]
0.00 0.00 5/5 empty_minor_heap [18]
-----------------------------------------------
0.00 0.00 6/6 Pervasives__entry [128]
[6] 0.0 0.00 0.00 6 lt_float [6]
0.00 0.00 6/6 nativeint_format [7]
-----------------------------------------------
0.00 0.00 6/6 lt_float [6]
[7] 0.0 0.00 0.00 6 nativeint_format [7]
-----------------------------------------------
0.00 0.00 5/5 Pervasives__print_char_283 [9]
[8] 0.0 0.00 0.00 5 Pervasives__open_out_gen_196 [8]
0.00 0.00 1/3 compare_channel [27]
0.00 0.00 1/28 caml_alloc3 [1]
-----------------------------------------------
0.00 0.00 5/5 List__rev_map2_122 [108]
[9] 0.0 0.00 0.00 5 Pervasives__print_char_283 [9]
0.00 0.00 5/5 Pervasives__open_out_gen_196 [8]
-----------------------------------------------
0.00 0.00 5/5 Checkout2__fun_69 [2]
[10] 0.0 0.00 0.00 5 Pervasives__string_of_bool_149 [10]
0.00 0.00 5/5 parse_format [23]
0.00 0.00 5/28 caml_alloc3 [1]
-----------------------------------------------
0.00 0.00 5/5 final_register [5]
[11] 0.0 0.00 0.00 5 alloc_shr [11]
-----------------------------------------------
0.00 0.00 5/5 alloc_string [13]
[12] 0.0 0.00 0.00 5 alloc_small [12]
-----------------------------------------------
0.00 0.00 5/5 parse_format [23]
[13] 0.0 0.00 0.00 5 alloc_string [13]
0.00 0.00 5/5 alloc_small [12]
-----------------------------------------------
0.00 0.00 5/5 shrink_heap [26]
[14] 0.0 0.00 0.00 5 allocate_block [14]
-----------------------------------------------
0.00 0.00 5/5 Pervasives__print_string_285 [181]
[15] 0.0 0.00 0.00 5 caml_flush_partial [15]
0.00 0.00 2/2 flush_partial [38]
-----------------------------------------------
0.00 0.00 5/5 Pervasives__open_out_bin_202 [167]
[16] 0.0 0.00 0.00 5 caml_output_partial [16]
0.00 0.00 5/5 putword [25]
-----------------------------------------------
0.00 0.00 5/5 parse_long [24]
[17] 0.0 0.00 0.00 5 classify_float [17]
-----------------------------------------------
0.00 0.00 5/5 final_register [5]
[18] 0.0 0.00 0.00 5 empty_minor_heap [18]
-----------------------------------------------
0.00 0.00 5/5 allocate_block [14]
[19] 0.0 0.00 0.00 5 ext_table_add [19]
-----------------------------------------------
1 finalize_channel [20]
0.00 0.00 1/5 Pervasives__entry [128]
0.00 0.00 2/5 compare_channel [27]
0.00 0.00 2/5 caml_open_descriptor_out [244]
[20] 0.0 0.00 0.00 5+1 finalize_channel [20]
0.00 0.00 5/8 final_register [5]
0.00 0.00 1/3 is_printable [28]
1 finalize_channel [20]
-----------------------------------------------
0.00 0.00 1/5 gc_compaction [348]
0.00 0.00 2/5 gc_full_major [55]
0.00 0.00 2/5 gc_major_slice [351]
[21] 0.0 0.00 0.00 5 gc_get [21]
-----------------------------------------------
0.00 0.00 5/5 init_gc [368]
[22] 0.0 0.00 0.00 5 init_signals [22]
-----------------------------------------------
0.00 0.00 5/5 Pervasives__string_of_bool_149 [10]
[23] 0.0 0.00 0.00 5 parse_format [23]
0.00 0.00 5/5 parse_long [24]
0.00 0.00 5/5 alloc_string [13]
-----------------------------------------------
0.00 0.00 5/5 parse_format [23]
[24] 0.0 0.00 0.00 5 parse_long [24]
0.00 0.00 5/5 classify_float [17]
-----------------------------------------------
0.00 0.00 5/5 caml_output_partial [16]
[25] 0.0 0.00 0.00 5 putword [25]
-----------------------------------------------
0.00 0.00 5/5 final_register [5]
[26] 0.0 0.00 0.00 5 shrink_heap [26]
0.00 0.00 5/5 allocate_block [14]
-----------------------------------------------
0.00 0.00 1/3 Pervasives__open_out_gen_196 [8]
0.00 0.00 2/3 Pervasives__entry [128]
[27] 0.0 0.00 0.00 3 compare_channel [27]
0.00 0.00 2/2 bitvect_test [31]
0.00 0.00 2/5 finalize_channel [20]
-----------------------------------------------
0.00 0.00 1/3 finalize_channel [20]
0.00 0.00 2/3 bitvect_test [31]
[28] 0.0 0.00 0.00 3 is_printable [28]
0.00 0.00 3/10 modify [4]
-----------------------------------------------
0.00 0.00 2/2 Checkout2__fun_67 [69]
[29] 0.0 0.00 0.00 2 List__tl_65 [29]
-----------------------------------------------
0.00 0.00 2/2 caml_out_channels_list [245]
[30] 0.0 0.00 0.00 2 alloc [30]
-----------------------------------------------
0.00 0.00 2/2 compare_channel [27]
[31] 0.0 0.00 0.00 2 bitvect_test [31]
0.00 0.00 2/3 is_printable [28]
-----------------------------------------------
0.00 0.00 2/2 minmax_table [452]
[32] 0.0 0.00 0.00 2 callback_exn [32]
-----------------------------------------------
0.00 0.00 2/2 Pervasives__code_begin [43]
[33] 0.0 0.00 0.00 2 caml_channel_size_64 [33]
-----------------------------------------------
0.00 0.00 2/2 flush_partial [38]
[34] 0.0 0.00 0.00 2 channel_binary_mode [34]
-----------------------------------------------
0.00 0.00 1/2 random_level [518]
0.00 0.00 1/2 hash_value_name [363]
[35] 0.0 0.00 0.00 2 do_local_roots [35]
-----------------------------------------------
0.00 0.00 1/2 Pervasives__entry [128]
0.00 0.00 1/2 parse_camlrunparam [59]
[36] 0.0 0.00 0.00 2 final_custom_operations [36]
0.00 0.00 3/8 final_register [5]
-----------------------------------------------
0.00 0.00 2/2 init_major_heap [57]
[37] 0.0 0.00 0.00 2 fl_allocate [37]
-----------------------------------------------
0.00 0.00 2/2 caml_flush_partial [15]
[38] 0.0 0.00 0.00 2 flush_partial [38]
0.00 0.00 2/2 channel_binary_mode [34]
-----------------------------------------------
0.00 0.00 1/1 Checkout2__fun_67 [69]
[39] 0.0 0.00 0.00 1 List__map2_113 [39]
-----------------------------------------------
0.00 0.00 1/1 startup__code_begin [61]
[40] 0.0 0.00 0.00 1 List__stable_sort_271 [40]
-----------------------------------------------
0.00 0.00 1/1 Std_exit__entry [44]
[41] 0.0 0.00 0.00 1 Pervasives__\$40_164 [41]
-----------------------------------------------
0.00 0.00 1/1 startup__code_begin [61]
[42] 0.0 0.00 0.00 1 Pervasives__at_exit_326 [42]
-----------------------------------------------
0.00 0.00 1/1 Std_exit__entry [44]
[43] 0.0 0.00 0.00 1 Pervasives__code_begin [43]
0.00 0.00 2/2 caml_channel_size_64 [33]
0.00 0.00 2/28 caml_alloc3 [1]
-----------------------------------------------
0.00 0.00 1/1 startup__code_begin [61]
[44] 0.0 0.00 0.00 1 Std_exit__entry [44]
0.00 0.00 1/1 Pervasives__code_begin [43]
0.00 0.00 1/1 Pervasives__\$40_164 [41]
-----------------------------------------------
0.00 0.00 1/1 callbackN [47]
[45] 0.0 0.00 0.00 1 callback2 [45]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [59]
[46] 0.0 0.00 0.00 1 callback3_exn [46]
-----------------------------------------------
0.00 0.00 1/1 Pervasives__entry [128]
[47] 0.0 0.00 0.00 1 callbackN [47]
0.00 0.00 1/1 callback2 [45]
0.00 0.00 1/10 modify [4]
-----------------------------------------------
0.00 0.00 1/1 caml_main [241]
[48] 0.0 0.00 0.00 1 caml_alloc [48]
0.00 0.00 1/1 startup__code_begin [61]
-----------------------------------------------
0.00 0.00 1/1 Pervasives__entry [128]
[49] 0.0 0.00 0.00 1 caml_alloc2 [49]
-----------------------------------------------
0.00 0.00 1/1 do_write [307]
[50] 0.0 0.00 0.00 1 channel_size [50]
0.00 0.00 1/1 execute_signal [51]
0.00 0.00 1/1 urge_major_slice [64]
-----------------------------------------------
0.00 0.00 1/1 channel_size [50]
[51] 0.0 0.00 0.00 1 execute_signal [51]
-----------------------------------------------
0.00 0.00 1/1 realloc_ref_table [60]
[52] 0.0 0.00 0.00 1 fatal_error [52]
-----------------------------------------------
1 finish_major_cycle [53]
0.00 0.00 1/1 gc_compaction [348]
[53] 0.0 0.00 0.00 1+1 finish_major_cycle [53]
1 finish_major_cycle [53]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [59]
[54] 0.0 0.00 0.00 1 float_of_bytes [54]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [59]
[55] 0.0 0.00 0.00 1 gc_full_major [55]
0.00 0.00 2/5 gc_get [21]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [59]
[56] 0.0 0.00 0.00 1 init_atoms [56]
-----------------------------------------------
0.00 0.00 1/1 gc_major_slice [351]
[57] 0.0 0.00 0.00 1 init_major_heap [57]
0.00 0.00 2/2 fl_allocate [37]
0.00 0.00 1/10 modify [4]
-----------------------------------------------
0.00 0.00 1/1 parse_camlrunparam [59]
[58] 0.0 0.00 0.00 1 is_stack_overflow [58]
-----------------------------------------------
0.00 0.00 1/1 List__entry [77]
[59] 0.0 0.00 0.00 1 parse_camlrunparam [59]
0.00 0.00 1/1 float_of_bytes [54]
0.00 0.00 1/2 final_custom_operations [36]
0.00 0.00 1/1 init_atoms [56]
0.00 0.00 1/1 gc_full_major [55]
0.00 0.00 1/1 callback3_exn [46]
0.00 0.00 1/1 is_stack_overflow [58]
-----------------------------------------------
0.00 0.00 1/1 clip_heap_chunk_size [263]
[60] 0.0 0.00 0.00 1 realloc_ref_table [60]
0.00 0.00 1/1 fatal_error [52]
-----------------------------------------------
0.00 0.00 1/1 caml_alloc [48]
[61] 0.0 0.00 0.00 1 startup__code_begin [61]
0.00 0.00 1/1 Pervasives__at_exit_326 [42]
0.00 0.00 1/1 List__stable_sort_271 [40]
0.00 0.00 1/12 Checkout2__fun_69 [2]
0.00 0.00 1/1 Std_exit__entry [44]
-----------------------------------------------
0.00 0.00 1/1 List__entry [77]
[62] 0.0 0.00 0.00 1 sys_error [62]
-----------------------------------------------
0.00 0.00 1/1 caml_main [241]
[63] 0.0 0.00 0.00 1 sys_get_argv [63]
-----------------------------------------------
0.00 0.00 1/1 channel_size [50]
[64] 0.0 0.00 0.00 1 urge_major_slice [64]
-----------------------------------------------

This table describes the call tree of the program, and was sorted by
the total amount of time spent in each function and its children.

Each entry in this table consists of several lines. The line with the
index number at the left hand margin lists the current function.
The lines above it list the functions that called this function,
and the lines below it list the functions this one called.
This line lists:
index A unique number given to each element of the table.
Index numbers are sorted numerically.
The index number is printed next to every function name so
it is easier to look up where the function in the table.

% time This is the percentage of the `total' time that was spent
in this function and its children. Note that due to
different viewpoints, functions excluded by options, etc,
these numbers will NOT add up to 100%.

self This is the total amount of time spent in this function.

children This is the total amount of time propagated into this
function by its children.

called This is the number of times the function was called.
If the function called itself recursively, the number
only includes non-recursive calls, and is followed by
a `+' and the number of recursive calls.

name The name of the current function. The index number is
printed after it. If the function is a member of a
cycle, the cycle number is printed between the
function's name and the index number.

For the function's parents, the fields have the following meanings:

self This is the amount of time that was propagated directly
from the function into this parent.

children This is the amount of time that was propagated from
the function's children into this parent.

called This is the number of times this parent called the
function `/' the total number of times the function
was called. Recursive calls to the function are not
included in the number after the `/'.

name This is the name of the parent. The parent's index
number is printed after it. If the parent is a
member of a cycle, the cycle number is printed between
the name and the index number.

If the parents of the function cannot be determined, the word
`<spontaneous>' is printed in the `name' field, and all the other
fields are blank.

For the function's children, the fields have the following meanings:

self This is the amount of time that was propagated directly
from the child into the function.

children This is the amount of time that was propagated from the
child's children to the function.

called This is the number of times the function called
this child `/' the total number of times the child
was called. Recursive calls by the child are not
listed in the number after the `/'.

name This is the name of the child. The child's index
number is printed after it. If the child is a
member of a cycle, the cycle number is printed
between the name and the index number.

If there are any cycles (circles) in the call graph, there is an
entry for the cycle-as-a-whole. This entry shows who called the
cycle (as parents) and the members of the cycle (as children.)
The `+' recursive calls entry shows the number of function calls that
were internal to the cycle, and the calls entry for each member shows,
for that member, how many times it was called from other members of
the cycle.

Index by function name

[2] Checkout2__fun_69 [49] caml_alloc2 [55] gc_full_major
[39] List__map2_113 [1] caml_alloc3 [21] gc_get
[40] List__stable_sort_271 [3] caml_apply2 [56] init_atoms
[29] List__tl_65 [33] caml_channel_size_64 [57] init_major_heap
[41] Pervasives__\$40_164 [15] caml_flush_partial [22] init_signals
[42] Pervasives__at_exit_326 [16] caml_output_partial [28] is_printable
[43] Pervasives__code_begin [34] channel_binary_mode [58] is_stack_overflow
[8] Pervasives__open_out_gen_196 [50] channel_size [6] lt_float
[9] Pervasives__print_char_283 [17] classify_float [4] modify
[10] Pervasives__string_of_bool_149 [27] compare_channel [7] nativeint_format
[44] Std_exit__entry [35] do_local_roots [59] parse_camlrunparam
[30] alloc [18] empty_minor_heap [23] parse_format
[11] alloc_shr [51] execute_signal [24] parse_long
[12] alloc_small [19] ext_table_add [25] putword
[13] alloc_string [52] fatal_error [60] realloc_ref_table
[14] allocate_block [36] final_custom_operations [26] shrink_heap
[31] bitvect_test [5] final_register [61] startup__code_begin
[45] callback2 [20] finalize_channel [62] sys_error
[46] callback3_exn [53] finish_major_cycle [63] sys_get_argv
[47] callbackN [37] fl_allocate [64] urge_major_slice
[32] callback_exn [54] float_of_bytes
[48] caml_alloc [38] flush_partial

[Non-text portions of this message have been removed]
Your message has been successfully submitted and would be delivered to recipients shortly.