xmlrdf/commit
Added suppiort to profile execution of rules
author | Jan Wielemaker |
---|---|
Mon Apr 23 11:43:25 2012 +0200 | |
committer | Jan Wielemaker |
Mon Apr 23 11:43:25 2012 +0200 | |
commit | ec8cf3d77f667cda6e5463ed4e89756aa9e54340 |
tree | 9b54e628ca325432a5931bd299ec35d4f72ae500 |
parent | 3e95baa137fac69d3ae9fd094077aeb7e696a281 |
Diff style: patch stat
diff --git a/lib/xmlrdf/rdf_rewrite.pl b/lib/xmlrdf/rdf_rewrite.pl index 500d68e..310301c 100644 --- a/lib/xmlrdf/rdf_rewrite.pl +++ b/lib/xmlrdf/rdf_rewrite.pl @@ -101,8 +101,9 @@ rewrite_step(Module, Graph, Rule) :- rdf_statistics(triples(TC0)), statistics(cputime, T0), ( option(transaction(true), Options, true) - -> rdf_transaction(call_rewrite_rule(Id, Module, Graph, Options), - Rule) + -> rdf_transaction( + call_rewrite_rule(Id, Module, Graph, Options), + Rule) ; call_rewrite_rule(Id, Module, Graph, Options) ), statistics(cputime, T1), @@ -119,7 +120,19 @@ rewrite_step(Module, Graph, Rule) :- ; true ). +%% call_rewrite_rule(+RuleID, +Module, +Graph, +Options) +% +% If debug(profile(rule(RuleID))) is enabled, the execution of the +% rule is profiled. + +call_rewrite_rule(Rule, Module, Graph, Options) :- + debugging(profile(rule(Rule))), + profile(call_rewrite_rule2(Rule, Module, Graph, Options)). call_rewrite_rule(Rule, Module, Graph, Options) :- + call_rewrite_rule2(Rule, Module, Graph, Options). + + +call_rewrite_rule2(Rule, Module, Graph, Options) :- bnode_terms(Options, BNodes, BNodeOptions, _RestOptions), BNodes \== [], !, Template =.. [v,Actions|BNodes], @@ -128,7 +141,7 @@ call_rewrite_rule(Rule, Module, Graph, Options) :- Bag), create_bnodes(BNodeOptions, 2, Bag, Graph), call_actions(Bag). -call_rewrite_rule(Rule, Module, Graph, Options) :- +call_rewrite_rule2(Rule, Module, Graph, Options) :- findall(Actions, Module:rdf_mapping_rule(Rule, _Name, Graph, Actions, Options), Goals),