// PR23476 :: stat arrays

global a
global count

probe begin {
  println("BEGIN")
  count = 0
}

probe timer.ms(5) {
  count ++
  a[0] <<< 2
  a[count] <<< count
  if (count >= 10) exit()
}

probe end {
  c0 = @count(a[0]); s0 = @sum(a[0]); a0 = @avg(a[0])
  c5 = @count(a[5]); s5 = @sum(a[5]); a5 = @avg(a[5])
  printf("[0] - @count:%d, @sum:%d, @avg:%d\n", c0,s0,a0)
  printf("[5] - @count:%d, @sum:%d, @avg:%d\n", c5,s5,a5)
  if (c0 == 10 && s0 == 20 && a0 == 2
      && c5 == 1 && s5 == 5 && a5 == 5)
    println("END PASS")
  else
    println("END FAIL")
}
