LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

When will CVI support a C++ compiler Natively?

Parameter    Value
=========    =====
Project Directory   -----\
Project Name    -----
Checkpoint Name    Baseline
Created On    29 October 2007, 3:49:49 PM
Files     10
Lines     2,030
Statements    756
Percent Branch Statements  9.9
Percent Lines with Comments  35.0
Functions    91
Average Statements per Function  11.7
Complexity of Most Complex Function 14
Maximum Block Depth   4
Average Block Depth   1.05
Average Complexity   4.90
--------------------------------------------------------------------------------------------
Names of 10 Functions   Complexity, Statements, Max Depth, Calls
bridge_test()    8, 37, 4, 33
burden_cal()    14, 49, 4, 31
Burden_Labels()    1, 2, 1, 0
GUI_configure_bridge()   3, 7, 2, 8
idle_time()    3, 6, 2, 8
initialize_environment()  6, 16, 2, 10
main()     4, 9, 2, 3
purge_connections()   1, 2, 1, 3
run_main_board()   5, 17, 2, 17
Server()    4, 11, 3, 6
--------------------------------------------------------------------------------------------
Block Depth    Statements
0     187
1     407
2     113
3     37
4     12
5     0
6     0
7     0
8     0
9+     0
--------------------------------------------------------------------------------------------
 
This is one of my WIP's note the much more reasonable code, i'm still embarrassed about complexity 14 but that can't be helped with an oversized switch statement.

Message Edited by DanielGreen on 10-29-2007 05:53 PM

0 Kudos
Message 31 of 48
(2,036 Views)

Yup, complexity should be < 10, but sometimes hard to avoid.  Those are good metrics. 

Here's another one.  Max complexity metric is     ***** 389 *****    which I think might be a record.  Can anyone beat this?

Parameter    Value
=========    =====
Project Directory   ------
Project Name    ------
Checkpoint Name    Baseline
File Name    ------

Lines     2,303
Statements    1,323
Percent Branch Statements  37.8
Percent Lines with Comments  22.5
Functions    7
Average Statements per Function  292.9
Line Number of Most Complex Function 639
Name of Most Complex Function  OPR_PerformOperCheck()
Complexity of Most Complex Function 389
Line Number of Deepest Block  1295
Maximum Block Depth   9+
Average Block Depth   4.36
Average Complexity   81.57

--------------------------------------------------------------------------------------------
Names of 7 Functions   Complexity, Statements, Max Depth, Calls

adjacent()    101, 71, 5, 9
adjacentAboveBelow()   7, 13, 3, 0
adjacentLeftRight()   7, 13, 3, 0
OPR_DeleteOperPtrs()   7, 19, 2, 6
OPR_DeleteOperReqs()   3, 6, 3, 1
OPR_PerformOperCheck()   389, 1021, 11, 401
OPR_ReadOperConfigFile()  57, 148, 6, 16

--------------------------------------------------------------------------------------------
Block Depth    Statements

0     32
1     144
2     138
3     151
4     259
5     229
6     119
7     87
8     88
9+     76
--------------------------------------------------------------------------------------------

0 Kudos
Message 32 of 48
(2,030 Views)

Here's one of mine.  Bad complexity metric.   But avg block depth 1.56 is good.  Maybe complexity / block depth trades off.

Parameter    Value
=========    =====
Project Directory   --------
Project Name    --------
Checkpoint Name    Baseline
Created On    29 October 2007, 4:04:30 PM
Files     9
Lines     5,001
Statements    2,299
Percent Branch Statements  28.6
Percent Lines with Comments  22.7
Functions    69
Average Statements per Function  47.9
Line Number of Most Complex Function {undefined}
Name of Most Complex Function  Sigma_Systems_C5Open()
Complexity of Most Complex Function 56
Line Number of Deepest Block  {undefined}
Maximum Block Depth   5
Average Block Depth   1.56
Average Complexity   22.44

