2022-10-31 15:39:45 -05:00
|
|
|
#!@PYTHON_EXECUTABLE@
|
|
|
|
|
|
2025-09-12 23:47:58 +05:30
|
|
|
# Copyright (c) Advanced Micro Devices, Inc.
|
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
2024-10-15 11:20:40 -04:00
|
|
|
import rocprofsys
|
2022-10-31 15:39:45 -05:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
"-i",
|
|
|
|
|
"--input",
|
|
|
|
|
type=str,
|
|
|
|
|
nargs="+",
|
|
|
|
|
help="Input code coverage",
|
|
|
|
|
default=None,
|
|
|
|
|
required=True,
|
|
|
|
|
)
|
|
|
|
|
parser.add_argument(
|
|
|
|
|
"-o",
|
|
|
|
|
"--output",
|
|
|
|
|
type=str,
|
|
|
|
|
help="Output code coverage",
|
|
|
|
|
default=None,
|
|
|
|
|
required=True,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
data = None
|
|
|
|
|
for itr in args.input:
|
2024-10-15 11:20:40 -04:00
|
|
|
_summary, _details = rocprofsys.coverage.load(itr)
|
2022-10-31 15:39:45 -05:00
|
|
|
if data is None:
|
|
|
|
|
data = _details
|
|
|
|
|
else:
|
2024-10-15 11:20:40 -04:00
|
|
|
data = rocprofsys.coverage.concat(data, _details)
|
2022-10-31 15:39:45 -05:00
|
|
|
|
2024-10-15 11:20:40 -04:00
|
|
|
summary = rocprofsys.coverage.get_summary(data)
|
|
|
|
|
top = rocprofsys.coverage.get_top(data)
|
|
|
|
|
bottom = rocprofsys.coverage.get_bottom(data)
|
2022-10-31 15:39:45 -05:00
|
|
|
|
|
|
|
|
print("Top code coverage:")
|
|
|
|
|
for itr in top:
|
|
|
|
|
print(
|
|
|
|
|
f" {itr.count} | {itr.function} | {itr.module}:{itr.line} | {itr.source}"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
print("Bottom code coverage:")
|
|
|
|
|
for itr in bottom:
|
|
|
|
|
print(
|
|
|
|
|
f" {itr.count} | {itr.function} | {itr.module}:{itr.line} | {itr.source}"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
print("\nSaving code coverage")
|
2024-10-15 11:20:40 -04:00
|
|
|
rocprofsys.coverage.save(summary, data, args.output)
|