Report:  Complexity, Functional Cyclomatic and Interface
Option:  -c
Compatible Options: RSM Option Cross Reference
Usage:
rsm -H -O report.htm -c *.cpp 
rsm -H -O report.htm -c *.java
Source:  C, C++ and Java
RSM determines the interface complexity and cyclomatic complexity for each Class and Function.  These complexity metrics can assist the user in the determination for module ease of use, whether or not the module should be multiple modules or the number of test cases a function should have for unit testing.

Interface Complexity: (InterCmp) is defined by RSM as the number of input parameters to a function plus the number of return states from that function.  Class interface complexity is the sum of all function interface complexity metrics within that class.

Cyclomatic Complexity: (CycloCmp) is the McCabe Cyclomatic complexity for a function.  The McCabe cyclomatic complexity has become the defacto industry standard for measuring the structural complexity of a function.  Cyclomatic complexity as defined by McCabe is the number of logical pathways through a function.   This metric can either be determined by counting the regions, nodes and edges or number of predicate nodes (branching points) with a flow graph.

The following equations defined McCabe Cyclomatic Complexity:
"Software Engineering, A Practioners Approach", Roger S. Pressman, McGraw Hill.

  1. The number of regions in a flow graph.
  2. V(G) = E - N + 2, where E are the edges and N are the nodes.
  3. V(G) = P + 1, where P are the predicate nodes.

The following hyperlink details the predicate node approach and relates the calculation to actual source code.  RSM is compliant with these definitions.  Cyclomatic Complexity Analysis

  File: Contact.java

  Date: Tue Jul 13 20:03:14 1999                     File Size: 1564 Bytes

  ________________________________________________________________________



  Function: rolodex.Contact.Contact

  Complexity   Param 0       Return 1      Cyclo Vg 1       Total        2

  LOC 3        eLOC 1        lLOC 1        Comment 0        Lines        3



  Function: rolodex.Contact.Contact

  Complexity   Param 1       Return 1      Cyclo Vg 1       Total        3

  LOC 3        eLOC 1        lLOC 1        Comment 0        Lines        3



  Function: rolodex.Contact.setName

  Complexity   Param 0       Return 1      Cyclo Vg 4       Total        5

  LOC 26       eLOC 14       lLOC 9        Comment 0        Lines       26

 

 
--------------31B6F031C4970D24E3366504 Content-Type: text/html; charset=us-ascii; name="relatorio_h.htm" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="relatorio_h.htm" Resource Standard Metrics 6.03

