1# Copyright (c) 2017 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import re 6 7from autotest_lib.client.common_lib import error 8 9 10class JMIDataHelperBase(object): 11 """This is a base class for JMIDataV3Helper. 12 13 It helps in extracting relevant JMI data from javascript log file. 14 """ 15 16 def __init__(self, log_file_content, jmidata_str): 17 if not log_file_content: 18 raise error.TestNAError('Logfile is empty.') 19 self._log_file = log_file_content 20 self._ExtractJMIDataFromLogFile(jmidata_str) 21 22 def _ExtractJMIDataFromLogFile(self, jmidata_str): 23 jmi_data_from_log_reg = r'(\[\s*"%s"\s*,.*\])' % jmidata_str 24 self._jmi_list = re.findall(jmi_data_from_log_reg, self._log_file) 25 if len(self._jmi_list) <= 0: 26 raise error.TestNAError("Logfile doesn't contain any jmi data.") 27 28 def GetAudioReceivedBytesList(self): 29 raise NotImplementedError 30 31 def GetAudioSentBytesList(self): 32 raise NotImplementedError 33 34 def GetAudioReceivedEnergyList(self): 35 raise NotImplementedError 36 37 def GetAudioSentEnergyList(self): 38 raise NotImplementedError 39 40 def GetVideoSentBytesList(self): 41 raise NotImplementedError 42 43 def GetVideoReceivedBytesList(self): 44 raise NotImplementedError 45 46 def GetVideoIncomingFramerateReceivedList(self): 47 raise NotImplementedError 48 49 def GetVideoOutgoingFramerateSentList(self): 50 raise NotImplementedError 51 52 def GetVideoIncomingFramerateDecodedList(self): 53 raise NotImplementedError 54 55 def GetVideoIncomingFramerateList(self): 56 raise NotImplementedError 57 58 def GetVideoIncomingFramerateListForAudioOnlyUser(self): 59 raise NotImplementedError 60 61 def GetVideoSentFrameWidthList(self): 62 raise NotImplementedError 63 64 def GetVideoSentFrameHeightList(self): 65 raise NotImplementedError 66 67 def GetCPULimitedResolutionList(self): 68 raise NotImplementedError 69 70 def GetVideoPacketsSentList(self): 71 raise NotImplementedError 72 73 def GetVideoPacketsLostList(self): 74 raise NotImplementedError 75 76 def GetVideoIncomingFramesDecodedList(self): 77 raise NotImplementedError 78 79 def GetVideoOutgoingFramesEncodedList(self): 80 raise NotImplementedError 81 82 def GetVideoAdaptationChangeList(self): 83 raise NotImplementedError 84 85 def GetVideoEncodeTimeList(self): 86 raise NotImplementedError 87 88 def GetBandwidthLimitedResolutionList(self): 89 raise NotImplementedError 90 91 def GetVideoReceivedFrameHeightList(self): 92 raise NotImplementedError 93 94 def GetVideoOutgoingFramerateInputList(self): 95 raise NotImplementedError 96 97 def GetVideoReceivedFrameWidthList(self): 98 raise NotImplementedError 99 100 def GetVideoEncodeCpuUsagePercentList(self): 101 raise NotImplementedError 102 103 def GetNumberOfActiveIncomingVideoStreams(self): 104 raise NotImplementedError 105 106 def GetCpuUsageList(self, cpu_type): 107 raise NotImplementedError 108 109 def GetNumOfProcessors(self): 110 raise NotImplementedError 111 112 def GetTotalCpuPercentage(self): 113 raise NotImplementedError 114 115 def GetBrowserCpuPercentage(self): 116 raise NotImplementedError 117 118 def GetGpuCpuPercentage(self): 119 raise NotImplementedError 120 121 def GetNaclEffectsCpuPercentage(self): 122 raise NotImplementedError 123 124 def GetRendererCpuPercentage(self): 125 raise NotImplementedError 126