Home | History | Annotate | Download | only in utils
      1 # SPDX-License-Identifier: Apache-2.0
      2 #
      3 # Copyright (C) 2015, ARM Limited and contributors.
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
      6 # not use this file except in compliance with the License.
      7 # You may obtain a copy of the License at
      8 #
      9 # http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 # See the License for the specific language governing permissions and
     15 # limitations under the License.
     16 #
     17 
     18 import logging
     19 
     20 """ Helper module for Analysis classes """
     21 
     22 
     23 class AnalysisModule(object):
     24     """
     25     Base class for Analysis modules.
     26 
     27     :param trace: input Trace object
     28     :type trace: :mod:`libs.utils.Trace`
     29     """
     30 
     31     def __init__(self, trace):
     32 
     33         self._log = logging.getLogger('Analysis')
     34 
     35         self._trace = trace
     36         self._platform = trace.platform
     37         self._data_dir = trace.data_dir
     38 
     39         self._dfg_trace_event = trace._dfg_trace_event
     40 
     41         trace._registerDataFrameGetters(self)
     42 
     43         # Further initialization not possible if platform info is missing
     44         if not self._platform:
     45             return
     46 
     47         # By default assume SMP system
     48         self._big_cap = 1024
     49         self._little_cap = 1024
     50         self._big_cpus = range(self._platform['cpus_count'])
     51         self._little_cpus = []
     52 
     53         if self._trace.has_big_little:
     54             self._little_cap = self._platform['nrg_model']['little']['cpu']['cap_max']
     55             self._big_cpus = self._platform['clusters']['big']
     56             self._little_cpus = self._platform['clusters']['little']
     57 
     58 # vim :set tabstop=4 shiftwidth=4 expandtab
     59