Resource Usage Analysis and Its Application to Resource Certification

  • Elvira Albert
  • Puri Arenas
  • Samir Genaim
  • Germán Puebla
  • Damiano Zanardini
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5705)


Resource usage is one of the most important characteristics of programs. Automatically generated information about resource usage can be used in multiple ways, both during program development and deployment. In this paper we discuss and present examples on how such information is obtained in COSTA, a state of the art static analysis system. COSTA obtains safe symbolic upper bounds on the resource usage of a large class of general-purpose programs written in a mainstream programming language such as Java (bytecode). We also discuss the application of resource-usage information for code certification, whereby code not guaranteed to run within certain user-specified bounds is rejected.


Resource Usage Cost Model Recursive Call Strongly Connect Component Resource Analysis 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    The Timber Language,
  2. 2.
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers – Principles, Techniques and Tools. Addison-Wesley, Reading (1986)zbMATHGoogle Scholar
  3. 3.
    Albert, E., Arenas, P., Codish, M., Genaim, S., Puebla, G., Zanardini, D.: Termination analysis of java bytecode. In: Barthe, G., de Boer, F.S. (eds.) FMOODS 2008. LNCS, vol. 5051, pp. 2–18. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  4. 4.
    Albert, E., Arenas, P., Genaim, S., Puebla, G.: Dealing with numeric fields in termination analysis of java-like languages. In: Huisman, M. (ed.) 10th Workshop on Formal Techniques for Java-like Programs (July 2008)Google Scholar
  5. 5.
    Albert, E., Arenas, P., Genaim, S., Puebla, G., Zanardini, D.: The COSTA System web site,
  6. 6.
    Albert, E., Arenas, P., Genaim, S., Puebla, G., Zanardini, D.: Cost analysis of java bytecode. In: De Nicola, R. (ed.) ESOP 2007. LNCS, vol. 4421, pp. 157–172. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  7. 7.
    Albert, E., Puebla, G., Hermenegildo, M.: Abstraction-Carrying Code: A Model for Mobile Code Safety. New Generation Computing 26(2), 171–204 (2008)CrossRefzbMATHGoogle Scholar
  8. 8.
    Albert, E., Arenas, P., Genaim, S., Puebla, G.: Automatic inference of upper bounds for recurrence relations in cost analysis. In: Alpuente, M., Vidal, G. (eds.) SAS 2008. LNCS, vol. 5079, pp. 221–237. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  9. 9.
    Aspinall, D., Gilmore, S., Hofmann, M.O., Sannella, D., Stark, I.: Mobile resource guarantees for smart devices. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, pp. 1–26. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  10. 10.
    Bagnara, R., Pescetti, A., Zaccagnini, A., Zaffanella, E.: PURRS: Towards computer algebra support for fully automatic worst-case complexity analysis. Technical report (2005) arXiv:cs/0512056,
  11. 11.
    Bartoletti, M., Degano, P., Ferrari, G.-L., Zunino, R.: Types and effects for resource usage analysis. In: Seidl, H. (ed.) FOSSACS 2007. LNCS, vol. 4423, pp. 32–47. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  12. 12.
    Ben-Amram, A.M., Jones, N.D., Kristiansen, L.: Linear, polynomial or exponential? Complexity inference in polynomial time. In: Beckmann, A., Dimitracopoulos, C., Löwe, B. (eds.) CiE 2008. LNCS, vol. 5028, pp. 67–76. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  13. 13.
    Benoy, F., King, A.: Inferring Argument Size Relationships with CLP(R). In: Gallagher, J.P. (ed.) LOPSTR 1996. LNCS, vol. 1207, pp. 204–223. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  14. 14.
    Benzinger, R.: Automated Higher-Order Complexity Analysis. Theor. Comput. Sci. 318(1-2) (2004)Google Scholar
  15. 15.
    Bjerner, B., Holmstrom, S.: A Compositional Approach to Time Analysis of First Order Lazy Functional Programs. In: Proc. ACM Functional Programming Languages and Computer Architecture, pp. 157–165. ACM Press, New York (1989)Google Scholar
  16. 16.
    Braberman, V., Fernández, F., Garbervetsky, D., Yovine, S.: Parametric Prediction of Heap Memory Requirements. In: Proceedings of the International Symposium on Memory management (ISMM). ACM, New York (2008)Google Scholar
  17. 17.
    Cachera, D., Jensen, T., Pichardie, D., Schneider, G.: Certified memory usage analysis. In: Fitzgerald, J.S., Hayes, I.J., Tarlecki, A. (eds.) FM 2005. LNCS, vol. 3582, pp. 91–106. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  18. 18.
    Chander, A., Espinosa, D., Islam, N., Lee, P., Necula, G.C.: Enforcing resource bounds via static verification of dynamic checks. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 311–325. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  19. 19.
    Chin, W.-N., Nguyen, H.H., Popeea, C., Qin, S.: Analysing Memory Resource Bounds for Low-Level Programs. In: Proceedings of the International Symposium on Memory management (ISMM). ACM, New York (2008)Google Scholar
  20. 20.
    Cousot, P., Cousot, R.: Abstract Interpretation: a Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In: Fourth ACM Symposium on Principles of Programming Languages, pp. 238–252 (1977)Google Scholar
  21. 21.
    Crary, K., Weirich, S.: Resource Bound Certification. In: POPL 2000, pp. 184–198. ACM Press, New York (2000)Google Scholar
  22. 22.
    Debray, S.K., Lin, N.W.: Cost Analysis of Logic Programs. ACM Transactions on Programming Languages and Systems 15(5), 826–875 (1993)CrossRefGoogle Scholar
  23. 23.
    Eisinger, J., Polian, I., Becker, B., Metzner, A., Thesing, S., Wilhelm, R.: Automatic identification of timing anomalies for cycle-accurate worst-case execution time analysis. In: Proceedings of IEEE Workshop on Design & Diagnostics of Electronic Circuits & Systems (DDECS), pp. 15–20. IEEE Computer Society, Los Alamitos (2006)Google Scholar
  24. 24.
    Gulavani, B.S., Gulwani, S.: A numerical abstract domain based on expression abstraction and max operator with application in timing analysis. In: Gupta, A., Malik, S. (eds.) CAV 2008. LNCS, vol. 5123, pp. 370–384. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  25. 25.
    Gulwani, S., Mehra, K.K., Chilimbi, T.M.: Speed: precise and efficient static estimation of program computational complexity. In: POPL, pp. 127–139. ACM, New York (2009)Google Scholar
  26. 26.
    Gulwani, S., Tiwari, A.: An abstract domain for analyzing heap-manipulating low-level software. In: Damm, W., Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 379–392. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  27. 27.
    Hammond, K., Michaelson, G.J.: Hume: A domain-specific language for real-time embedded systems. In: Pfenning, F., Smaragdakis, Y. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 37–56. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  28. 28.
    Hermenegildo, M., Puebla, G., Bueno, F., López-García, P.: Integrated Program Debugging, Verification, and Optimization Using Abstract Interpretation (and The Ciao System Preprocessor). Science of Computer Programming 58(1-2), 115–140 (2005)MathSciNetCrossRefzbMATHGoogle Scholar
  29. 29.
    Hickey, T., Cohen, J.: Automating program analysis. J. ACM 35(1) (1988)Google Scholar
  30. 30.
    Hofmann, M., Jost, S.: Static prediction of heap space usage for first-order functional programs. In: POPL (2003)Google Scholar
  31. 31.
    Hughes, J., Pareto, L., Sabry, A.: Proving the correctness of reactive systems using sized types. In: POPL, pp. 410–423 (1996)Google Scholar
  32. 32.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall, New York (1993)zbMATHGoogle Scholar
  33. 33.
    Jouannaud, J., Xu, W.: Automatic Complexity Analysis for Programs Extracted from Coq Proof. ENTCS (2006)Google Scholar
  34. 34.
    Kristiansen, L., Jones, N.D.: The flow of data and the complexity of algorithms. In: Cooper, S.B., Löwe, B., Torenvliet, L. (eds.) CiE 2005. LNCS, vol. 3526, pp. 263–274. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  35. 35.
    Le Metayer, D.: ACE: An Automatic Complexity Evaluator. ACM Transactions on Programming Languages and Systems 10(2), 248–266 (1988)CrossRefGoogle Scholar
  36. 36.
    Lehner, H., Müller, P.: Formal translation of bytecode into BoogiePL. In: Bytecode 2007. ENTCS, pp. 35–50. Elsevier, Amsterdam (2007)Google Scholar
  37. 37.
    Lindholm, T., Yellin, F.: The Java Virtual Machine Specification. Addison-Wesley, Reading (1996)Google Scholar
  38. 38.
    Luca, B., Andrei, S., Anderson, H., Khoo, S.-C.: Program transformation by solving recurrences. In: PEPM 2006: Proceedings of the 2006 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation, pp. 121–129. ACM, New York (2006)CrossRefGoogle Scholar
  39. 39.
    Marion, J.-Y., Pèchoux, R.: Resource control of object-oriented programs. In: International LICS affiliated Workshop on Logic and Computational Complexity (LCC 2007), Wroclaw, Poland (2007)Google Scholar
  40. 40.
    Navas, J., Mera, E., López-García, P., Hermenegildo, M.V.: User-definable resource bounds analysis for logic programs. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 348–363. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  41. 41.
    Necula, G.: Proof-Carrying Code. In: Proc. of ACM Symposium on Principles of programming languages (POPL), pp. 106–119. ACM Press, New York (1997)Google Scholar
  42. 42.
    Nielson, F., Nielson, H.R., Hankin, C.: Principles of Program Analysis, 2nd edn. Springer, Heidelberg (2005)zbMATHGoogle Scholar
  43. 43.
    Niggl, K.-H., Wunderlich, H.: Certifying Polynomial Time and Linear/Polynomial Space for Imperative Programs. SIAM J. Comput. 35(5), 1122–1147 (2006)MathSciNetCrossRefzbMATHGoogle Scholar
  44. 44.
    Rosendahl, M.: Automatic Complexity Analysis. In: Proc. ACM Conference on Functional Programming Languages and Computer Architecture, pp. 144–156. ACM, New York (1989)Google Scholar
  45. 45.
    Rosendahl, M.: Simple Driving Techniques. In: Mogensen, T.Æ., Schmidt, D.A., Sudborough, I.H. (eds.) The Essence of Computation. LNCS, vol. 2566, pp. 404–419. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  46. 46.
    Rossignoli, S., Spoto, F.: Detecting non-cyclicity by abstract compilation into boolean functions. In: Emerson, E.A., Namjoshi, K.S. (eds.) VMCAI 2006. LNCS, vol. 3855, pp. 95–110. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  47. 47.
    Sands, D.: A naïve time analysis and its theory of cost equivalence. J. Log. Comput. 5(4) (1995)Google Scholar
  48. 48.
    Secci, S., Spoto, F.: Pair-sharing analysis of object-oriented programs. In: Hankin, C., Siveroni, I. (eds.) SAS 2005. LNCS, vol. 3672, pp. 320–335. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  49. 49.
    Simões, H.R., Hammond, K., Florido, M., Vasconcelos, P.B.: Using intersection types for cost-analysis of higher-order polymorphic functional programs. In: Altenkirch, T., McBride, C. (eds.) TYPES 2006. LNCS, vol. 4502, pp. 221–236. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  50. 50.
    Spoto, F.: Julia: A Generic Static Analyser for the Java Bytecode. In: Proc. of the 7th Workshop on Formal Techniques for Java-like Programs, FTfJP 2005, Glasgow, Scotland (July 2005)Google Scholar
  51. 51.
    Spoto, F., Jensen, T.: Class analyses as abstract interpretations of trace semantics. ACM Trans. Program. Lang. Syst. 25(5), 578–630 (2003)CrossRefGoogle Scholar
  52. 52.
    Spoto, F., Hill, P.M., Payet, E.: Path-length analysis of object-oriented programs. In: Proc. International Workshop on Emerging Applications of Abstract Interpretation (EAAI). Electronic Notes in Theoretical Computer Science. Elsevier, Amsterdam (2006)Google Scholar
  53. 53.
    Turchin, V.F.: The concept of a supercompiler. ACM Transactions on Programming Languages and Systems 8(3), 292–325 (1986)CrossRefzbMATHGoogle Scholar
  54. 54.
    Vallee-Rai, R., Hendren, L., Sundaresan, V., Lam, P., Gagnon, E., Co, P.: Soot - a Java optimization framework. In: Proc. of Conference of the Centre for Advanced Studies on Collaborative Research (CASCON), pp. 125–135 (1999)Google Scholar
  55. 55.
    Vasconcelos, P.B., Hammond, K.: Inferring cost equations for recursive, polymorphic and higher-order functional programs. In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 86–101. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  56. 56.
    Wadler, P.: Strictness analysis aids time analysis. In: Proc. ACM Symposium on Principles of Programming Languages (POPL), pp. 119–132. ACM Press, New York (1988)Google Scholar
  57. 57.
    Wegbreit, B.: Mechanical Program Analysis. Comm. of the ACM 18(9) (1975)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Elvira Albert
    • 1
  • Puri Arenas
    • 1
  • Samir Genaim
    • 2
  • Germán Puebla
    • 2
  • Damiano Zanardini
    • 2
  1. 1.DSICComplutense University of MadridMadridSpain
  2. 2.CLIPTechnical University of MadridBoadilla del Monte, MadridSpain

Personalised recommendations