Lines Matching refs:counter
190 def output_rpn_equation_code(set, counter, equation):
212 raise Exception("Failed to resolve variable " + operand + " in equation " + equation + " for " + set.name + " :: " + counter.get('name'));
222 counter.get('name') + ".\nThis is probably due to some unhandled RPN function, in the equation \"" +
234 def splice_rpn_expression(set, counter, expression):
250 raise Exception("Failed to resolve variable " + operand + " in expression " + expression + " for " + set.name + " :: " + counter.get('name'));
259 counter.get('name') + ".\nThis is probably due to some unhandled RPN operation, in the expression \"" +
264 def output_counter_read(gen, set, counter):
266 c("/* {0} :: {1} */".format(set.name, counter.get('name')))
268 if counter.read_hash in hashed_funcs:
269 c("#define %s \\" % counter.read_sym)
271 c("%s" % hashed_funcs[counter.read_hash])
274 ret_type = counter.get('data_type')
278 read_eq = counter.get('equation')
281 c(counter.read_sym + "(MAYBE_UNUSED struct gen_perf *perf,\n")
282 c_indent(len(counter.read_sym) + 1)
285 c_outdent(len(counter.read_sym) + 1)
289 output_rpn_equation_code(set, counter, read_eq)
293 hashed_funcs[counter.read_hash] = counter.read_sym
296 def output_counter_max(gen, set, counter):
297 max_eq = counter.get('max_equation')
299 if not counter.has_max_func():
303 c("/* {0} :: {1} */".format(set.name, counter.get('name')))
305 if counter.max_hash in hashed_funcs:
306 c("#define %s \\" % counter.max_sym())
308 c("%s" % hashed_funcs[counter.max_hash])
311 ret_type = counter.get('data_type')
316 c(counter.max_sym() + "(struct gen_perf *perf)\n")
319 output_rpn_equation_code(set, counter, max_eq)
323 hashed_funcs[counter.max_hash] = counter.max_sym()
353 def output_counter_report(set, counter, current_offset):
354 data_type = counter.get('data_type')
361 semantic_type = counter.get('semantic_type')
369 availability = counter.get('availability')
371 output_availability(set, availability, counter.get('name'))
374 c("counter = &query->counters[query->n_counters++];\n")
375 c("counter->oa_counter_read_" + data_type + " = " + set.read_funcs[counter.get('symbol_name')] + ";\n")
376 c("counter->name = \"" + counter.get('name') + "\";\n")
377 c("counter->desc = \"" + counter.get('description') + "\";\n")
378 c("counter->type = GEN_PERF_COUNTER_TYPE_" + semantic_type_uc + ";\n")
379 c("counter->data_type = GEN_PERF_COUNTER_DATA_TYPE_" + data_type_uc + ";\n")
380 c("counter->raw_max = " + set.max_values[counter.get('symbol_name')] + ";\n")
383 c("counter->offset = " + str(current_offset) + ";\n")
431 # Wraps a <counter> element from the oa-*.xml files.
446 # Compute the hash of a counter's equation by expanding (including all the
517 xml_counters = self.xml.findall("counter")
520 counter = Counter(self, xml_counter)
521 self.counters.append(counter)
522 self.counter_vars["$" + counter.get('symbol_name')] = counter
523 self.read_funcs[counter.get('symbol_name')] = counter.read_sym
524 self.max_values[counter.get('symbol_name')] = counter.max_value()
526 for counter in self.counters:
527 counter.compute_hashes()
644 for counter in set.counters:
645 output_counter_read(gen, set, counter)
646 output_counter_max(gen, set, counter)
708 c("struct gen_perf_query_counter *counter;\n")
720 for counter in counters:
721 offset = output_counter_report(set, counter, offset)
724 c("\nquery->data_size = counter->offset + gen_perf_query_counter_get_size(counter);\n")