1#!/usr/bin/env python
2#    Copyright 2017 ARM Limited, Google and contributors
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17import os
18import pandas as pd
19from time import sleep
20from devlib.exception import TargetError
21from analysis_tool import AnalysisTool
22
23class AndroidGfx(AnalysisTool):
24
25    def __init__(self):
26        super(AndroidGfx, self).__init__()
27
28    def get_frame_drops(self, df):
29        if not 'func' in df.columns:
30            return 0
31        return len(df[(df.func == 'FrameMissed') & (df.data == '1')])
32
33    def run_analysis(self):
34        df = self.trace.data_frame.trace_event('tracing_mark_write')
35        print {'frame_drops': self.get_frame_drops(df)}
36
37# Run the analysis and provide results
38if __name__ == "__main__":
39    AndroidGfx().run_main()
40