--------------------------------------------------------------------------------------------
Names of 9 Functions   Complexity, Statements, Max Depth, Calls

BlackbodyOpen()    22, 117, 4, 62
ChamberOpen()    16, 48, 4, 14
GetRegSerialConfig()   11, 35, 2, 20
HP34970Open()    16, 52, 3, 20
MeasureUUTPower()   4, 16, 2, 11
MicristarOpen()    18, 69, 4, 26
PowerOutletOpen()   33, 151, 3, 74
Sigma_Systems_C5Open()   56, 208, 4, 76
Watlow_988Open()   26, 101, 4, 36

--------------------------------------------------------------------------------------------
Block Depth    Statements

0     314
1     817
2     815
3     285
4     58
5     10
6     0
7     0
8     0
9+     0
--------------------------------------------------------------------------------------------

0 Kudos
Message 33 of 48
(2,027 Views)
Okay, time for some comic relief for you CS types: Complexity = 847   Beat that!  (The algorithm seems remarkably sensitive to nested switch statements with many one-line cases.)
 
It's a huge project that I inherited, and have been whittling away at gradually, and adding to under duress (hopefully just the features, and not the stats!). 
 
Against my better judgement, here are a few more ugly details:
 
Files     54
Lines     69,159
Statements    43,251
Percent Branch Statements  18.8
Percent Lines with Comments  11.4
Functions    597
Average Statements per Function  114.5
Line Number of Most Complex Function {undefined}
Name of Most Complex Function  -----------()
Complexity of Most Complex Function 847
Line Number of Deepest Block  {undefined}
Maximum Block Depth   9+
Average Block Depth   2.67
Average Complexity   95.73
 
 
Message 34 of 48
(2,021 Views)
I knew some of you guys were out there Smiley Wink
 
OMG       ****** 847 *******     You are the reigning champ   Smiley Very Happy
 
My hat's off to whoever wrote that, I wouldn't know how to get the metric up that high if I tried.
 
That's just gotta be a load of fun to work with.  I guess so long as you don't know any better you don't mind it so much. 
 
I bet it's right in the middle of some system that's really important, too, like traffic light control for Chicago, or railroad signal control, or better yet a power plant of some kind.  Or a drawbridge, that would be fun.  Elevator control maybe.  You don't work for Otis by any chance do you?
 
Menchar
 
 
0 Kudos
Message 35 of 48
(2,016 Views)
I found another one of ours with a complexity max of 438, but I realize now that's small potatos.
 
I bet someone out there can break a grand ..... don't be shy!
0 Kudos
Message 36 of 48
(2,008 Views)
Heh.  Oh I could really easily, I just don't want to create a project specifically to do so ;-). 
0 Kudos
Message 37 of 48
(1,974 Views)
Fear not: this (now infamous) app does not run any big equipment or pose safety concerns!
 
The interesting thing to me is that the functions that I find tough to debug, alter, or restructure are ones with a complexity metric of (only!) under 200.  The function at 847 is huge, but highly structured and quite easy to work on, and therefore has been a low priority target in my efforts to get things into a more manageable state. In essence it is a look-up table constructed with nested switch statements.  I mention this not to defend that code design, but it seems to me that this particular complexity metric is most certainly not the whole story.
 
[Note to NI developers: Now you see why I put in a request for code folding.]
 
That said, I encourage you lurkers out there to be brave and beat the record.
0 Kudos
Message 38 of 48
(1,968 Views)
I really would kill for code folding tho I horribly miss my #region tages from C#... I may have problems with .net in general, but C# is an elegantly crafted masterpiece of a modern development language.  What it's designed for it's DAMN good at.
0 Kudos
Message 39 of 48
(1,971 Views)
Re C#: I trust you had a good look at Measurement Studio, as suggested early in the thread. I know you may not be able to convert all your colleagues right now, but it sounds like you might want to have the case for C# & Measurement Studio researched and in your back pocket, ready to raise when the opportunity presents itself.
0 Kudos
Message 40 of 48
(1,959 Views)