def _hit_ratio_start_time_end_time_calc_hit_count(reuse_dist_array,
    last_access_array, cache_size, begin_pos, end_pos, real_start, **kwargs):
    """
    called by hit_ratio_start_time_end_time to calculate hit count
    :rtype: count of hit
    :param reuse_dist_array:
    :param cache_size:
    :param begin_pos:
    :param end_pos: end pos of trace in current partition (not included)
    :param real_start: the real start position of cache trace
    :return:
    """
    hit_count = 0
    miss_count = 0
    try:
        for i in range(begin_pos, end_pos):
            if reuse_dist_array[i] == -1:
                miss_count += 1
                continue
            if last_access_array[i] - (i - real_start
                ) <= 0 and reuse_dist_array[i] < cache_size:
                hit_count += 1
            else:
                miss_count += 1
    except:
        print('error: begin: {}, end: {}, i: {}'.format(begin_pos, end_pos, i))
    return hit_count
