Skip to content

Commit

Permalink
Early version of profiler harness
Browse files Browse the repository at this point in the history
  • Loading branch information
beroy committed Jan 19, 2024
1 parent 61c8501 commit fa0bee9
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/profiler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: TileDB-SOMA Profiler run

on:
pull_request:

push:
branches:
- main
- 'release-*'
workflow_dispatch:

jobs:

check-links:

name: Setup profiler

run: |
python -m venv profiler_env
source profiler_env/bin/activate
pip install -e ./profiler
run: |
./perf_checker.sh
22 changes: 22 additions & 0 deletions tools/perf_checker/benchmark1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from time import perf_counter

import cellxgene_census

import tiledbsoma as soma

census_S3_latest = dict(census_version="2023-10-23")


def main():
t1 = perf_counter()
with cellxgene_census.open_soma(**census_S3_latest) as census:
with census["census_data"]["homo_sapiens"].axis_query(
measurement_name="RNA",
obs_query=soma.AxisQuery(value_filter="""tissue_general == 'eye'"""),
) as query:
query.to_anndata(X_name="raw")
t2 = perf_counter()
print(f"End to end time {t2 - t1}")


main()
28 changes: 28 additions & 0 deletions tools/perf_checker/profile_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import data

# Processes the set of previously written logs

threshold = 1.10 # Percent difference

db = data.FileBasedProfileDB()
actual_max_ts = 0
dt = db.find("python ann_data.py")
last_two = dt[-2:]
c = 0

for s in last_two:
new_db = sorted(dt, key=lambda ProfileData: ProfileData.timestamp)

L = []
L[0] = dt[0].user_time_sec + dt[0].elapsed_time
L[1] = dt[1].user_time_sec + dt[1].elapsed_time
for i in range(0, len(dt)):
print(f"{i} dt[{i}].user_time_sec = {dt[i].user_time_sec} ts {dt[i].timestamp}")
print(f"Prev = {L[0]} Curr = {L[1]}")

if threshold * float(L[1]) < float(L[0]) or float(L[1]) > threshold * float(L[0]):
raise SystemExit(f"Potential performance degradation detected {L[0]} va {L[1]}")
print("No recent performance degradation detected")
print(
f"Prev TBD version = {dt[0].tiledbsoma_version} Curr TBD version = {dt[1].tiledbsoma_version}"
)

0 comments on commit fa0bee9

Please sign in to comment.