| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | (** Global CPU instruction counter. *) |
| 12 | |
| 13 | (** [init ()] initialises, resets to 0, and starts the instruction counter. In |
| 14 | case of an error, the [Failure] exception is raised, and the counter state |
| 15 | is fully re-initialised so that [init] may be called again. Initialization |
| 16 | is required prior to calling the [drop] and [peek] functions. *) |
| 17 | val init : unit -> unit |
| 18 | |
| 19 | (** [drop ()] undoes the effect of [init], and frees all resources used by the |
| 20 | internal state of the instruction counter. Note that the counter must have |
| 21 | been initialised before calling [drop], otherwise [Failure] is raised. *) |
| 22 | val drop : unit -> unit |
| 23 | |
| 24 | (** [peek ()] reads the value of the instruction counter, which corresponds to |
| 25 | the number of instructions run by the CPU since the last (successful) call |
| 26 | to [init]. Note that [Failure] is raised in case of an error, including if |
| 27 | the function is called while the counter is not initialised. *) |
| 28 | val peek : unit -> Int64.t |