2 puts "0031918: Application Framework - New binary format for fast reading part of OCAF document"
5 set docname ${imagedir}/doc_${casename}.cbfl
7 NewDocument D0 BinLOcaf
12 # set an array 1000 values from 100 to 1099
14 for {set i 101} {$i < 1100} {incr i} {set values "$values $i"}
16 # set 100 arrays to sub-labels of 0:1 0:2 0:3 and 0:4
17 for {set lab 1} {$lab <= 4} {incr lab} {
18 for {set sublab 1} {$sublab <= 100} {incr sublab} {
19 set command "SetIntArray D0 0:$lab:$sublab 0 1 1000 $values"
21 SetReal D0 0:$lab:$sublab 0.1
30 # Computes the elapsed time of open and close document with a given arguments (as text).
31 # It launches 10 iteration, 10 actions in each. Returns time of average time of the minimum-time iteration.
32 proc action_time args {
35 for {set iter 0} {$iter < 10} {incr iter} {
36 set iter_time [lindex [time {
37 Open ${docname} D {*}$args
40 puts "Iteration time $iter_time mcs"
41 if {$iter_time < $min_time} {
42 set min_time $iter_time
49 set whole_time [action_time]
50 puts "Whole document open time $whole_time mcs"
52 set quater_time [action_time -read0:2]
53 puts "Quater of document open time $quater_time mcs"
55 # Check that open of quater of the document is significantly faster than open of whole.
56 if { [expr $quater_time * 1.5] > $whole_time } {
57 puts "Error : loading of quater of the document content too slow relatively to the whole document load"
60 set four_quaters_time [action_time -read0:1 -read0:2 -read0:3 -read0:4]
61 puts "Four quaters of document open time $four_quaters_time mcs"
63 # Check that open of four quaters of the document is not too much slower than opening of the whole document.
64 if { [expr $four_quaters_time * 0.9] > $whole_time } {
65 puts "Error : loading of four quaters of the document content too slow relatively to the whole document load"
68 set no_arrays_time [lindex [time {
69 Open ${docname} D4 -skipTDataStd_IntegerArray -read0:2
71 puts "Quater of document without arrays open time $no_arrays_time mcs"
73 set attrs [Attributes D4 0:2:13]
74 if {"${attrs}" != "TDataStd_Real "} {
75 puts "Error : loading of document skipping arrays contains invalid attributes list '${attrs}'"
78 if {![catch {Attributes D4 0:1:1:13}] || ![catch {Attributes D4 0:1:3:14}] || ![catch {Attributes D4 0:1:4:1}]} {
79 puts "Error : loading of document skipping arrays and sub-trees contains invalid attributes list"
82 # check for appending arrays to the document from the file
83 set append_arrays_time [lindex [time {
84 Open ${docname} D4 -append -readTDataStd_IntegerArray -read0:2 -read0:3
86 puts "Half of document arrays open time $append_arrays_time mcs"
88 set attrs [Attributes D4 0:2:13]
89 if {"${attrs}" != "TDataStd_Real TDataStd_IntegerArray "} {
90 puts "Error : loading of document reading arrays separately contains invalid attributes list '${attrs}'"
92 set attrs [Attributes D4 0:3:1]
93 if {"${attrs}" != "TDataStd_IntegerArray "} {
94 puts "Error : loading of document reading arrays separately contains invalid attributes list on subtree 3 '${attrs}'"
96 if {![catch {Attributes D4 0:1:1:13}] || ![catch {Attributes D4 0:1:4:1}]} {
97 puts "Error : loading of document reading arrays separately contains invalid attributes list on 1 and 4 subtrees"