Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] what does "0 calls" imply in Ltac profile output?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] what does "0 calls" imply in Ltac profile output?


Chronological Thread 
  • From: Jason Gross <jasongross9 AT gmail.com>
  • To: Jonathan <jonikelee AT gmail.com>
  • Cc: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] what does "0 calls" imply in Ltac profile output?
  • Date: Sat, 25 Jul 2020 21:55:03 -0400
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-ed1-f44.google.com
  • Ironport-phdr: 9a23:Zge7wRaNZN+Rg+mDJWEoSg3/LSx+4OfEezUN459isYplN5qZr8y/bnLW6fgltlLVR4KTs6sC17OI9f2+EjBfqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5zIRmsrQjct8YajIRgJ60s1hbHv3xEdvhMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW874s3rrgTDQhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VDq+46t3ThLjlSEKPCM7/m7KkMx9lK1UoByjqBJ/zYDaY5ybOuRica7GZ9wWWXBMU9xNWyBdAI6xaZYEAeobPeZfqonwv18AogGlBQmrAuPk1z5GhmXx3a0hyOQqDAbL3A46ENIVt3TUqtr1NL0VUeCu16nFyS7Ob/xT2Tjn6YjIdgotru2LXbJ1aMfcz1QkGAzZgFuKs4PlIy+V2foXs2id9+dtV+CihnImpgx+oDWix9shh5XUio8Vzl3J8SZ0zZg6K9C6RkB2fN2pHZ9Ouy+aKYZ4QsMvT3xmtSony7AKpZG2cS4Xw5ok3x7Sc+KLf5SM7x75V+ucIS10iGx5dL+8nRq//ketx+vhXceuyllKtDBKktzUu3ANyRPT7s+HR+N4/ki72DaP0xnf5f9ZLkwpjKbbJZEsz7EqmpoctkTDGSD2mEHog6OMakok/e2o5/zmYrXguJCcK5d5hh/iPqkqgMCyAuQ1PhIQU2SH+umwzrLu8ELhTLVPlPI2k63ZsJ7AJcQco660Gw1V3Zw46xa4CTem384YnX4cLFJefB+KlIfpO1TUL/D5CfezmUijkDBux/zeJL3uHo3NLmTfkLfmZbty90lcyBMqwd9D45JUF6oOLenoWk7xsdzYFgU2Pxa1w+bhEtV915kRVXiBAq+DY+vutgqq4eQmP+mFYsdBujH7Kvso4/PjpXA8kF4ZO6Ku2M1ERmq/G6FEKl6eZzLDmNAaCi9evAMlS+rlklqZSm97aHO7XqZ67TY+XtH1RbzfT5yg1eTSlBywGYdbMzgfWwK8VEzwfoDBYM8iLSebI8tviDsBDOHzRIoo1BXovwj/meM+crjkvxYAvJem7+BbovXJnEhrpzNxBsWZlWqKSjMsxz5ad3oNxKl65HdF5BKD3Kx/2aEKENVS47ZEXl5/O8KAieN9DN/2V0TKedLbEFs=

> If as a
tactic _expression_ it is evaluated and not counted, why then isn't its
evaulated form counted directly by its parent tactics in the call chain?

Because the time is still spent in that tactic.  It seems obvious to me that the time spent in _expression_ evaluation should be counted as in that tactic; to say otherwise seems misleading to me.
The real question is, do we count the calls in _expression_ evaluation?  If we do then a tactic defined as `idtac` will accumulate two calls: once when it's evaluated trivially to idtac, and again when it's run.  But if we don't include the calls in _expression_ evaluation, then we end up with the problem you've encountered, where some tactics have no calls.

On Sat, Jul 25, 2020, 21:36 jonikelee AT gmail.com <jonikelee AT gmail.com> wrote:
The 'use_node' tactic is a tactic _expression_ (no ';' sequence), so I can
understand why (but did not anticipate that) its count would be 0
according to the info you provided.  But it is still counted with
respect to local and total timing, according to the output.  If as a
tactic _expression_ it is evaluated and not counted, why then isn't its
evaulated form counted directly by its parent tactics in the call chain?

