blob: d368398f05d635577d0b06e034b482b96cc8cb9f [file] [log] [blame]
# Copyright (c) 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from autotest_lib.server.cros import cfm_jmidata_v3_helper
def GetDataFromLogs(testcase, data_type, log_lines):
"""Returns a list of data_type from JMI data in javascript log.
@param testcase: Testcase instance.
@param data_type: Type of data to be retrieved (audio sent/audio received
etc. See above for complete list.).
@param log_lines: log_file to be parsed.
@return A list of data_type from javascript log.
"""
helper = cfm_jmidata_v3_helper.JMIDataV3Helper(log_lines)
data_type_to_func_map = {
'video_sent_bytes': helper.GetVideoSentBytesList,
'video_received_bytes': helper.GetVideoReceivedBytesList,
'audio_sent_bytes': helper.GetAudioSentBytesList,
'audio_received_bytes': helper.GetAudioReceivedBytesList,
'audio_received_energy_level': helper.GetAudioReceivedEnergyList,
'audio_sent_energy_level': helper.GetAudioSentEnergyList,
'framerate_received': helper.GetVideoIncomingFramerateReceivedList,
'framerate_sent': helper.GetVideoOutgoingFramerateSentList,
'framerate_decoded': helper.GetVideoIncomingFramerateDecodedList,
'frames_decoded': helper.GetVideoIncomingFramesDecodedList,
'frames_encoded': helper.GetVideoOutgoingFramesEncodedList,
'average_encode_time': helper.GetVideoEncodeTimeList,
'framerate_to_renderer': helper.GetVideoIncomingFramerateList,
'framerate_outgoing': helper.GetVideoOutgoingFramerateInputList,
'video_sent_frame_width': helper.GetVideoSentFrameWidthList,
'video_received_frame_width': helper.GetVideoReceivedFrameWidthList,
'video_sent_frame_height': helper.GetVideoSentFrameHeightList,
'video_received_frame_height': helper.GetVideoReceivedFrameHeightList,
'cpu_adaptation': helper.GetCPULimitedResolutionList,
'bandwidth_adaptation': helper.GetBandwidthLimitedResolutionList,
'adaptation_changes': helper.GetVideoAdaptationChangeList,
'video_packets_sent': helper.GetVideoPacketsSentList,
'video_packets_lost': helper.GetVideoPacketsLostList,
'video_encode_cpu_usage': helper.GetVideoEncodeCpuUsagePercentList,
'num_active_vid_in_streams':
helper.GetNumberOfActiveIncomingVideoStreams,
'cpu_processors': helper.GetNumOfProcessors,
'cpu_percent': helper.GetTotalCpuPercentage,
'browser_cpu_percent': helper.GetBrowserCpuPercentage,
'gpu_cpu_percent': helper.GetGpuCpuPercentage,
'nacl_effects_cpu_percent': helper.GetNaclEffectsCpuPercentage,
'renderer_cpu_percent': helper.GetRendererCpuPercentage,
}
data_array = data_type_to_func_map[data_type]()
logging.info('Data Type: %s, Data Array: %s', data_type, str(data_array))
return data_array