lean4-htt/src/shell
Leonardo de Moura 01eb27d4a4 feat(util): "deterministic timeout" option
closes #1134

see #1362

This feature is implemented using a "hearbeat" thread local counter.
We reset the counter whenever we start a new task.
The counter is incremented when:

  1- An object is allocated using small_object_allocator (e.g., VM object)
  2- An object is allocated using memory_pool (e.g., expr, level, rb_tree nodes, list cons-cells, etc)
  3- check_system(...) invocations

We check if the threshold was reached at check_system.
The option --timeout=num can be used to set the limit (in thousands).
The default is unbounded in batch mode.
In server mode, the default is 100000. We can compile the standard library with --timeout=12000

I did not perform many experiments to check how precise this counter is.
I added a new Emacs configuration setting to change the server default.

Here is the wall clock time for different values of --timeout for the
command used on issue #1134

time ../../bin/lean -j 0 --timeout=20000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.070s
user	0m1.032s
sys	0m0.036s

time ../../bin/lean -j 0 --timeout=40000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.777s
user	0m1.676s
sys	0m0.044s

time ../../bin/lean -j 0 --timeout=50000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.985s
user	0m1.920s
sys	0m0.056s

time ../../bin/lean -j 0 --timeout=100000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m3.587s
user	0m3.564s
sys	0m0.020s
2017-02-07 13:56:12 -08:00
..
CMakeLists.txt feat(checker): add leanchecker executable 2017-01-31 09:39:31 +01:00
completion.cpp refactor(frontends/lean): interactive tactic support 2017-01-21 22:38:47 -08:00
completion.h feat(frontends/lean,shell): autocompletion for ^. 2017-01-17 19:27:59 -08:00
lean.cpp feat(util): "deterministic timeout" option 2017-02-07 13:56:12 -08:00
lean_js.cpp refactor(library/standard_kernel): move standard kernel into kernel 2017-01-31 09:39:31 +01:00
lean_js.h feat(shell): move lean.js to server mode 2017-01-13 07:34:54 -08:00
lean_js.html feat(shell): move lean.js to server mode 2017-01-13 07:34:54 -08:00
lean_js_main.cpp feat(shell): move lean.js to server mode 2017-01-13 07:34:54 -08:00
leandoc.cpp chore(shell/leandoc): fix style 2016-11-29 10:38:22 -08:00
leandoc.h feat(frontends/lean): basic leandoc tool 2016-11-27 14:31:31 -08:00
mk_lean_sh.sh fix(test*.sh): allow spaces in filename 2015-03-28 23:29:52 -04:00
server.cpp refactor(frontends/lean): interactive tactic support 2017-01-21 22:38:47 -08:00
server.h feat(shell): move lean.js to server mode 2017-01-13 07:34:54 -08:00
simple_pos_info_provider.h refactor(shell): move emscripten_shell to a separate file 2015-06-18 09:53:23 -07:00
test_standard.sh feat(build): generate tests for all code blocks in org-files, and examples at ./examples/standard 2014-07-28 12:06:11 -07:00