Resource Standard Metrics for C, C++ and Java Visual Metrics Version 6.03 License Type: Shareware Evaluation License Licensed To : Shareware End User - Distribute Freely License No. : SW1380 License Date: Sat Dec 05 15:31:28 1998 (C) 2001 M Squared Technologies Run Date: Mon Apr 01 15:06:05 2002 ________________________________________________________________________ ~~ Function Metrics ~~ ~~ Complexity Analysis ~~ File: complexo.cpp Date: Mon Apr 01 13:58:02 2002 File Size: 1251 Bytes ________________________________________________________________________ Function: soma Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 9 Function: diferenca Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 8 Function: produto Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 8 Function: quociente Complexity Param 2 Return 2 Cyclo Vg 2 Total 6 LOC 11 eLOC 9 lLOC 6 Comment 0 Lines 13 Function: modulo Complexity Param 1 Return 1 Cyclo Vg 1 Total 3 LOC 3 eLOC 2 lLOC 1 Comment 0 Lines 5 Function: main Complexity Param 0 Return 1 Cyclo Vg 2 Total 3 LOC 17 eLOC 15 lLOC 12 Comment 0 Lines 19 ------------------------------------------------------------------------ ~~ Total File Summary ~~ LOC 50 eLOC 42 lLOC 28 Comment 8 Lines 78 ------------------------------------------------------------------------ ~~ File Functional Summary ~~ File Function Count ...: 6 Total LOC Lines LOC ...: 46 Total eLOC Lines ......: 38 Total lLOC Lines ......: 28 Total Function Params .: 9 Total Function Return .: 7 Total Cyclo Complexity : 8 Total Function Complex.: 24 ------ ----- ----- ------ ------ ----- Max Function LOC ......: 17 Average Function LOC ..: 7.67 Max Function eLOC .....: 15 Average Function eLOC .: 6.33 Max Function lLOC .....: 12 Average Function lLOC .: 4.67 ------ ----- ----- ------ ------ ----- Max Function Parameters: 2 Avg Function Parameters: 1.50 Max Function Returns ..: 2 Avg Function Returns ..: 1.17 Max Interface Complex. : 4 Avg Interface Complex. : 2.67 Max Cyclomatic Complex.: 2 Avg Cyclomatic Complex.: 1.33 Max Total Complexity ..: 6 Avg Total Complexity ..: 4.00 ________________________________________________________________________ End of File: complexo.cpp ~~ Total Metrics For 1 Files ~~ ------------------------------------------------------------------------ ~~ Total Project Summary ~~ LOC 50 eLOC 42 lLOC 28 Comment 8 Lines 78 ------------------------------------------------------------------------ ~~ Project Functional Metrics ~~ No Sort Method Function: soma Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 9 Function: diferenca Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 8 Function: produto Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 8 Function: quociente Complexity Param 2 Return 2 Cyclo Vg 2 Total 6 LOC 11 eLOC 9 lLOC 6 Comment 0 Lines 13 Function: modulo Complexity Param 1 Return 1 Cyclo Vg 1 Total 3 LOC 3 eLOC 2 lLOC 1 Comment 0 Lines 5 Function: main Complexity Param 0 Return 1 Cyclo Vg 2 Total 3 LOC 17 eLOC 15 lLOC 12 Comment 0 Lines 19 Total: Functions LOC 46 eLOC 38 lLOC 28 InCmp 16 CycloCmp 8 ------------------------------------------------------------------------ ~~ Project Functional Analysis ~~ Total Functions .......: 6 Total Physical Lines ..: 62 Total LOC .............: 46 Total eLOC ............: 38 Total lLOC ............: 28 Total Cyclomatic Comp. : 8 Total Interface Comp. .: 16 Total Parameters ......: 9 Total Return Points ...: 7 Total Comment Lines ...: 0 Total Blank Lines .....: 16 ------ ----- ----- ------ ------ ----- Avg Physical Lines ....: 10.33 Avg LOC ...............: 7.67 Avg eLOC ..............: 6.33 Avg lLOC ..............: 4.67 Avg Cyclomatic Comp. ..: 1.33 Avg Interface Comp. ...: 2.67 Avg Parameters ........: 1.50 Avg Return Points .....: 1.17 Avg Comment Lines .....: 0.00 ------ ----- ----- ------ ------ ----- Max LOC ...............: 17 Max eLOC ..............: 15 Max lLOC ..............: 12 Max Cyclomatic Comp. ..: 2 Max Interface Comp. ...: 4 Max Parameters ........: 2 Max Return Points .....: 2 Max Comment Lines .....: 0 Max Total Lines .......: 19 ------ ----- ----- ------ ------ ----- Min LOC ...............: 3 Min eLOC ..............: 2 Min lLOC ..............: 1 Min Cyclomatic Comp. ..: 1 Min Interface Comp. ...: 1 Min Parameters ........: 0 Min Return Points .....: 1 Min Comment Lines .....: 0 Min Total Lines .......: 5 ------------------------------------------------------------------------ ~~ File Summary ~~ C Source Files *.c ....: 0 C/C++ Include Files *.h: 0 C++ Source Files *.c* .: 1 C++ Include Files *.h* : 0 Other Source Files ....: 0 Java Source File *.jav*: 0 Total File Count ......: 1 Shareware evaluation licenses process only 10 files. Paid licenses enable wild cards and file/project totals. ________________________________________________________________________

--------------31B6F031C4970D24E3366504 Content-Type: text/html; charset=us-ascii; name="relatorio.htm" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="relatorio.htm" Resource Standard Metrics 6.03

