[PD] counting samples written to an array