Regardless, I will stick an "idtac;" at the start of each 0-counted
tactic that I want correct call counts for (which is all of them).

On Sat, 25 Jul 2020 20:34:21 -0400
Jason Gross <jasongross9 AT gmail.com> wrote:

> What's the definition of `use_node`?  Note that the profiler does not
> count calls to tactics which are run during tactic _expression_
> evaluation, only during tactic running time.  Consider, for example:
> Ltac foo _ := idtac.
> Ltac bar := let __ := match goal with _ => foo () end in
>             idtac.
> Ltac baz := bar.
> Ltac qux := idtac; baz.
>
> Goal True.
>   Set Ltac Profiling.
>   qux.
>   Show Ltac Profile CutOff 0.
>   (* total time:      0.000s
>
>  tactic                                   local  total   calls
> max
> ────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
> ─qux -----------------------------------  32.8% 100.0%       1
> 0.000s ─baz -----------------------------------  12.1%  65.5%       0
>    0.000s ─bar -----------------------------------  50.0%  55.2%
>  1    0.000s ─foo -----------------------------------   5.2%   5.2%
>     0    0.000s
>
>  tactic                                   local  total   calls
> max
> ────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
> ─qux -----------------------------------  32.8% 100.0%       1
> 0.000s ├─baz ---------------------------------  12.1%  65.5%       0
>   0.000s │└bar ---------------------------------  48.3%  53.4%
> 0    0.000s │└foo ---------------------------------   5.2%   5.2%
>   0    0.000s └─bar ---------------------------------   1.7%   1.7%
>     1    0.000s
>
> *)
>
> The way to interpret this is that, during tactic _expression_ evaluation
> phase, baz calls bar which calls foo, and none of these are counted as
> calls (if they were, we'd end up double-counting almost all tactics).
> After tactic _expression_ evaluation phase, the remaining tactic to run
> is "idtac" under "bar", so we get "bar" as a direct descendent of
> "qux" with one call.
>
> On Sat, Jul 25, 2020 at 2:46 PM jonikelee AT gmail.com
> <jonikelee AT gmail.com> wrote:
>
> > I am perhaps not interpreting Ltac Profiling output correctly, but
> > having 0 for calls below seems like it must be a bug, since either
> > use_node must have been called at least once, or it must have calls
> > within it to have a very different local vs. total percentage:
> >
> >  tactic                                   local  total   calls
> >  max
> > ────────────────────────────────────────┴──────┴──────┴───────┴─────────┘
> > ─tac -----------------------------------   0.6%  82.2%   41833
> > 11.316s ─force refine (uconstr) by (tactic1) ---   0.0%  57.5%
> > 148   11.332s ─use_node ------------------------------   0.0%
> > 56.4%       0   23.650s ...
> >
> > Is this a bug?  If not, what is the proper interpreation of the
> > calls column?  Or, for that matter, all columns?
> >
> > My probably incorrect interpretation is that "local" refers to the
> > particular tactic excluding any others it calls, while "total"
> > includes others it calls. And calls is the total number of times it
> > runs.  And max is the maximal amount of time of any single call,
> > including sub calls.  This makes sense except for calls = 0 cases,
> > of which I have several.  My alternate interpretation of calls
> > would be that it is the total number of calls the tactic makes
> > (subcalls), but that cannot be 0 unless that tactic's local and
> > total are the same (or very close).  I'm also assuming that the top
> > "tac" line is the total for all tactics.
> >
> > Note that the refman is silent about the interpretation of the
> > output, but its examples do show cases where calls=0.  And in those
> > cases local and total are very close (so perhaps my alternate
> > interpretation of calls is correct, and the total-local difference
> > is just the Ltac call overhead of the tactic itself?).
> >
> > BTW: this is in the tagged 8.12 build as of yesterday, where
> > supposedly the longstanding Ltac Profiling shortcoming vs.
> > multi-success backtracking tactics has been fixed.  I had previously
> > not paid close attention to anomalies in the Ltac Profiling output
> > because of that shortcoming.
> >
> > Thanks,
> > Jonathan
> > 





Archive powered by MHonArc 2.6.19+.

Top of Page