Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
timelimit - limits the amount of CPU time spent on a computation
Calling Sequence
timelimit(t, x)
Parameters
t
-
time limit in seconds
x
expression
Description
The timelimit function evaluates the expression x, but gives up if the evaluation takes longer than the number of seconds specified by t.
Note: For efficiency reasons, the timelimit bound is ignored while in built-in routines.
If the expression is successfully evaluated within the specified time, timelimit returns the value of the expression. If the time limit is reached before the expression is evaluated, timelimit generates the error `time expired`.
The `time expired` error may be caught by a try...catch construct, so long as the try...catch is at a higher level than the call to timelimit. Lower level try...catch constructs (that is, those executed by the expression that is being time-limited) will not catch `time expired`, since to do so would make it impossible to time-limit something which catches exceptions.
The time limit can be specified to the nearest 1/100th of a second, although the actual time allowed can vary by more than that, depending on the underlying architecture, and the Maple operation taking place at the time that the limit expires.
Nested calls to timelimit are allowed, however all time limits are considered to be in effect. Thus an inner call to timelimit will not override the time limit set by an outer call. In addition the `time expired` exception can only be caught outside of the call to timelimit which imposed the limit that expired.
If a nested call to timelimit sets the same limit as an outer call, the outer limit will be treated as the expiring limit.
The timelimit function cannot be used to limit the time of computations within evalhf.
If timelimit is called with a limit of -1, the operation will never time out. Calling timelimit with any other values less than zero will result in an error.
The maximum specifiable time limit is somewhat session dependent, but is usually around 2^24 seconds. To specify a higher time limit value, -1 should be used.
Thread Safety
The timelimit command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
Examples
f := proc() global i; for i to 200000 do 2^i end do end proc:
Error, (in f) time expired
See Also
debugger, time, try
Download Help Document