def event_intervals(self, name=None, task=None, interval=None, match_exact=True): """Returns event intervals for specified `name` and `task` Name here implies `section` or `counter` name. """ if name is None: intervals = \ IntervalList(sorted_items(self._tmw_intervals_by_name.values())) elif isinstance(name, string_types): if match_exact: intervals = self._tmw_intervals_by_name[name] else: intervals = IntervalList( sorted_items(value for key, value in self._tmw_intervals_by_name.iteritems() if name in key)) else: # assume iterable (must match exact) intervals = IntervalList( sorted_items( value for key, value in self._tmw_intervals_by_name.iteritems() if key in name)) intervals = intervals.slice(interval=interval) if task: intervals = IntervalList( filter(lambda it: it.event.task == task, intervals)) return intervals
def io_request_intervals(self, op=None, interval=None, by='issue'): """Returns event intervals for specified `op` If by ='issue' (default): returns intervals from block issue ==> complete Elif by = 'insert': returns intervals from insert to queue ==> complete For list of io_types (aka ops) see `trace.disk.ops` # TODO: Filter by # of sectors & devices. See `DiskIOType` in `ftrace.io` for op. """ if by == 'insert': interval_dict = self._io_insert_intervals_by_op else: interval_dict = self._io_issue_intervals_by_op if op is None: intervals = \ IntervalList(sorted_items(interval_dict.values())) else: intervals = interval_dict[op] intervals = intervals.slice(interval=interval) return intervals
def pwrstate_intervals(self, device=None, state=None, interval=None): """ Returns pwr state intervals for specified state (if any) on device (if any) over the specified interval (if any). """ try: self._pwrstate_intervals_by_device.keys() except AttributeError: self._pwrstate_events_handler() try: if device is not None: intervals = self._pwrstate_intervals_by_device[device] else: intervals = IntervalList( sorted_items( self._pwrstate_intervals_by_device.values())) if is_list_like(state): filter_func = (lambda ti: ti.state in state) if state else None else: filter_func = (lambda ti: ti.state == state) if state else None return IntervalList(filter(filter_func, intervals.slice(interval=interval))) except: return IntervalList()
def cluster_intervals(self, cluster, interval=None): """Return interval for specified cluster & interval """ try: self._cluster_idle_intervals_by_cluster except AttributeError: _ = self._cluster_idle_events_handler() if cluster is not None: intervals = self._cluster_idle_intervals_by_cluster[cluster] else: intervals = IntervalList(sorted_items(self._cluster_idle_intervals_by_cluster.values())) return intervals.slice(interval=interval)
def cluster_intervals(self, cluster, interval=None): """Return interval for specified cluster & interval """ try: self._cluster_idle_intervals_by_cluster except AttributeError: _ = self._cluster_idle_events_handler() if cluster is not None: intervals = self._cluster_idle_intervals_by_cluster[cluster] else: intervals = IntervalList( sorted_items(self._cluster_idle_intervals_by_cluster.values())) return intervals.slice(interval=interval)
def frequency_intervals(self, device=None, interval=None): """Returns freq intervals for specified interval on device""" try: self._pwrlevel_intervals_by_device.keys() except AttributeError: self._pwrlevel_events_handler() try: if device is not None: intervals = self._pwrlevel_intervals_by_device[device] else: intervals = IntervalList( sorted_items( self._pwrlevel_intervals_by_device.values())) return intervals.slice(interval=interval) except: return IntervalList()
def buslevel_intervals(self, device=None, interval=None): """ """ try: self._buslevel_intervals_by_device.keys() except AttributeError: self._buslevel_events_handler() try: if device is not None: intervals = self._buslevel_intervals_by_device[device] else: intervals = IntervalList( sorted_items( self._buslevel_intervals_by_device.values())) return intervals.slice(interval=interval) except: return IntervalList()
def bus_request_intervals(self, device=None, state=None, interval=None): """Return device interval for specified cpu & interval """ try: self._bur_intervals_by_dev except AttributeError: _ = self._bur_events_handler() if device is not None: try: intervals = self._bur_intervals_by_dev[device].slice(interval=interval) except KeyError: log.warn('No such device: {device} in {devices}'.format( device=device, devices=self.names)) interval = IntervalList() else: intervals = IntervalList(sorted_items(self._bur_intervals_by_dev.values())).slice(interval=interval) filter_func = (lambda bi: bi.state is state) if state else None return IntervalList(filter(filter_func, intervals))
def bus_request_intervals(self, device=None, state=None, interval=None): """Return device interval for specified cpu & interval """ try: self._bur_intervals_by_dev except AttributeError: _ = self._bur_events_handler() if device is not None: try: intervals = self._bur_intervals_by_dev[device].slice( interval=interval) except KeyError: log.warn('No such device: {device} in {devices}'.format( device=device, devices=self.names)) interval = IntervalList() else: intervals = IntervalList( sorted_items(self._bur_intervals_by_dev.values())).slice( interval=interval) filter_func = (lambda bi: bi.state is state) if state else None return IntervalList(filter(filter_func, intervals))