Skip to main content Accessibility help

A general framework for static profiling of parametric resource usage*

  • P. LOPEZ-GARCIA (a1) (a2), M. KLEMEN (a1), U. LIQAT (a1) and M. V. HERMENEGILDO (a1) (a3)


For some applications, standard resource analyses do not provide the information required. Such analyses estimate the total resource usage of a program (without executing it) as functions on input data sizes. However, some applications require knowing how such total resource usage is distributed over selected parts of a program. We propose a novel, general, and flexible framework for setting up cost equations/relations which can be instantiated for performing a wide range of resource usage analyses, including both static profiling and the inference of the standard notion of cost. We extend and generalize standard resource analysis techniques, so that the relations generated include additional Boolean control variables for switching on or off different terms in the relations, as required by the desired resource usage profile. We also instantiate our framework to perform static profiling of accumulated cost (also parameterized by input data sizes). Such information is much more useful to the software developer than the standard notion of cost: it identifies the parts of the program that have the greatest impact on the total program cost, and which therefore should be optimized first. We also report on an implementation of our framework within the CiaoPP system, and its instantiation for accumulated cost, and provide some experimental results. In addition to generality, our new method brings important advantages over our previous approach based on a program transformation, including support for non-deterministic programs, better and easier integration in the compiler, and higher efficiency.



Hide All

This research has received funding from EU FP7 agreement no 318337 ENTRA, Spanish MINECO TIN2012-39391 StrongSoft and TIN2015-67522-C3-1-R TRACES projects, and the Madrid M141047003 N-GREENS program. Special thanks are due to John Gallagher for many fruitful and inspiring discussions and to the anonymous reviewers for their detailed and useful comments.



Hide All
Albert, E., Arenas, P., Genaim, S. and Puebla, G. 2011. Closed-form upper bounds in static cost analysis. Journal of Automated Reasoning 46, 2, 161203.
Albert, E., Genaim, S. and Masud, A. N. 2011. More precise yet widely applicable cost analysis. In Proc. of VMCAI'11, LNCS, vol. 6538. Springer, 3853.
Debray, S. K. and Lin, N. W. 1993. Cost analysis of logic programs. ACM TOPLAS 15, 5 (November), 826875.
Debray, S. K., Lin, N.-W. and Hermenegildo, M. 1990. Task granularity analysis in logic programs. In Proc. PLDI'90. ACM, 174188.
Debray, S. K., López-García, P., Hermenegildo, M. and Lin, N.-W. 1997. Lower bound cost estimation for logic programs. In ILPS'97. MIT Press, 291305.
Giesl, J., Ströder, T., Schneider-Kamp, P., Emmes, F. and Fuhs, C. 2012. Symbolic evaluation graphs and term rewriting: a general methodology for analyzing logic programs. In Proceedings of PPDP'12. ACM, 112.
Grobauer, B. 2001. Cost recurrences for DML programs. In Proceedings of ICFP '01. ACM, New York, NY, USA, 253264.
Gulwani, S., Mehra, K. K. and Chilimbi, T. M. 2009. SPEED: Precise and efficient static estimation of program computational complexity. In The 36th Symposium on Principles of Programming Languages (POPL'09). ACM, 127139.
Haemmerlé, R., Lopez-Garcia, P., Liqat, U., Klemen, M., Gallagher, J. P. and Hermenegildo, M. V. 2016. A transformational approach to parametric accumulated-cost static profiling. In FLOPS'16, LNCS, vol. 9613. Springer, 163180.
Hermenegildo, M., Puebla, G., Bueno, F. and García, P. L. 2005. Integrated program debugging, verification, and optimization using abstract interpretation (and The Ciao System Preprocessor). Science of Computer Programming 58, 1–2, 115140.
Hermenegildo, M. V., Bueno, F., Carro, M., López, P., Mera, E., Morales, J. and Puebla, G. 2012. An overview of ciao and its design philosophy. Theory and Practice of Logic Programming 12, 1–2, 219252.
Hoffmann, J., Aehlig, K. and Hofmann, M. 2012. Multivariate amortized resource analysis. ACM TOPLAS 34, 3, 14:114:62.
Igarashi, A. and Kobayashi, N. 2002. Resource usage analysis. In Symposium on Principles of Programming Languages. ACM, 331342.
Liqat, U., Georgiou, K., Kerrison, S., Lopez-Garcia, P., Hermenegildo, M. V., Gallagher, J. P. and Eder, K. 2016. Inferring Parametric Energy Consumption Functions at Different Software Levels: ISA vs. LLVM IR. In Proc. of FOPARA, LNCS. Springer. In press.
Liqat, U., Kerrison, S., Serrano, A., Georgiou, K., Lopez-Garcia, P., Grech, N., Hermenegildo, M. and Eder, K. 2014. Energy consumption analysis of programs based on XMOS ISA-level models. In Proceedings of LOPSTR'13, LNCS, vol. 8901. Springer, 7290.
Méndez-Lojo, M., Navas, J. and Hermenegildo, M. 2007. A Flexible (C)LP-Based Approach to the Analysis of Object-Oriented Programs. In LOPSTR 2007. Number 4915 in LNCS. Springer-Verlag, 154168.
Mera, E., Trigo, T., López-García, P. and Hermenegildo, M. 2011. Profiling for run-time checking of computational properties and performance debugging. In PADL. LNCS, vol. 6539. 38–53.
Morgan, R. G. and Jarvis, S. A. 1998. Profiling Large-Scale Lazy Functional Programs. Journal of Functional Programing 8, 3, 201237.
Muthukumar, K. and Hermenegildo, M. 1992. Compile-time derivation of variable dependency using abstract interpretation. JLP 13, 2/3 (July), 315347.
Navas, J., Méndez-Lojo, M. and Hermenegildo, M. 2008. Safe upper-bounds inference of energy consumption for Java Bytecode Applications. In NASA LFM'08. 29–32.
Navas, J., Mera, E., López-García, P. and Hermenegildo, M. 2007. User-definable resource bounds analysis for logic programs. In Proc. of ICLP'07. LNCS, vol. 4670. Springer, 348363.
Nielson, F., Nielson, H. and Seidl, H. 2002. Automatic complexity analysis. In Programming Languages and Systems, LNCS. Springer, 243261.
Puebla, G. and Hermenegildo, M. 1996. Optimized algorithms for the incremental analysis of logic programs. In SAS'96. Springer LNCS 1145, 270284.
Rosendahl, M. 1989. Automatic complexity analysis. In Proc. of FPCA'89. ACM Press, 144156.
Sansom, P. M. and Jones, S. L. P. 1995. Time and space profiling for non-strict, higher-order functional languages. In Proc. of POPL'95. ACM, New York, NY, USA, 355366.
Serrano, A., Lopez-Garcia, P. and Hermenegildo, M. 2014. Resource usage analysis of logic programs via abstract interpretation using sized types. Theory and Practice of Logic Programming, ICLP'14 Special Issue 14, 4–5, 739754.
Vasconcelos, P. and Hammond, K. 2003. Inferring cost equations for recursive, polymorphic and higher-order functional programs. In IFL'03, LNCS, vol. 3145. Springer, 86101.
Wegbreit, B. 1975. Mechanical program analysis. Comm. of the ACM 18, 9, 528539.


Type Description Title
Supplementary materials

Lopez-Garcia supplementary material
Online Appendix

 PDF (280 KB)
280 KB

A general framework for static profiling of parametric resource usage*

  • P. LOPEZ-GARCIA (a1) (a2), M. KLEMEN (a1), U. LIQAT (a1) and M. V. HERMENEGILDO (a1) (a3)


Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed