mobile_insight.analyzer.analyzer module

A event-driven analyzer abstraction, including low-level msg filter and high-level analyzer

Author: Yuanjie Li

class mobile_insight.analyzer.analyzer.Analyzer

Bases: mobile_insight.element.Element

A base class for all the analyzers

__analyzer_array = {}
__get_module_name(analyzer_name)

Given analyzer name (local), create corresponding module name

Parameters

analyzer_name (string) – the local analyzer name

add_source_callback(callback)

Add a callback function to the analyzer. When a message arrives, the analyzer will trigger the callbacks for analysis.

Parameters

callback – the callback function to be added

exclude_analyzer(analyzer_name)

Remove the dependency from the ananlyzer

Parameters

analyzer (string) – the analyzer to not depend on

get_analyzer(analyzer_name)

Get the instance of an analyzer from the global repository. This API is useful if query for this analyzer is needed.

Parameters

analyzer (string) – the analyzer to not depend on

Returns

the instance of the specificed analyzer, or None if it does not exist

include_analyzer(analyzer_name, callback_list, *args)

Declares the dependency from other analyzers. Once declared, the current analyzer will receive events from other analyzers, then trigger functions in callback_list

Parameters
  • analyzer_name (string) – the name of analyzer to depend on

  • callback_list – a list of callback functions. They will be triggered when an event from analyzer arrives

  • args – optional parameters for the analyzer to be included

recv(module, event)

Handle the received events. This is an overload member from Element

Parameters
  • module – the analyzer/trace collector who raise the event

  • event – the event to be raised

register_coordinator_cb(plugin_cb)
static reset()

Clean up all the analyzers

rm_source_callback(callback)

Delete a callback function to the analyzer.

Parameters

callback – the callback function to be deleted

send_to_coordinator(event)
set_source(source)

Set the source of the trace. The messages from the source will drive the analysis.

Parameters
  • source – the source trace collector

  • type – trace collector