public static int perSecToPerPeriod(float perSec, long periodMs) {
        float period = ((float) periodMs) / 1000.0f;
        float perPeriod = perSec * period;
        perPeriod = Math.max(1.0f, perPeriod);
        return (int) perPeriod;
    }
Convert a rate expressed per second to a rate expressed per the given period.

@param perSec            The per-second rate.
@param periodMs          The new period to use.
@return                  The rate per period.  This will never be less than 1.
trogdor/src/main/java/org/apache/kafka/trogdor/common/WorkerUtils.java