mirror of https://github.com/ArduPilot/ardupilot
Tools: fixed ccache test for newer ccache version
This commit is contained in:
parent
5b61793b33
commit
fc5e8a6f31
|
@ -11,6 +11,7 @@ import os
|
|||
parser = argparse.ArgumentParser(description='test ccache performance')
|
||||
parser.add_argument('--boards', default='MatekF405,MatekF405-bdshot', help='boards to test')
|
||||
parser.add_argument('--min-cache-pct', type=int, default=75, help='minimum acceptable ccache hit rate')
|
||||
parser.add_argument('--display', action='store_true', help='parse and show ccache stats')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -24,9 +25,21 @@ def ccache_stats():
|
|||
m = re.match(r"cache.hit\D*(\d+)$", line)
|
||||
if m is not None:
|
||||
hits += int(m.group(1))
|
||||
|
||||
m = re.match(r"cache.miss\D*(\d+)", line)
|
||||
if m is not None:
|
||||
miss += int(m.group(1))
|
||||
|
||||
m = re.match(r"\s*Hits:\s*(\d+)", line)
|
||||
if m is not None:
|
||||
hits += int(m.group(1))
|
||||
|
||||
m = re.match(r"\s*Misses:\s*(\d+)", line)
|
||||
if m is not None:
|
||||
miss += int(m.group(1))
|
||||
|
||||
if line.startswith("Primary"):
|
||||
break
|
||||
return (hits, miss)
|
||||
|
||||
|
||||
|
@ -35,6 +48,11 @@ def build_board(boardname):
|
|||
subprocess.run(["./waf", "clean", "copter"])
|
||||
|
||||
|
||||
if args.display:
|
||||
(hits, misses) = ccache_stats()
|
||||
print("Hits=%u misses=%u" % (hits, misses))
|
||||
sys.exit(0)
|
||||
|
||||
boards = args.boards.split(",")
|
||||
if len(boards) != 2:
|
||||
print(boards)
|
||||
|
@ -42,6 +60,7 @@ if len(boards) != 2:
|
|||
sys.exit(1)
|
||||
|
||||
os.environ['CCACHE_DIR'] = os.path.join(os.getcwd(), 'build', 'ccache')
|
||||
subprocess.run(["ccache", "--version"])
|
||||
subprocess.run(["ccache", "-C", "-z"])
|
||||
build_board(boards[0])
|
||||
subprocess.run(["ccache", "-z"])
|
||||
|
|
Loading…
Reference in New Issue