def parse_xml_jtl(self, granularity):
data = defaultdict(list)<EOL>processed_data = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))<EOL>for input_file in self.infile_list:<EOL><INDENT>logger.info('<STR_LIT>', input_file)<EOL>timestamp_format = None<EOL>tree = ElementTree.parse(input_file)<EOL>samples = tree.findall('<STR_LIT>') + tree.findall('<STR_LIT>')<EOL>for sample in samples:<EOL><INDENT>if not timestamp_format or timestamp_format == '<STR_LIT>':<EOL><INDENT>timestamp_format = naarad.utils.detect_timestamp_format(sample.get('<STR_LIT>'))<EOL><DEDENT>if timestamp_format == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>ts = naarad.utils.get_standardized_timestamp(sample.get('<STR_LIT>'), timestamp_format)<EOL>if ts == -<NUM_LIT:1>:<EOL><INDENT>continue<EOL><DEDENT>ts = naarad.utils.reconcile_timezones(ts, self.timezone, self.graph_timezone)<EOL>aggregate_timestamp, averaging_factor = self.get_aggregation_timestamp(ts, granularity)<EOL>self.aggregate_count_over_time(processed_data, sample, [self._sanitize_label(sample.get('<STR_LIT>')), '<STR_LIT>'], aggregate_timestamp)<EOL>self.aggregate_values_over_time(processed_data, sample, [self._sanitize_label(sample.get('<STR_LIT>')), '<STR_LIT>'], ['<STR_LIT:t>', '<STR_LIT>'], aggregate_timestamp)<EOL>logger.info('<STR_LIT>', input_file)<EOL><DEDENT><DEDENT>logger.info('<STR_LIT>')<EOL>self.average_values_for_plot(processed_data, data, averaging_factor)<EOL>logger.info('<STR_LIT>')<EOL>for csv in data.keys():<EOL><INDENT>self.csv_files.append(csv)<EOL>with open(csv, '<STR_LIT:w>') as csvf:<EOL><INDENT>csvf.write('<STR_LIT:\n>'.join(sorted(data[csv])))<EOL><DEDENT><DEDENT>logger.info('<STR_LIT>')<EOL>self.calculate_key_stats(processed_data)<EOL>return True<EOL>
Parse Jmeter workload output in XML format and extract overall and per transaction data and key statistics

:param string granularity: The time period over which to aggregate and average the raw data. Valid values are 'hour', 'minute' or 'second'
:return: status of the metric parse