Skip to main content Accessibility help
Hostname: page-component-65dc7cd545-fz4lj Total loading time: 0.321 Render date: 2021-07-26T04:36:24.908Z Has data issue: true Feature Flags: { "shouldUseShareProductTool": true, "shouldUseHypothesis": true, "isUnsiloEnabled": true, "metricsAbstractViews": false, "figures": true, "newCiteModal": false, "newCitedByModal": true, "newEcommerce": true, "newUsageEvents": true }

A general framework for static profiling of parametric resource usage*

Published online by Cambridge University Press:  14 October 2016

IMDEA Software Institute (e-mail:,,, Spanish Council for Scientific Research (CSIC)
IMDEA Software Institute (e-mail:,,,
IMDEA Software Institute (e-mail:,,,
IMDEA Software Institute (e-mail:,,, Technical University of Madrid (UPM)


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.

Regular Papers
Copyright © Cambridge University Press 2016 

Access options

Get access to the full version of this content by using one of the access options below.



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.


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.CrossRefGoogle Scholar
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.Google Scholar
Debray, S. K. and Lin, N. W. 1993. Cost analysis of logic programs. ACM TOPLAS 15, 5 (November), 826875.CrossRefGoogle Scholar
Debray, S. K., Lin, N.-W. and Hermenegildo, M. 1990. Task granularity analysis in logic programs. In Proc. PLDI'90. ACM, 174188.CrossRefGoogle Scholar
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.Google Scholar
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.Google Scholar
Grobauer, B. 2001. Cost recurrences for DML programs. In Proceedings of ICFP '01. ACM, New York, NY, USA, 253264.CrossRefGoogle Scholar
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.Google Scholar
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.Google Scholar
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.CrossRefGoogle Scholar
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. Scholar
Hoffmann, J., Aehlig, K. and Hofmann, M. 2012. Multivariate amortized resource analysis. ACM TOPLAS 34, 3, 14:114:62.CrossRefGoogle Scholar
Igarashi, A. and Kobayashi, N. 2002. Resource usage analysis. In Symposium on Principles of Programming Languages. ACM, 331342.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
Morgan, R. G. and Jarvis, S. A. 1998. Profiling Large-Scale Lazy Functional Programs. Journal of Functional Programing 8, 3, 201237.CrossRefGoogle Scholar
Muthukumar, K. and Hermenegildo, M. 1992. Compile-time derivation of variable dependency using abstract interpretation. JLP 13, 2/3 (July), 315347.CrossRefGoogle Scholar
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.Google Scholar
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.Google Scholar
Nielson, F., Nielson, H. and Seidl, H. 2002. Automatic complexity analysis. In Programming Languages and Systems, LNCS. Springer, 243261.CrossRefGoogle Scholar
Puebla, G. and Hermenegildo, M. 1996. Optimized algorithms for the incremental analysis of logic programs. In SAS'96. Springer LNCS 1145, 270284.Google Scholar
Rosendahl, M. 1989. Automatic complexity analysis. In Proc. of FPCA'89. ACM Press, 144156.CrossRefGoogle Scholar
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.CrossRefGoogle Scholar
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.CrossRefGoogle Scholar
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.Google Scholar
Wegbreit, B. 1975. Mechanical program analysis. Comm. of the ACM 18, 9, 528539.CrossRefGoogle Scholar
Supplementary material: PDF

Lopez-Garcia supplementary material

Online Appendix

Download Lopez-Garcia supplementary material(PDF)
PDF 280 KB
Cited by

Linked content

Please note a has been issued for this article.

Send article to Kindle

To send this article to your Kindle, first ensure is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about sending to your Kindle. Find out more about sending to your Kindle.

Note you can select to send to either the or variations. ‘’ emails are free but can only be sent to your device when it is connected to wi-fi. ‘’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

A general framework for static profiling of parametric resource usage*
Available formats

Send article to Dropbox

To send this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your <service> account. Find out more about sending content to Dropbox.

A general framework for static profiling of parametric resource usage*
Available formats

Send article to Google Drive

To send this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your <service> account. Find out more about sending content to Google Drive.

A general framework for static profiling of parametric resource usage*
Available formats

Reply to: Submit a response

Please enter your response.

Your details

Please enter a valid email address.

Conflicting interests

Do you have any conflicting interests? *