Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
litsupport/modules/codesize.py
Show All 28 Lines | if os.path.exists(filename): | ||||
continue | continue | ||||
values = line.split() | values = line.split() | ||||
if len(values) < 2: | if len(values) < 2: | ||||
logging.info("Ignoring malformed output line: %s", line) | logging.info("Ignoring malformed output line: %s", line) | ||||
continue | continue | ||||
if values[0] == 'Total': | if values[0] == 'Total': | ||||
continue | continue | ||||
try: | try: | ||||
name = values[0] | # Strip leading underscores and periods, which are | ||||
# platform-dependent. E.g. __text -> text or .text -> text | |||||
name = values[0].lstrip("__").lstrip(".") | |||||
val = int(values[1]) | val = int(values[1]) | ||||
metrics['size.%s' % name] = val | metrics['size_%s' % name] = val | ||||
except ValueError: | except ValueError: | ||||
logging.info("Ignoring malformed output line: %s", line) | logging.info("Ignoring malformed output line: %s", line) | ||||
azharudd: I was just thinking maybe, as a good measure, we can assert here that only one of `size.__text`… | |||||
paquetteAuthorUnsubmitted Sure, that sounds like a good idea. Lemme spin up another patch. paquette: Sure, that sounds like a good idea. Lemme spin up another patch. | |||||
return metrics | return metrics | ||||
def mutatePlan(context, plan): | def mutatePlan(context, plan): | ||||
plan.metric_collectors.append(_getCodeSize) | plan.metric_collectors.append(_getCodeSize) |
I was just thinking maybe, as a good measure, we can assert here that only one of size.__text or size..text is present in metrics.