def get_stat(self, tag, app_phase, special_case_pe=True):
    if ((not self.stats) and (not self.mytree.is_empty())):
        self.calculate_stats()
    if ((tag == make_tag(LAYER_RUNTIME, PHASE_EXECUTION)) and special_case_pe):
        async_starts = self.get_begins(app_phase, 'ANeuralNetworksExecution_startCompute')
        async_ends = self.get_ends(app_phase, 'ANeuralNetworksEvent_wait')
        elapsed = 0.0
        for i in range(0, len(async_starts)):
            elapsed = (elapsed + (async_ends[i] - async_starts[i]))
        for sync in ['ANeuralNetworksExecution_create', 'ANeuralNetworksExecution_free', 'ANeuralNetworksEvent_create', 'ANeuralNetworksEvent_free', 'ANeuralNetworksExecution_setInput', 'ANeuralNetworksExecution_setOutput', 'ANeuralNetworksExecution_setInputFromMemory', 'ANeuralNetworksExecution_setOutputFromMemory']:
            sync_starts = self.get_begins(app_phase, sync)
            sync_ends = self.get_ends(app_phase, sync)
            for i in range(0, len(sync_starts)):
                elapsed = (elapsed + (sync_ends[i] - sync_starts[i]))
        return elapsed
    return self.stats.get(((app_phase + '_') + tag), 0.0)
def get_stat(self, tag, app_phase, special_case_pe=True):
    if ((not self.stats) and (not self.mytree.is_empty())):
        self.calculate_stats()
    if ((tag == make_tag(LAYER_RUNTIME, PHASE_EXECUTION)) and special_case_pe):
        async_starts = self.get_begins(app_phase, 'ANeuralNetworksExecution_startCompute')
        async_ends = self.get_ends(app_phase, 'ANeuralNetworksEvent_wait')
        elapsed = 0.0
        for i in range(0, len(async_starts)):
            elapsed = (elapsed + (async_ends[i] - async_starts[i]))
        for sync in ['ANeuralNetworksExecution_create', 'ANeuralNetworksExecution_free', 'ANeuralNetworksEvent_create', 'ANeuralNetworksEvent_free', 'ANeuralNetworksExecution_setInput', 'ANeuralNetworksExecution_setOutput', 'ANeuralNetworksExecution_setInputFromMemory', 'ANeuralNetworksExecution_setOutputFromMemory']:
            sync_starts = self.get_begins(app_phase, sync)
            sync_ends = self.get_ends(app_phase, sync)
            for i in range(0, len(sync_starts)):
                elapsed = (elapsed + (sync_ends[i] - sync_starts[i]))
        return elapsed
    return self.stats.get(((app_phase + '_') + tag), 0.0)