Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion problog/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def show_profile(self, aggregate=0):
"location",
)
s += "-" * 100 + "\n"
for tm, key in sorted((t, k) for k, t in self.timestats.items()):
for tm, key in sorted(((t, k) for k, t in self.timestats.items()), key=lambda t: t[0]):
term, location = key
nb = self.resultstats[key]
cl = self.callstats[key]
Expand Down
9 changes: 9 additions & 0 deletions problog/test/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import random
import unittest

from problog.debug import EngineTracer
from problog.engine import DefaultEngine
from problog.logic import Term, Constant
from problog.program import PrologString
Expand Down Expand Up @@ -227,6 +228,12 @@ def test_cycle_badcode(self):
self.edges, edges, msg="Test failed for random seed %s" % seed
)

def test_profile_equal_timing():
tracer = EngineTracer()
tracer.timestats[(Term('a'), 0)] = 0.000
tracer.timestats[(Term('b'), 1)] = 0.000
table = tracer.show_profile()


def list_paths(source):
names = dict(
Expand Down Expand Up @@ -265,3 +272,5 @@ def _list_paths(source, node_id, path):
yield add
else: # Don't support negation for now
raise Exception("Unexpected node type")


2 changes: 1 addition & 1 deletion problog/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '2.2.8'
version = '2.2.9'