-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Including reporting script for detecting performance violations
- Loading branch information
Showing
6 changed files
with
75 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from profiler import data | ||
import argparse | ||
|
||
# The script takes a command and a database path and looks | ||
# the performance anomalies in the performance history of that | ||
# command across the profiled runs. | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("benchmark", type=str) | ||
parser.add_argument("db_path", type=str) | ||
|
||
args = parser.parse_args() | ||
|
||
# Processes the set of previously written logs | ||
# The threshold (ratio) of allowable performance degradation between profiling runs | ||
threshold = 1.10 # Percent difference | ||
|
||
db = data.FileBasedProfileDB(args.db_path) | ||
dt = db.find(f"{args.benchmark}") | ||
|
||
|
||
if len(dt) >= 2: | ||
first_profile = dt[0] | ||
curr_profile = dt[len(dt) - 1] | ||
first_time = first_profile.user_time_sec | ||
curr_time = curr_profile.user_time_sec | ||
|
||
formatted_first_profile = str(first_profile).replace('\\n', '\n').replace('\\t', '\t') | ||
formatted_curr_profile = str(curr_profile).replace('\\n', '\n').replace('\\t', '\t') | ||
|
||
if float(curr_time) > threshold * float(first_time): | ||
print(f"*** First profile:\n {formatted_first_profile}") | ||
print(f"*** Current profile:\n {formatted_curr_profile}") | ||
print(f"Major performance increase detected on {args.benchmark}: curr: {first_time} vs first: {curr_time}") | ||
raise SystemExit(f"Potential performance degradation detected on {args.benchmark}: curr: {first_time} vs first: {curr_time}") | ||
|
||
if threshold * float(curr_time) < float(first_time): | ||
print(f"Major performance increase detected on {args.benchmark}: curr: {first_time} vs first: {curr_time}") | ||
|
||
print(f"*** First profile:\n {formatted_first_profile}") | ||
print(f"*** Current profile:\n {formatted_curr_profile}") | ||
print( | ||
f"TileDB version ver = first: {first_profile.tiledbsoma_version} curr: {curr_profile.tiledbsoma_version}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from . import data | ||
|
||
__all__ = [ | ||
"data", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .profiler import main | ||
import profiler | ||
|
||
if __name__ == "__main__": | ||
main() | ||
profiler.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters