Updated 2017-01-13 05:57:20 by APN

info cmdcount

Returns a count of the total number of commands that have been invoked in this interpreter.

Note that since the bytecode compiler arrived in Tcl 8.0, the machinery that counts command invocations has been effectively disconnected from the operation of many Tcl commands. As development continues, more and more command evaluation doesn't count in the eyes of info cmdcount.

This command is best treated in modern Tcl programs as a curious historical relic. Not to be relied on for correct operation of scripts.

Lars H 2008-05-24: The above was written in 2003. Is it still true? I recall discussions about bytecode generation and cmdcount to have surfaced several times in the meantime, in a way that suggests core maintainers still care about upholding the cmdcount. It is used by interp limit, is it not?

PYK 2014-06-20: info cmdcount has always been reliable for the uses I've put it to. I haven't yet come across a situation where info cmdcount isn't incremented after a command has been executed.

APN 2017-01-13: Not so. As of 8.6.6, info cmdcount is still unreliable. See http://core.tcl.tk/tcl/tktview?name=931e4956b9.

See Also  edit

info