Skip to content

Commit

Permalink
Made file open into benchmark.py relative, renamed scalene.py to `e…
Browse files Browse the repository at this point in the history
…ntrypoint.py` to avoid naming conflicts
  • Loading branch information
sternj committed Nov 6, 2020
1 parent 0e6d09e commit 8fa5d4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions benchmarks/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import statistics

python = "python3"
progname = "/Users/emery/git/scalene/benchmarks/julia1_nopil.py"
progname = os.path.join(os.path.dirname(__file__), "julia1_nopil.py")
number_of_runs = 1 # We take the average of this many runs.

# Output timing string from the benchmark.
Expand Down Expand Up @@ -133,7 +133,7 @@

# benchmarks = [(baseline, "baseline", "_original program_"), (pprofile_deterministic, "`pprofile` _(deterministic)_")]
# benchmarks = [(baseline, "baseline", "_original program_"), (pprofile_statistical, "pprofile_statistical", "`pprofile` _(statistical)_")]
benchmarks = [(baseline, "baseline", "_original program_"), (py_spy, "py_spy", "`py-spy`")]
benchmarks = [(baseline, "baseline", "_original program_"), (py_spy, "py_spy", "`py-spy`"), (scalene_cpu, "scalene_cpu", "`scalene` _(CPU only)_"), (scalene_cpu_memory, "scalene_cpu_memory", "`scalene` _(CPU + memory)_")]

average_time = {}
check = ":heavy_check_mark:"
Expand Down
6 changes: 4 additions & 2 deletions scalene/__main__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import sys


def main():
try:
from scalene import scalene
scalene.Scalene.main()
from scalene import entrypoint
entrypoint.Scalene.main()
except Exception as exc:
sys.stderr.write("ERROR: Calling scalene main function failed: %s\n" % exc)
sys.exit(1)


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion scalene/scalene.py → scalene/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ def should_trace(filename: str) -> bool:
if filename[0] == "<":
# Not a real file.
return False
if "scalene.py" in filename or "scalene/__main__.py" in filename:
if "entrypoint.py" in filename or "scalene/__main__.py" in filename:
# Don't profile the profiler.
return False
if Scalene.__profile_all:
Expand Down

0 comments on commit 8fa5d4a

Please sign in to comment.