Logic Programming, p. 348-363
DOI: 10.1007/978-3-540-74610-2_24
We present a static analysis that infers both upper and lower bounds on the usage that a logic program makes of a set of user-definable resources. The inferred bounds will in general be functions of input data sizes. A resource in our approach is a quite general, user-defined notion which associates a basic cost function with elementary operations. The analysis then derives the related (upper- and lower-bound) resource us- age functions for all predicates in the program. We also present an asser- tion language which is used to define both such resources and resource- related properties that the system can then check based on the results of the analysis. We have performed some preliminary experiments with some concrete resources such as execution steps, bytes sent or received by an application, number of files left open, number of accesses to a database, number of calls to a procedure, number of asserts/retracts, etc. Applications of our analysis include resource consumption verifi- cation and debugging (including for mobile code), resource control in parallel/distributed computing, and resource-oriented specialization.