cpulimit 1000
pload QAcommands

set info [QANTestNCollectionPerformance]

set values {}
set keys {}
unset -nocomplain std_cl occt_cl diff_cl
foreach line [split $info "\n"] {
  if { [regexp {(std::.*)} $line] } {
    lappend keys $line
    if {[info exists std_cl] && [info exists occt_cl] && [info exists diff_cl]} {
      lappend values "$diff_cl"
    }
  }
  regexp {\s*[-0-9*.+eE]+\s+([-0-9*.+eE]+)\s+([-0-9*.+eE]+)\s+([-0-9*.+eE]+)} $line dump std_cl occt_cl diff_cl
}
lappend values "$diff_cl"

if { [checkplatform -windows] } {
  set check_values  { 1.5
                      5.2
                      5.7
                      5.7
                      1.7
                      1.3
                      1.6
                      0.4
                      0.4
                    }
} else {
  set check_values  { 1.4
                      5.0
                      1.6
                      7.0
                      1.4
                      1.4
                      1.4
                      0.2
                      0.5
                    }
}

set index 0
foreach key $keys {
  set value [lindex $values $index]
  if { $value > [lindex $check_values $index] } {
    puts "Error: performance of $key become worse than before"
  } else {
    puts "OK: performance of $key is within expected limits"
  }
  incr index
}
