Frequency and Period Counter library adapted for Spark