Resource Standard Metrics for C, C++ and Java Visual Metrics Version 6.03 License Type: Shareware Evaluation License Licensed To : Shareware End User - Distribute Freely License No. : SW1380 License Date: Sat Dec 05 15:31:28 1998 (C) 2001 M Squared Technologies Run Date: Mon Apr 01 15:05:58 2002 ________________________________________________________________________ ~~ Function Metrics ~~ ~~ Complexity Analysis ~~ File: complexo.cpp Date: Mon Apr 01 13:58:02 2002 File Size: 1251 Bytes ________________________________________________________________________ Function: soma Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 9 Function: diferenca Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 8 Function: produto Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 8 Function: quociente Complexity Param 2 Return 2 Cyclo Vg 2 Total 6 LOC 11 eLOC 9 lLOC 6 Comment 0 Lines 13 Function: modulo Complexity Param 1 Return 1 Cyclo Vg 1 Total 3 LOC 3 eLOC 2 lLOC 1 Comment 0 Lines 5 Function: main Complexity Param 0 Return 1 Cyclo Vg 2 Total 3 LOC 17 eLOC 15 lLOC 12 Comment 0 Lines 19 ------------------------------------------------------------------------ ~~ Total File Summary ~~ LOC 50 eLOC 42 lLOC 28 Comment 8 Lines 78 ------------------------------------------------------------------------ ~~ File Functional Summary ~~ File Function Count ...: 6 Total LOC Lines LOC ...: 46 Total eLOC Lines ......: 38 Total lLOC Lines ......: 28 Total Function Params .: 9 Total Function Return .: 7 Total Cyclo Complexity : 8 Total Function Complex.: 24 ------ ----- ----- ------ ------ ----- Max Function LOC ......: 17 Average Function LOC ..: 7.67 Max Function eLOC .....: 15 Average Function eLOC .: 6.33 Max Function lLOC .....: 12 Average Function lLOC .: 4.67 ------ ----- ----- ------ ------ ----- Max Function Parameters: 2 Avg Function Parameters: 1.50 Max Function Returns ..: 2 Avg Function Returns ..: 1.17 Max Interface Complex. : 4 Avg Interface Complex. : 2.67 Max Cyclomatic Complex.: 2 Avg Cyclomatic Complex.: 1.33 Max Total Complexity ..: 6 Avg Total Complexity ..: 4.00 ________________________________________________________________________ End of File: complexo.cpp ~~ Total Metrics For 1 Files ~~ ------------------------------------------------------------------------ ~~ Total Project Summary ~~ LOC 50 eLOC 42 lLOC 28 Comment 8 Lines 78 ------------------------------------------------------------------------ ~~ Project Functional Metrics ~~ No Sort Method Function: soma Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 9 Function: diferenca Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 8 Function: produto Complexity Param 2 Return 1 Cyclo Vg 1 Total 4 LOC 5 eLOC 4 lLOC 3 Comment 0 Lines 8 Function: quociente Complexity Param 2 Return 2 Cyclo Vg 2 Total 6 LOC 11 eLOC 9 lLOC 6 Comment 0 Lines 13 Function: modulo Complexity Param 1 Return 1 Cyclo Vg 1 Total 3 LOC 3 eLOC 2 lLOC 1 Comment 0 Lines 5 Function: main Complexity Param 0 Return 1 Cyclo Vg 2 Total 3 LOC 17 eLOC 15 lLOC 12 Comment 0 Lines 19 Total: Functions LOC 46 eLOC 38 lLOC 28 InCmp 16 CycloCmp 8 ------------------------------------------------------------------------ ~~ Project Functional Analysis ~~ Total Functions .......: 6 Total Physical Lines ..: 62 Total LOC .............: 46 Total eLOC ............: 38 Total lLOC ............: 28 Total Cyclomatic Comp. : 8 Total Interface Comp. .: 16 Total Parameters ......: 9 Total Return Points ...: 7 Total Comment Lines ...: 0 Total Blank Lines .....: 16 ------ ----- ----- ------ ------ ----- Avg Physical Lines ....: 10.33 Avg LOC ...............: 7.67 Avg eLOC ..............: 6.33 Avg lLOC ..............: 4.67 Avg Cyclomatic Comp. ..: 1.33 Avg Interface Comp. ...: 2.67 Avg Parameters ........: 1.50 Avg Return Points .....: 1.17 Avg Comment Lines .....: 0.00 ------ ----- ----- ------ ------ ----- Max LOC ...............: 17 Max eLOC ..............: 15 Max lLOC ..............: 12 Max Cyclomatic Comp. ..: 2 Max Interface Comp. ...: 4 Max Parameters ........: 2 Max Return Points .....: 2 Max Comment Lines .....: 0 Max Total Lines .......: 19 ------ ----- ----- ------ ------ ----- Min LOC ...............: 3 Min eLOC ..............: 2 Min lLOC ..............: 1 Min Cyclomatic Comp. ..: 1 Min Interface Comp. ...: 1 Min Parameters ........: 0 Min Return Points .....: 1 Min Comment Lines .....: 0 Min Total Lines .......: 5 ------------------------------------------------------------------------ ~~ File Summary ~~ C Source Files *.c ....: 0 C/C++ Include Files *.h: 0 C++ Source Files *.c* .: 1 C++ Include Files *.h* : 0 Other Source Files ....: 0 Java Source File *.jav*: 0 Total File Count ......: 1 Shareware evaluation licenses process only 10 files. Paid licenses enable wild cards and file/project totals. ________________________________________________________________________

