stat must be floating point type:

stat = static_cast< double >( it->second.countMessages ) / it->second.countSeconds;
out->WriteValue<double>(&stat);