Skip to main content

The BonaFide C Analyzer: automatic loop-level characterization and coverage measurement


The advent of multicore technologies has increased the interest in parallelization techniques for existing sequential applications. These techniques include the need of detecting loops that are good candidates for parallelization, and classifying all variables of these loops according to their use, a task surprisingly hard to be carried out manually. In this paper, we introduce the BonaFide C Analyzer, an XML-based framework that combines static analysis of source code with profiling information to generate complete reports regarding all loops in a C application, including loop coverage, loop suitability for parallelization, a classification of all variables inside loops based on their accesses, and other hurdles that restrict the parallelization. This information allows to analyze how particular language constructs are used in real-world applications, and helps the programmer to parallelize the code. To show the features of the framework, we present the results of an in-depth loop characterization of C applications that are part of the SPEC CPU2006 benchmark suite. Our study shows that 47.72 % of loops present in the applications analyzed are potentially parallelizable with existent parallel programming models such as OpenMP, while an additional 37.7 % of loops could be run in parallel with the help of runtime speculative parallelization techniques.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8


  1. Further analysis may be required to ensure that, after parallel execution, final values stored in private variables meet sequential semantics.

  2. Inclusive execution time of a loop is the amount of time that the loop consumes, including the time spent by its nested loops and functions called from this loop. By contrast, exclusive execution time of a loop is the time that the loop consumes by itself, excluding the time spent by its nested loops and function calls.

  3. This feature has been added with the help of the ListUtils package, provided by Apache Commons [32], that allows to apply operations as union or intersection over sets of variables.


  1. Al-Ekram R, Kontogiannis K (2005) An XML-Based framework for language neutral program representation and generic analysis. In: Proceedings of CSMR’05, pp 42–51

  2. Aldea, S, Llanos DR, Gonzalez-Escribano A (2011) Towards a compiler framework for thread-level speculation. In: Proceeding of PDP’11, pp 267–271

  3. Aldea S, Llanos DR, Gonzalez-Escribano A (2012) Using SPEC CPU2006 to evaluate the sequential and parallel code generated by commercial and open-source compilers. J Supercomput 2012(59):486–498

  4. Atsumi N, Kobayashi T, Yamamoto S, Agusa K (2011) An XML C source code interchange format for CASE tools. In: Proceedings of COMPSAC’11, pp 498–503

  5. Badros GJ (2000) JavaML: a markup language for java source code. Comput Netw 33(1):159–177

    Article  Google Scholar 

  6. Berglund A, Boag S, Chamberlin D, Fernandez MF, Kay M, Robie J, Simon J (2010) XML Path language (XPath) 2.0 (Second edition). W3C recommendation 14 Dec 2010. Accessed December 2013

  7. Boshernitsan M, Graham SL (2000) Designing an XML-Based exchange format for Harmonia. In: Proceedings of WCRE’00, pp 287–289

  8. Bray T, Paoli J, Sperberg-McQueen CM, Maler E, Yergeau F (2008) Extensible Markup Language (XML). W3C Recommendation 26 November 2008. Accessed December 2013

  9. Campanoni S, Jones TM, Holloway G, Wei GY, Brooks D (2012) Helix: making the extraction of thread-level parallelism mainstream. IEEE Micro 32(4):8–18

    Article  Google Scholar 

  10. Chamberlain BL, Callahan D, Zima HP (2007) Parallel programmability and the chapel language. Int J HPC Appl 21(3):291–312

    Google Scholar 

  11. Chandra R, Menon R, Dagum L, Kohr D, Maydan D, McDonald, J (2000) Parallel Programming in OpenMP, 1 edn. Morgan Kaufmann, Burlington

  12. Chen MK, Olukotun K (2003) The Jrpm system for dynamically parallelizing java programs. In: Proceedings of ISCA’03, pp 434–445

  13. Cintra M, Llanos D (2005) Design space exploration of a software speculative parallelization scheme. IEEE Trans Parallel Distrib Syst 16(6):562–576

    Google Scholar 

  14. Collard ML (2003) An infrastructure to support meta-differencing and refactoring of source code. In: Proceedings of ASE’03, pp 377–380

  15. Collard ML (2005) Addressing source code using srcML. In: IWCP’05 working session textual views of source code to support comprehension, pp 1–3

  16. Collard ML, Decker MJ, Maletic JI (2011) Lightweight transformation and fact extraction with the srcML toolkit. In: Proceedings of SCAM’11, pp 173–184

  17. Collard ML, Kagdi HH, Maletic, JI (2003) An XML-Based lightweight C++ fact extractor. In: Proceedings of IWPC’03, pp 134–143

  18. Collard ML, Maletic JI (2004) Document-oriented source code transformation using XML. In: Proceedings of SET’04, pp 11–14

  19. Collard ML, Maletic JI, Robinson BP (2010) A lightweight transformational approach to support large scale adaptive changes. In: Proceedings of ICSM’10, pp 1–10

  20. Cordy JR (2003) Generalized selective XML markup of source code using agile parsing. In: Proceedings of IWPC’03, pp 144–153

  21. Dave C, Bae H, Min S, Lee S, Eigenmann R, Midkiff S (2009) Cetus: A Source-to-Source compiler infrastructure for multicores. Computer 42(12):36–42

    Article  Google Scholar 

  22. David G, Badros G, Aguiar A (2004) JavaML 2.0: Enriching the markup language for java source code. XML Aplicaes e Tecnologias Associadas (XATA’04)

  23. Dou J, Cintra M (2007) A compiler cost model for speculative parallelization. ACM Trans Architect Code Optim 4(2)

  24. Du Z, Lim C, Li X, Yang C, Zhao Q, Ngai T (2004) A cost-driven compilation framework for speculative parallelization of sequential programs. In: Proceedings of PLDI’04, pp 71–81

  25. Ebert J, Kullbach B, Winter A (1999) GraX an interchange format for reengineering tools. In: Proceedings of WCRE’99, pp 89–98

  26. Fischer G, Lusiardi J (2008) JaML—an XML Representation of Java Source code. University of Wrzburg, Tech. Rep

  27. Garcia S, Jeon D, Louie CM, Taylor MB (2012) The kremlin oracle for sequential code parallelization. IEEE Micro 32(4):42–53

    Article  Google Scholar 

  28. Gondow K, Kawashima H (2002) Towards ANSI C program slicing using XML. Electron Notes Theor Comput Sci 65(3):30–49

    Article  Google Scholar 

  29. Henning JL (2006) SPEC CPU2006 benchmark descriptions. SIGARCH Comput Archit News 34(4):1–17

    Article  MathSciNet  Google Scholar 

  30. Hertzberg B, Olukotun K (2011) Runtime automatic speculative parallelization. In: Proceedings of CGO’11, pp 64–73

  31. Holt RC, Winter A, Schrr A (2000) GXL: toward a standard exchange format. In: Proceedings of WCRE’00, pp 162–171

  32. Iverson W (2005) Apache Jakarta Commons: reusable Java(TM) components. Prentice Hall PTR, Upper Saddle River, pp 154–156

  33. Johnson TA, Eigenmann R, Vijaykumar TN (2007) Speculative thread decomposition through empirical optimization. In: Proceedings of PPoPP’07, pp 205–214

  34. Kay M (2013) XSL Transformations (XSLT) version 2.0. W3C recommendation 23 january 2007. Accessed December 2013

  35. Kejariwal A, Tian X, Girkar M, Li W, Kozhukhov S, Banerjee U, Nicolau A, Veidenbaum AV, Polychronopoulos CD (2007) Tight analysis of the performance potential of thread speculation using SPEC CPU 2006. In: Proceedings of PPoPP’07, pp 215–225

  36. Kim M, Kim H, Luk C (2010) SD3: a scalable approach to dynamic data-dependence profiling. In: Proceedings of MICRO’43, pp 535–546

  37. Liu W, Tuck J, Ceze L, Ahn W, Strauss K, Renau J, Torrellas J (2006) POSH: a TLS compiler that exploits program structure. In: Proceedings of PPoPP’06, pp 158–167

  38. Luo Y, Packirisamy V, Hsu W, Zhai A, Mungre N, Tarkas A (2009) Dynamic performance tuning for speculative threads. In: Proceedings of ISPA’09, pp 462–473

  39. Maeda K (2007) Experience of XML-based source code representation with parsing actions. In: Proceeding of SoMeT’07, pp 330–339

  40. Maletic JI, Collard ML, Kagdi H (2004) Leveraging XML technologies in developing program analysis tools. In: Proceedings of ACSE’04, pp 80–85

  41. Mamas E, Kontogiannis K (2000) Towards portable source code representations using XML. In: Proceedings of WCRE’00, pp 172–182

  42. Maruyama K, Yamamoto S (2004) A CASE tool platform using an XML representation of java source code. In: Proceedings of SCAM’04, pp 158–167

  43. McArthur G, Mylopoulos J, Ng SKK (2002) An extensible tool for source code representation using XML. In: Proceedings of WCRE’02, pp 199–208

  44. Mendonca NC, Maia PHM, Fonseca LA, Andrade RMC (2004) RefaX: a refactoring framework based on XML. In: Proceedings of ICSM’04, pp 147–156

  45. Moseley T, Connors DA, Grunwald D, Peri R (2007) Identifying potential parallelism via loop-centric profiling. In: Proceedings of CF’07, pp 143–152

  46. Packirisamy V, Zhai A, Hsu W, Yew P, Ngai T (2009) Exploring speculative parallelism in SPEC2006. In: Proceedings of ISPASS’09, pp 77–88

  47. Power JF, Malloy BA (2002) Program annotation in XML: a Parse-Tree based approach. In: Proceedings of WCRE’02, pp 190–198

  48. von Praun C, Bordawekar R, Cascaval C (2008) Modeling optimistic concurrency using quantitative dependence analysis. In: Proceedings of PPoPP’08, pp 185–196

  49. Putro HP, Liem I (2011) XML representations of program code. In: Proceedings of ICEEI’11, pp 1–6

  50. Salinas-Mendoza A, Juarez-Martinez U, Alor-Hernandez G, Olivares-Zepahua BA (2011) Designing an XML-based representation for CaesarJ source code. In: Proceedings of CERMA’11, pp 427–432

  51. Sun YX, Chen HY, Tse TH (2008) Lean implementations of software testing tools using XML representations of source codes. In: Proceedings of CSSE’08, pp 708–711

  52. Tian C, Feng M, Gupta R (2010) Speculative parallelization using state separation and multiple value prediction. In: Proceedings of ISMM’10, pp 63–72

  53. Tidwell D (2008) XSLT, 2nd 2 edn. O’Reilly Media, Sebastopol

  54. Wagner C, Margaria T, Pagendarm HG (2009) Analysis and code model extraction for C/C++ source code. In: Proceedings of ICECCS’09, pp 110–119

  55. Wang S, Dai X, Yellajyosula KS, Zhai A, Yew P (2006) Loop selection for thread-level speculation. In: Proceedings of LCPC’05, pp 289–303

  56. Whaley J, Kozyrakis C (2005) Heuristics for profile-driven method-level speculative parallelization. In: Proceedings of ICPP’05, pp 147–156

  57. Wheeler DA (2004) Sloccount: counting source lines of code. Accessed December 2013

  58. Wu P, Kejariwal A, Cacaval C (2008) Compiler-driven dependence profiling to guide program parallelization. In: Amaral J (ed) Languages and compilers for parallel computing. Lecture notes in computer science, vol 5335, pp 232–248

  59. Zou Y, Kontogiannis K (2001) A framework for migrating procedural code to Object-Oriented platforms. In: Proceedings of APSEC’01, APSEC ’01, pp 390–399

Download references


This research is partly supported by the Castilla-Leon Regional Government (VA172A12-2); Ministerio de Industria, Spain (CENIT OCEANLIDER); MICINN (Spain) and the European Union FEDER (MOGECOPP project TIN2011-25639, CAPAP-H3 network TIN2010-12011-E, CAPAP-H4 network TIN2011-15734-E). Sergio Aldea is supported by a research grant (EDU/1204/2010) of Consejería de Educación, Junta de Castilla y León, Spain, and the European Social Fund.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Sergio Aldea.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Aldea, S., Llanos, D.R. & Gonzalez-Escribano, A. The BonaFide C Analyzer: automatic loop-level characterization and coverage measurement. J Supercomput 68, 1378–1401 (2014).

Download citation

  • Published:

  • Issue Date:

  • DOI:


  • Automatic parallelization
  • Code analysis
  • Compiler framework
  • Profiling information
  • Source code representation
  • Source transformation
  • XML