A Transformational Approach to Parametric Accumulated-Cost Static Profiling

  • R. Haemmerlé
  • P. López-García
  • U. Liqat
  • M. Klemen
  • J. P. Gallagher
  • M. V. Hermenegildo
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9613)


Traditional static resource analyses estimate the total resource usage of a program, without executing it. In this paper we present a novel resource analysis whose aim is instead the static profiling of accumulated cost, i.e., to discover, for selected parts of the program, an estimate or bound of the resource usage accumulated in each of those parts. Traditional resource analyses are parametric in the sense that the results can be functions on input data sizes. Our static profiling is also parametric, i.e., our accumulated cost estimates are also parameterized by input data sizes. Our proposal is based on the concept of cost centers and a program transformation that allows the static inference of functions that return bounds on these accumulated costs depending on input data sizes, for each cost center of interest. Such information is much more useful to the software developer than the traditional resource usage functions, as it allows identifying the parts of a program that should be optimized, because of their greater impact on the total cost of program executions. We also report on our implementation of the proposed technique using the CiaoPP program analysis framework, and provide some experimental results.


  1. 1.
    Albert, E., Arenas, P., Genaim, S., Puebla, G.: Closed-form upper bounds in static cost analysis. J. Autom. Reasoning 46(2), 161–203 (2011)MathSciNetCrossRefMATHGoogle Scholar
  2. 2.
    Albert, E., Genaim, S., Masud, A.N.: More precise yet widely applicable cost analysis. In: Jhala, R., Schmidt, D. (eds.) VMCAI 2011. LNCS, vol. 6538, pp. 38–53. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  3. 3.
    Boogerd, C., Moonen, L.: On the use of data flow analysis in static profiling. In: Eighth IEEE International Working Conference on Source Code Analysis and Manipulation, pp. 79–88, September 2008Google Scholar
  4. 4.
    Brandner, F., Hepp, S., Jordan, A.: Static profiling of the worst-case in real-time programs. In: Proceedings of the 20th International Conference on Real-Time and Network Systems, RTNS 2012, pp. 101–110. ACM, New York (2012)Google Scholar
  5. 5.
    Debray, S.K., Lin, N.W.: Cost analysis of logic programs. ACM Trans. Program. Lang. Syst. 15(5), 826–875 (1993)CrossRefGoogle Scholar
  6. 6.
    Debray, S.K., Lin, N.-W., Hermenegildo, M.: Task Granularity Analysis in Logic Programs. In: Proceeding of the 1990 ACM Conference on Programming Language Design and Implementation, pp. 174–188. ACM Press, June 1990Google Scholar
  7. 7.
    Debray, S.K., López-García, P., Hermenegildo, M., Lin, N.-W.: Lower bound cost estimation for logic programs. In: 1997 International Logic Programming Symposium, pp. 291–305. MIT Press, Cambridge, October 1997Google Scholar
  8. 8.
    Giesl, J., Ströder, T., Schneider-Kamp, P., Emmes, F., Fuhs, C.: Symbolic evaluation graphs and term rewriting: a general methodology for analyzing logic programs. In: PPDP, pp. 1–12. ACM (2012)Google Scholar
  9. 9.
    Grobauer, B.: Cost recurrences for DML programs. In: Proceedings of the Sixth ACM SIGPLAN International Conference on Functional Programming, ICFP 2001, pp. 253–264. ACM, New York (2001)Google Scholar
  10. 10.
    Hermenegildo, M., Puebla, G., Bueno, F., Lopez-Garcia, P.: Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Sci. Comput. Program. 58(1–2), 115–140 (2005)MathSciNetCrossRefMATHGoogle Scholar
  11. 11.
    Hermenegildo, M.V., Bueno, F., Carro, M., López, P., Mera, E., Morales, J.F., Puebla, G.: An overview of Ciao and its design philosophy. Theor. Pract. Logic Program. 12(1–2), 219–252 (2012). arxiv.org/abs/1102.5497 MathSciNetCrossRefMATHGoogle Scholar
  12. 12.
    Hoffmann, J., Aehlig, K., Hofmann, M.: Multivariate amortized resource analysis. ACM Trans. Program. Lang. Syst. 34(3), 14:1–14:62 (2012)CrossRefMATHGoogle Scholar
  13. 13.
    Igarashi, A., Kobayashi, N.: Resource usage analysis. In: Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2002, pp. 331–342. ACM, New York (2002)Google Scholar
  14. 14.
    Liqat, U., Georgiou, K., Kerrison, S., Lopez-Garcia, P., Hermenegildo, M.V., Gallagher, J.P., Eder, K.: Inferring energy consumption at different software levels: ISA vs. LLVM IR. In: Van Eekelen, M., DalLago, U. (eds.) FOPARA 2015, LNCS. Springer (2016, to appear)Google Scholar
  15. 15.
    Liqat, U., et al.: Energy consumption analysis of programs based on XMOS ISA-level models. In: Gupta, G., Peña, R. (eds.) LOPSTR 2013, LNCS 8901. LNCS, vol. 8901, pp. 72–90. Springer, Heidelberg (2014)Google Scholar
  16. 16.
    Méndez-Lojo, M., Navas, J., Hermenegildo, M.V.: A flexible, (C)LP-based approach to the analysis of object-oriented programs. In: King, A. (ed.) LOPSTR 2007. LNCS, vol. 4915, pp. 154–168. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  17. 17.
    Mera, E., Trigo, T., Lopez-García, P., Hermenegildo, M.: Profiling for run-time checking of computational properties and performance debugging in logic programs. In: Rocha, R., Launchbury, J. (eds.) PADL 2011. LNCS, vol. 6539, pp. 38–53. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  18. 18.
    Morgan, R.G., Jarvis, S.A.: Profiling large-scale lazy functional programs. J. Funct. programing 8(3), 201–237 (1998)CrossRefMATHGoogle Scholar
  19. 19.
    Muthukumar, K., Hermenegildo, M.: Compile-time derivation of variable dependency using abstract interpretation. J. Logic Program. 13(2/3), 315–347 (1992)CrossRefMATHGoogle Scholar
  20. 20.
    Navas, J., Méndez-Lojo, M., Hermenegildo, M.: Safe upper-bounds inference of energy consumption for java bytecode applications. In: The Sixth NASA Langley Formal Methods Workshop (LFM 2008), pp. 29–32, April 2008. (Extended Abstract)Google Scholar
  21. 21.
    Navas, J., Méndez-Lojo, M., Hermenegildo, M.: User-definable resource usage bounds analysis for java bytecode. In: Proceedings of the Workshop on Bytecode Semantics, Verification, Analysis and Transformation (BYTECODE 2009), vol. 253. Electronic Notes in Theoretical Computer Science, pp. 65–82. Elsevier, North Holland, March 2009Google Scholar
  22. 22.
    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
  23. 23.
    Nielson, F., Riis Nielson, H., Seidl, H.: Automatic complexity analysis. In: Le Métayer, D. (ed.) ESOP 2002. LNCS, vol. 2305, pp. 243–261. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  24. 24.
    Puebla, G., Hermenegildo, M.: Optimized algorithms for incremental analysis of logic programs. In: Cousot, Radhia, Schmidt, D.A. (eds.) SAS 1996. LNCS, vol. 1145. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  25. 25.
    Rosendahl, M.: Automatic complexity analysis. In: 4th ACM Conference on Functional Programming Languages and Computer Architecture (FPCA 1989), pp. 144–156. ACM Press (1989)Google Scholar
  26. 26.
    Sansom, P.M., Peyton Jones, S.L.: Time and space profiling for non-strict, higher-order functional languages. In: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1995, pp. 355–366. ACM, New York (1995)Google Scholar
  27. 27.
    Serrano, A., Lopez-Garcia, P., Bueno, F., Hermenegildo, M.: Sized type analysis for logic programs (technical communication). In: Swift, T., Lamma, E. (eds.) Theory and Practice of Logic Programming, 29th International Conference on Logic Programming (ICLP 2013) Special Issue, On-line Supplement, vol. 13, pp. 1–14. Cambridge University Press, August 2013Google Scholar
  28. 28.
    Serrano, A., Lopez-Garcia, P., Hermenegildo, M.: Resource usage analysis of logic programs via abstract interpretation using sized types. In: 30th International Conference on Logic Programming (ICLP 2014) Theory and Practice of Logic Programming, vol. 14(4–5), pp. 739–754 (2014). (special issue)Google Scholar
  29. 29.
    Tiwari, V., Malik, S., Wolfe, A.: Power analysis of embedded software: a first step towards software power minimization. IEEE Trans. VLSI Syst. 2(4), 437–445 (1994)CrossRefGoogle Scholar
  30. 30.
    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
  31. 31.
    Bueno, F., Vaucheret, C.: More precise yet efficient type inference for logic programs. In: Hermenegildo, M.V., Puebla, G. (eds.) SAS 2002. LNCS, vol. 2477, pp. 102–116. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  32. 32.
    Wegbreit, B.: Mechanical program analysis. Commun. ACM 18(9), 528–539 (1975)MathSciNetCrossRefMATHGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  • R. Haemmerlé
    • 1
  • P. López-García
    • 1
    • 2
  • U. Liqat
    • 1
  • M. Klemen
    • 1
  • J. P. Gallagher
    • 1
    • 3
  • M. V. Hermenegildo
    • 1
    • 4
  1. 1.IMDEA Software InstituteMadridSpain
  2. 2.Spanish Council for Scientific Research (CSIC)MadridSpain
  3. 3.Roskilde UniversityRoskildeDenmark
  4. 4.Technical University of Madrid (UPM)MadridSpain

Personalised recommendations