I'm thinking of writing some code that does some numerical simulations with a monte carlo approach. Because such an algorithm has an arbitrary run time I would like to be able to limit the amount of time that such a simulation would run. Specifically I would like to be able to do this in terms of the CPU seconds that are in the accounts allowance. Is there an API or some other way to do this?