def __init__(self): Analyzer.__init__(self) self.add_source_callback(self.__msg_callback) self.mi2log = "" self.ul_pkt = [] self.dl_pkt = [] self.last_sfn = []
def __init__(self, config): Analyzer.__init__(self) self.__log_dir = util.get_mobileinsight_log_path() self.__dec_log_dir = util.get_mobileinsight_log_decoded_path() self.__orig_file = "" self.__raw_msg = {} self.__raw_msg_key = "" self.__msg_cnt = 0 self.__dec_msg = [] self.__is_wifi_enabled = False self.__log_timestamp = "" self.__upload_log_flag = True try: if config['privacy'] == '1': self.__upload_log_flag = True else: self.__upload_log_flag = False except BaseException: self.__upload_log_flag = False try: if config['is_use_wifi'] == '1': self.__is_use_wifi = True else: self.__is_use_wifi = False except BaseException: self.__is_use_wifi = False try: if config['is_dec_log'] == '1': self.__is_dec_log = True self.__dec_log_name = "diag_log_" + \ datetime.datetime.now().strftime('%Y%m%d_%H%M%S') + ".txt" self.__dec_log_path = os.path.join(self.__dec_log_dir, self.__dec_log_name) else: self.__is_dec_log = False except BaseException: self.__is_dec_log = False try: self.__dec_log_type = config['log_type'] except BaseException: self.__dec_log_type = "" if not os.path.exists(self.__log_dir): os.makedirs(self.__log_dir) if not os.path.exists(self.__dec_log_dir): os.makedirs(self.__dec_log_dir) self.add_source_callback(self._logger_filter) self.br = BroadcastReceiver(self.on_broadcast, actions=['MobileInsight.Main.StopService']) self.br.start()
def __init__(self): Analyzer.__init__(self) # a message dump has no analyzer in from/to_list # it only has a single callback for the source with open(overlink_msg1_name, 'w+b') as f: f.write(bytes(256)) with open(overlink_msg2_name, 'w+b') as f: f.write(bytes(256)) self.__msg_log = [] # in-memory message log self.add_source_callback(self.__dump_message) self.decode_type = 0 self._save_file_path = None self._save_file = None self._dump_type = self.ALL self.fn = -1 self.sfn = -1
def __init__(self, config): Analyzer.__init__(self) self.__log_dir = util.get_mobileinsight_log_path() self.__dec_log_dir = util.get_mobileinsight_log_decoded_path() self.__orig_file = "" self.__raw_msg = {} self.__raw_msg_key = "" self.__msg_cnt = 0 self.__dec_msg = [] self.__is_wifi_enabled = False try: if config['is_use_wifi'] == '1': self.__is_use_wifi = True else: self.__is_use_wifi = False except BaseException: self.__is_use_wifi = False try: if config['is_dec_log'] == '1': self.__is_dec_log = True self.__dec_log_name = "diag_log_" + \ datetime.datetime.now().strftime('%Y%m%d_%H%M%S') + ".txt" self.__dec_log_path = os.path.join(self.__dec_log_dir, self.__dec_log_name) else: self.__is_dec_log = False except BaseException: self.__is_dec_log = False try: self.__dec_log_type = config['log_type'] except BaseException: self.__dec_log_type = "" if not os.path.exists(self.__log_dir): os.makedirs(self.__log_dir) if not os.path.exists(self.__dec_log_dir): os.makedirs(self.__dec_log_dir) self.add_source_callback(self._logger_filter)
def test(self): #Single analyzer test only Analyzer.reset() src = OfflineReplayer() src.set_input_path(log_path) # # Indirectly call analyzer via include_analyzer # test_analyzer = Analyzer() # test_analyzer.include_analyzer(analyzer_name,[]) # test_analyzer.set_source(src) test_analyzer = StatsAnalyzer() # test_analyzer = DumpAnalyzer() test_analyzer.set_source(src) # Disable all MobileInsight logs logging.getLogger('mobileinsight_logger').setLevel(logging.CRITICAL) src.run() test_analyzer.close()
def set_source(self, source): """ Set the trace source. Enable the cellular signaling messages :param source: the trace source (collector). """ Analyzer.set_source(self, source) # source.enable_log("LTE_RRC_OTA_Packet") # source.enable_log("LTE_RRC_Serv_Cell_Info") # source.enable_log("LTE_RRC_MIB_Packet") # source.enable_log("LTE_RRC_MIB_Message_Log_Packet") # source.enable_log("LTE_NAS_ESM_State") # source.enable_log("LTE_NAS_ESM_OTA_Incoming_Packet") # source.enable_log("LTE_NAS_ESM_OTA_Outgoing_Packet") # source.enable_log("LTE_NAS_EMM_State") # source.enable_log("LTE_NAS_EMM_OTA_Incoming_Packet") # source.enable_log("LTE_NAS_EMM_OTA_Outgoing_Packet") # source.enable_log("LTE_PDCP_DL_Config") # source.enable_log("LTE_PDCP_UL_Config") # source.enable_log("LTE_PDCP_UL_Data_PDU") # source.enable_log("LTE_PDCP_DL_Ctrl_PDU") # source.enable_log("LTE_PDCP_UL_Ctrl_PDU") # source.enable_log("LTE_PDCP_DL_Stats") # source.enable_log("LTE_PDCP_UL_Stats") # source.enable_log("LTE_PDCP_DL_SRB_Integrity_Data_PDU") # source.enable_log("LTE_PDCP_UL_SRB_Integrity_Data_PDU") source.enable_log("LTE_PDCP_DL_Cipher_Data_PDU") source.enable_log("LTE_PDCP_UL_Cipher_Data_PDU") # source.enable_log("LTE_RLC_UL_Config_Log_Packet") # source.enable_log("LTE_RLC_DL_Config_Log_Packet") source.enable_log("LTE_RLC_UL_AM_All_PDU") source.enable_log("LTE_RLC_DL_AM_All_PDU")
def __init__(self, config): Analyzer.__init__(self) self.__log_dir = util.get_mobileinsight_log_path() self.__dec_log_dir = util.get_mobileinsight_log_decoded_path() self.__orig_file = "" self.__raw_msg = {} self.__raw_msg_key = "" self.__msg_cnt = 0 self.__dec_msg = [] self.__is_wifi_enabled = False self.state = states[0] self.sr_round = 0 self.round = 0 self.sr_record = [] self.record = { 'round': 0, 'total': 0, 'msg': [], } self.__sr_log_path = "%s/sr/sr_latency_%s_%s_%s.txt" % \ (util.get_mobileinsight_path(), datetime.now().strftime('%Y%m%d_%H%M%S'), util.get_phone_info(), util.get_operator_info()) self.__MILabPluginName = 'SRLatency' self.__own_log_uploaded_dir = os.path.join( util.get_mobileinsight_plugin_path(), self.__MILabPluginName, "log", "uploaded") if not os.path.exists(self.__own_log_uploaded_dir): os.makedirs(self.__own_log_uploaded_dir) self.__task = "Unknown" if 'task' in config: self.__task = config['task'] self.__own_log_task_dir = os.path.join( util.get_mobileinsight_plugin_path(), self.__MILabPluginName, "log", self.__task) if not os.path.exists(self.__own_log_task_dir): os.makedirs(self.__own_log_task_dir) try: if config['is_use_wifi'] == '1': self.__is_use_wifi = True else: self.__is_use_wifi = False except BaseException: self.__is_use_wifi = False # try: # if config['is_dec_log'] == '1': # self.__is_dec_log = True # self.__dec_log_name = "diag_log_" + \ # datetime.datetime.now().strftime('%Y%m%d_%H%M%S') + ".txt" # self.__dec_log_path = os.path.join( # self.__dec_log_dir, self.__dec_log_name) # else: # self.__is_dec_log = False # except BaseException: # self.__is_dec_log = False try: self.__dec_log_type = config['log_type'] except BaseException: self.__dec_log_type = "" if not os.path.exists(self.__log_dir): os.makedirs(self.__log_dir) if not os.path.exists(self.__dec_log_dir): os.makedirs(self.__dec_log_dir) self.add_source_callback(self._logger_filter) # Add this code at the end of onCreate() self.br = BroadcastReceiver(self.on_broadcast, actions=['MobileInsight.Main.StopService']) self.br.start()