Skip to content

Commit

Permalink
Profile updated to Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
MassimoLauria committed Aug 8, 2020
1 parent 288e0f9 commit 16f469b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# This is autogenerated
cnfformula/version.py
cnfgen/version.py

8 changes: 3 additions & 5 deletions profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

import os
import sys
from cProfile import run
from contextlib import contextmanager


@contextmanager
def erase_stdout():

with file(os.devnull, "w") as null:
with open(os.devnull, "w") as null:
old_stdout = sys.stdout
sys.stdout = null

Expand All @@ -22,7 +23,6 @@ def erase_stdout():

def cnfgen_call():
from cnfgen import cnfgen
from cnfgen import cnfgen

cmd = ["cnfgen"] + sys.argv[1:]

Expand All @@ -32,10 +32,8 @@ def cnfgen_call():

if __name__ == '__main__':

from cProfile import run as profile

if len(sys.argv) <= 1:
print("Usage: {} <cnfgen_args>".format(sys.argv[0]), file=sys.stderr)
sys.exit(-1)

profile('cnfgen_call()', sort='tottime')
run('cnfgen_call()', sort='tottime')

0 comments on commit 16f469b

Please sign in to comment.