@staticmethod
def _delta_user_cycles(cur_sample, prev_sample):
    """Determines the delta of user cycles from the cur and prev sample.

        :param cur_sample: The current sample.
        :param prev_sample: The previous sample.  May be None.
        :return: The difference in cycles between the two samples.  If the data
                 only exists in the current sample (indicates a new workload),
                 then all of the cycles from the current sample will be
                 considered the delta.
        """
    if prev_sample is None:
        return 0
    if (prev_sample.processor.util_cap_proc_cycles == prev_sample.processor
        .util_uncap_proc_cycles == prev_sample.processor.idle_proc_cycles == 0
        ):
        return 0
    prev_amount = (prev_sample.processor.util_cap_proc_cycles + prev_sample
        .processor.util_uncap_proc_cycles - prev_sample.processor.
        idle_proc_cycles)
    cur_amount = (cur_sample.processor.util_cap_proc_cycles + cur_sample.
        processor.util_uncap_proc_cycles - cur_sample.processor.
        idle_proc_cycles)
    return cur_amount - prev_amount
