mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-11 09:40:24 +00:00
tool/metrics: add metrics file as input param
This commit is contained in:
parent
e174300abb
commit
9aec9f0213
@ -74,7 +74,7 @@ def metric_measure(metric_name, function_name, actual):
|
|||||||
metric_list(metric_name + '_LIST', function_name)
|
metric_list(metric_name + '_LIST', function_name)
|
||||||
|
|
||||||
|
|
||||||
def analyze_folders(btstack_root, folders):
|
def analyze_folders(btstack_root, folders, metrics_file):
|
||||||
global excluded_functions
|
global excluded_functions
|
||||||
|
|
||||||
# File,Name,"'goto' keyword count (raw source)","Return points","Statement count (raw source)(local)",
|
# File,Name,"'goto' keyword count (raw source)","Return points","Statement count (raw source)(local)",
|
||||||
@ -88,7 +88,7 @@ def analyze_folders(btstack_root, folders):
|
|||||||
metrics[key + '_DEVIATIONS'] = 0
|
metrics[key + '_DEVIATIONS'] = 0
|
||||||
|
|
||||||
# for now, just read the file
|
# for now, just read the file
|
||||||
with open("metrics.tsv") as fd:
|
with open(metrics_file) as fd:
|
||||||
rd = csv.reader(fd, delimiter="\t")
|
rd = csv.reader(fd, delimiter="\t")
|
||||||
last_function_name = ''
|
last_function_name = ''
|
||||||
for row in rd:
|
for row in rd:
|
||||||
@ -119,13 +119,13 @@ def analyze_folders(btstack_root, folders):
|
|||||||
for key,value in function_metrics.items():
|
for key,value in function_metrics.items():
|
||||||
metric_measure(key, qualified_function_name, int(function_metrics[key]))
|
metric_measure(key, qualified_function_name, int(function_metrics[key]))
|
||||||
|
|
||||||
def analyze(folders):
|
def analyze(folders, metrics_file):
|
||||||
# print ("\nAnalyzing:")
|
# print ("\nAnalyzing:")
|
||||||
# for path in folders:
|
# for path in folders:
|
||||||
# print('- %s' % path)
|
# print('- %s' % path)
|
||||||
# analyze_folder(btstack_root + "/" + path)
|
# analyze_folder(btstack_root + "/" + path)
|
||||||
btstack_root = os.path.abspath(os.path.dirname(sys.argv[0]) + '/../..')
|
btstack_root = os.path.abspath(os.path.dirname(sys.argv[0]) + '/../..')
|
||||||
analyze_folders(btstack_root, folders)
|
analyze_folders(btstack_root, folders, metrics_file)
|
||||||
|
|
||||||
def list_targets():
|
def list_targets():
|
||||||
print ("Targets:")
|
print ("Targets:")
|
||||||
@ -171,7 +171,7 @@ def list_deviations():
|
|||||||
print ('\n'.join(value))
|
print ('\n'.join(value))
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
analyze(folders)
|
analyze(folders, "metrics.tsv")
|
||||||
list_metrics_table()
|
list_metrics_table()
|
||||||
# list_targets()
|
# list_targets()
|
||||||
# list_metrics()
|
# list_metrics()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user