| 16 | PRICE_OUTPUT_PER_1M = 0.42 # output (completion) tokens |
| 17 | |
| 18 | def get_coverage(profdata_path, cov_so_path): |
| 19 | cmd = [ |
| 20 | "llvm-cov", "export", |
| 21 | "--summary-only", |
| 22 | f"-instr-profile={profdata_path}", |
| 23 | cov_so_path |
| 24 | ] |
| 25 | result = subprocess.run(cmd, capture_output=True, text=True) |
| 26 | if result.returncode != 0: |
| 27 | return 0 |
| 28 | try: |
| 29 | data = json.loads(result.stdout) |
| 30 | branches = data["data"][0]["totals"]["branches"]["covered"] |
| 31 | return branches |
| 32 | except (KeyError, IndexError, json.JSONDecodeError): |
| 33 | return 0 |
| 34 | |
| 35 | |
| 36 | def process_coverage(project, statistics_dir): |