--------------31B6F031C4970D24E3366504 Content-Type: application/x-unknown-content-type-cppfile; name="complexo.cpp" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="complexo.cpp" I2luY2x1ZGUgImNvbXBsZXhvLmgiDQojaW5jbHVkZSA8c3RkbGliLmg+ICAgICAgICAgICAg IC8qIHBhcmEgbWFsbG9jLCBOVUxMICovDQojaW5jbHVkZSA8bWF0aC5oPiAgICAgICAgICAg ICAgIC8qIHBhcmEgc3FydCAqLw0KI2luY2x1ZGUgPGlvc3RyZWFtLmg+CQkJLyogcGFyYSBj aW4sIGNvdXQqLyANCg0KaW50IHNvbWEgKGludCB4LCBpbnQgeSkgew0KDQogIGludCByOw0K DQogICAgciA9IHggKyB5Ow0KICAgIA0KICByZXR1cm4gcjsNCg0KfQ0KDQppbnQgZGlmZXJl bmNhIChpbnQgeCwgaW50IHkpIHsNCg0KICBpbnQgcjsNCg0KICByID0geCAtIHk7DQogIHJl dHVybiByOw0KDQp9DQoNCmludCBwcm9kdXRvIChpbnQgeCwgaW50IHkpIHsNCg0KICBpbnQg cjsNCg0KICByID0geCAqIHk7DQogIHJldHVybiByOw0KDQp9DQoNCi8qLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICBOYSBmdW5jYW8gYWJhaXhvLCBkZXZl cmlhIGhhdmVyIHVtIG1vZG8NCiAgbWVsaG9yIGRlIGluZGljYXIgcXVlIG8gZGl2aXNvciBl JyB6ZXJvDQogIChubyBtb21lbnRvIHJldG9ybmEtc2UgTlVMTCkuDQogIC0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0qLw0KDQppbnQgcXVvY2llbnRlIChpbnQg eCwgaW50IHkpIHsNCg0KICBpbnQgcjsNCiAgZG91YmxlIG07DQoNCiAgbSA9IG1vZHVsbyh5 KTsNCiAgaWYgKG0gPT0gMCkgew0KCSAgcmV0dXJuIE5VTEw7DQogIH0gZWxzZSB7DQoJICBy ID0geC95OwkNCiAgfQ0KICByZXR1cm4gcjsNCn0NCg0KZG91YmxlIG1vZHVsbyAoaW50IHgp IHsNCg0KICByZXR1cm4gc3FydCh4KTsNCg0KfQ0KDQp2b2lkIG1haW4oKSB7DQoNCglpbnQg b3A7DQoJaW50IG9wMSwgb3AyLCByZXN1bHRhZG87DQoJY291dDw8IkVudHJlIGNvbSBhIG9w ZXJhY2FvOiAiPDxlbmRsOw0KCWNpbiA+PiBvcDsNCglzd2l0Y2ggKG9wKXsNCgljYXNlIDE6 DQoNCgkJCWNvdXQ8PCJWYyB2YWkgZmF6ZXIgdW1hIHNvbWE6ICI8PGVuZGw7DQoJCQljb3V0 PDwiRW50cmUgY29tIG8gcHJpbWVpcm8gb3BlcmFuZG86ICI8PGVuZGw7DQoJCQljaW4gPj4g b3AxOw0KCQkJY291dDw8IkVudHJlIGNvbSBvIHNlZ3VuZG8gb3BlcmFuZG86ICI8PGVuZGw7 DQoJCQljaW4gPj4gb3AyOw0KCQkJcmVzdWx0YWRvPSBzb21hKG9wMSwgb3AyKTsNCgkJCWNv dXQgPDwiTyByZXN1bHRhZG8gZToiIDw8IHJlc3VsdGFkbyA8PGVuZGw7DQoJCQlicmVhazsN Cgl9DQp9CQkJ --------------31B6F031C4970D24E3366504 Content-Type: application/x-unknown-content-type-hfile; name="complexo.h" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="complexo.h" LyotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQoNCiAgVGlwbyAi Y29tcGxleG8iDQoNCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0q Lw0KDQovKnN0cnVjdCBjb21wbCB7DQogIGRvdWJsZSBhOw0KICBkb3VibGUgYjsNCn07DQoN CnR5cGVkZWYgc3RydWN0IGNvbXBsICogY29tcGxleG87DQoqLw0KaW50IHNvbWEgKGludCB4 LCBpbnQgeSk7DQoNCmludCBkaWZlcmVuY2EgKGludCB4LCBpbnQgeSk7DQoNCmludCBwcm9k dXRvIChpbnQgeCwgaW50IHkpOw0KDQppbnQgcXVvY2llbnRlIChpbnQgeCwgaW50IHkpOw0K DQpkb3VibGUgbW9kdWxvIChpbnQgeCk7 --------------31B6F031C4970D24E3366504--