MegaSquirt (And FreeEMS) CCN results

Discuss MegaSquirt, VEMS and other non-free hardware and software here.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

MegaSquirt (And FreeEMS) CCN results

Post by Fred »

I decided to do some analysis of the various code versions that are available for the MS brand hardware.

I used a tool called pmccabe in the following form :

Code: Select all

pmccabe -vtf *.c *.h
I'll present the results of each variant in a separate post for clarity.

Fred.
Last edited by Fred on Tue Mar 27, 2012 6:41 pm, edited 1 time in total.
Reason: Updated title to reflect reality.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Lance's GPIO CCN results

Post by Fred »

First up is Lance's GPIO transmission code :

Code: Select all

fred@rwdlsd:~/EFI$ pmccabe -vtf 4L60E_main.c 
Modified McCabe Cyclomatic Complexity
|   Traditional McCabe Cyclomatic Complexity
|       |    # Statements in function
|       |        |   First line of function
|       |        |       |   # lines in function
|       |        |       |       |  filename(definition line number):function
|       |        |       |       |           |
1	1	0	609	102	4L60E_main.c(634): UnimplementedISR
1	1	37	745	265	4L60E_main.c(747): intrp_1dctable
"4L60E_main.c", line 1388: too many }'s
199	212	739	1413	2356	4L60E_main.c(1432): unnamed::main
1	1	2	3769	9	4L60E_main.c(3773): unnamed::tcc_unlock
3	3	5	3778	19	4L60E_main.c(3780): unnamed::tcc_lock
2	2	19	3809	42	4L60E_main.c(3824): unnamed::vss_reset
1	1	1	3850	5	4L60E_main.c(3852): unnamed::reset
3	10	14	3854	48	4L60E_main.c(3858): unnamed::get_adc
2	5	14	3902	38	4L60E_main.c(3907): unnamed::switch_page
18	18	23	3939	50	4L60E_main.c(3953): unnamed::intrp_1dctable
13	13	35	3988	47	4L60E_main.c(3993): unnamed::intrp_2dctable
8	8	28	4039	166	4L60E_main.c(4125): unnamed::VSS_timer0
18	18	67	4204	197	4L60E_main.c(4207): unnamed::ISR_Timer_Clock
3	3	11	4400	25	4L60E_main.c(4404): unnamed::ISR_TimerOverflow
58	81	320	4424	575	4L60E_main.c(4475): unnamed::ISR_SCI_Comm
1	1	1	5150	148	4L60E_main.c(5292): unnamed::can_xsub01
1	1	1	5297	12	4L60E_main.c(5304): unnamed::UnimplementedISR
2	2	11	5325	43	4L60E_main.c(5350): unnamed::Flash_Init
1	1	5	5367	22	4L60E_main.c(5369): unnamed::Flash_Erase_Sector
1	1	5	5388	14	4L60E_main.c(5390): unnamed::Flash_Write_Word
"4L60E_main.c", line 5429: unexpected EOF
337	383	1389	1	5428	4L60E_main.c
337	383	1389	n/a	5428	Total
Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

James' trans CCN results

Post by Fred »

Next we have James' GPIO/ms2 transmission code :

Code: Select all

fred@rwdlsd:~/EFI/trans/trans20080106/trans$ pmccabe -vtf *.c *.h
Modified McCabe Cyclomatic Complexity
|   Traditional McCabe Cyclomatic Complexity
|       |    # Statements in function
|       |        |   First line of function
|       |        |       |   # lines in function
|       |        |       |       |  filename(definition line number):function
|       |        |       |       |           |
1	1	1	2	4	premain.c(2): __premain
1	1	2	1	6	premain.c
0	0	1	1	10	sigs.c
4	4	35	4	62	trans_can.c(4): CanInit
9	13	42	67	78	trans_can.c(67): CanTxIsr
14	18	61	146	118	trans_can.c(146): CanRxIsr
1	1	1	265	3	trans_can.c(265): can_xsub01
4	4	16	269	31	trans_can.c(269): can_sendburn
4	4	18	301	36	trans_can.c(301): can_reqdata
5	5	20	339	34	trans_can.c(339): can_snddata
41	49	200	1	372	trans_can.c
10	10	142	4	232	trans_init.c(4): main_init
10	10	143	1	235	trans_init.c
98	98	274	189	486	trans_main.c(189): main
98	98	303	1	674	trans_main.c
10	10	21	5	28	trans_misc.c(5): get_adc
8	8	23	41	33	trans_misc.c(41): shift_lookup
1	1	3	83	8	trans_misc.c(83): Flash_Init
10	10	47	92	70	trans_misc.c(92): realtime
3	3	13	165	24	trans_misc.c(165): twoptlookup
2	2	9	191	12	trans_misc.c(191): can_init_tbl
1	1	2	204	4	trans_misc.c(204): calc_coeff
35	35	125	1	207	trans_misc.c
6	6	19	6	34	trans_ss.c(6): ISR_vss
6	6	19	41	31	trans_ss.c(41): ISR_tach5
6	6	19	73	31	trans_ss.c(73): ISR_tach2
18	18	60	1	103	trans_ss.c
0	0	0	1	24	flash.h
0	0	1	1	224	hcs12def.h
1	1	7	29	51	trans.h(29): UnimplementedISR
1	1	66	1	225	trans.h
204	212	901	n/a	2080	Total
Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

MS2 base code CCN results :

Post by Fred »

Thirdly, Al's monolithic MS2 code :

Code: Select all

fred@rwdlsd:~/EFI$ pmccabe -vtf main_v2.883i.c 
Modified McCabe Cyclomatic Complexity
|   Traditional McCabe Cyclomatic Complexity
|       |    # Statements in function
|       |        |   First line of function
|       |        |       |   # lines in function
|       |        |       |       |  filename(definition line number):function
|       |        |       |       |           |
1	1	0	181	82	main_v2.883i.c(183): UnimplementedISR
"main_v2.883i.c", line 265: too many }'s
1	1	43	269	384	main_v2.883i.c(270): intrp_1dctable
"main_v2.883i.c", line 1411: too many }'s
367	381	1224	1430	2295	main_v2.883i.c(1445): unnamed::main
16	16	77	3724	114	main_v2.883i.c(3730): unnamed::ign_reset
26	33	96	3837	186	main_v2.883i.c(3842): unnamed::get_adc
2	5	18	4022	41	main_v2.883i.c(4027): unnamed::switch_page
21	21	29	4062	48	main_v2.883i.c(4064): unnamed::intrp_1dctable
13	13	35	4109	44	main_v2.883i.c(4111): unnamed::intrp_2dctable
7	7	19	4152	27	main_v2.883i.c(4154): unnamed::intrp_1ditable
7	7	19	4178	28	main_v2.883i.c(4180): unnamed::CW_table
24	24	64	4205	187	main_v2.883i.c(4210): unnamed::tpsaen
51	51	137	4391	242	main_v2.883i.c(4393): unnamed::ego_calc
39	39	98	4632	139	main_v2.883i.c(4639): unnamed::amc
5	5	16	4770	23	main_v2.883i.c(4772): unnamed::afrLF_calc
41	43	132	4792	209	main_v2.883i.c(4799): unnamed::ISR_Timer_Clock
6	6	26	5000	46	main_v2.883i.c(5006): unnamed::ISR_Ign_TimerIn
"main_v2.883i.c", line 5074: too many }'s
7	7	29	5074	38	main_v2.883i.c(5078): unnamed::Ign_TimerIn/ultyp::if
2	2	14	5111	20	main_v2.883i.c(5112): unnamed::Ign_TimerIn/ultyp::if
1	1	1	5130	10	main_v2.883i.c(5137): unnamed::Ign_TimerIn/ultyp::if
3	3	6	5870	13	main_v2.883i.c(5871): unnamed::Ign_TimerIn/ultyp::if
2	2	4	5882	12	main_v2.883i.c(5885): unnamed::Ign_TimerIn/ultyp::if
28	31	86	5893	153	main_v2.883i.c(5900): unnamed::Ign_TimerIn/ultyp::if
1	1	1	6090	4	main_v2.883i.c(6091): unnamed::Ign_TimerIn/ultyp::if
1	1	1	6098	4	main_v2.883i.c(6098): unnamed::Ign_TimerIn/ultyp::if
1	1	2	6101	15	main_v2.883i.c(6110): unnamed::Ign_TimerIn/ultyp::if
1	1	2	6115	5	main_v2.883i.c(6116): unnamed::Ign_TimerIn/ultyp::if
1	1	2	6119	17	main_v2.883i.c(6126): unnamed::Ign_TimerIn/ultyp::if
2	2	3	6143	7	main_v2.883i.c(6144): unnamed::Ign_TimerIn/ultyp::if
6	6	24	6149	55	main_v2.883i.c(6152): unnamed::Ign_TimerIn/ultyp::if
9	9	31	6204	53	main_v2.883i.c(6204): unnamed::Ign_TimerIn/ultyp::if
17	17	56	6259	122	main_v2.883i.c(6259): unnamed::Ign_TimerIn/ultyp::if
2	2	3	6380	50	main_v2.883i.c(6424): unnamed::Ign_TimerIn/ultyp::if
12	12	50	6429	87	main_v2.883i.c(6430): unnamed::Ign_TimerIn/ultyp::if
3	3	6	6526	11	main_v2.883i.c(6526): unnamed::Ign_TimerIn/ultyp::if
2	2	3	6536	7	main_v2.883i.c(6537): unnamed::Ign_TimerIn/ultyp::if
1	1	2	6546	4	main_v2.883i.c(6546): unnamed::Ign_TimerIn/ultyp::if
2	2	6	6551	13	main_v2.883i.c(6552): unnamed::Ign_TimerIn/ultyp::if
2	2	3	6569	6	main_v2.883i.c(6569): unnamed::Ign_TimerIn/ultyp::if
2	2	6	6578	11	main_v2.883i.c(6578): unnamed::Ign_TimerIn/ultyp::if
1	1	2	6594	14	main_v2.883i.c(6597): unnamed::Ign_TimerIn/ultyp::if
"main_v2.883i.c", line 6624: too many }'s
20	20	59	6623	114	main_v2.883i.c(6630): unnamed::Ign_TimerIn/ultyp::ISR_TimerOverflow
19	19	61	6736	107	main_v2.883i.c(6742): unnamed::Ign_TimerIn/ultyp::ISR_Ign_TimerOut
2	2	7	6842	21	main_v2.883i.c(6848): unnamed::Ign_TimerIn/ultyp::ISR_Inj1_TimerOut
2	2	8	6862	22	main_v2.883i.c(6868): unnamed::Ign_TimerIn/ultyp::ISR_Inj2_TimerOut
6	6	24	6883	37	main_v2.883i.c(6888): unnamed::Ign_TimerIn/ultyp::move_IACmotor
67	94	366	6919	611	main_v2.883i.c(6948): unnamed::Ign_TimerIn/ultyp::ISR_SCI_Comm
1	1	1	7681	170	main_v2.883i.c(7848): unnamed::Ign_TimerIn/ultyp::can_xsub01
1	1	1	7850	7	main_v2.883i.c(7852): unnamed::Ign_TimerIn/ultyp::barocor_eq
2	2	3	7856	27	main_v2.883i.c(7858): unnamed::Ign_TimerIn/ultyp::aircor_eq
8	8	21	7882	32	main_v2.883i.c(7884): unnamed::Ign_TimerIn/ultyp::coil_dur_table
13	13	35	7913	44	main_v2.883i.c(7915): unnamed::Ign_TimerIn/ultyp::intrp_2ditable
7	7	19	7956	28	main_v2.883i.c(7958): unnamed::Ign_TimerIn/ultyp::knk_thresh_calc
7	7	17	7983	39	main_v2.883i.c(7985): unnamed::Ign_TimerIn/ultyp::set_spr_port
1	1	1	8021	9	main_v2.883i.c(8026): unnamed::Ign_TimerIn/ultyp::UnimplementedISR
2	2	11	8047	43	main_v2.883i.c(8072): unnamed::Ign_TimerIn/ultyp::Flash_Init
1	1	5	8089	18	main_v2.883i.c(8090): unnamed::Ign_TimerIn/ultyp::Flash_Erase_Sector
1	1	5	8106	13	main_v2.883i.c(8108): unnamed::Ign_TimerIn/ultyp::Flash_Write_Word
"main_v2.883i.c", line 8119: unexpected EOF
"main_v2.883i.c", line 8119: not enough }'s
1	1	17	5045	3075	main_v2.883i.c(5051): unnamed::Ign_TimerIn
"main_v2.883i.c", line 8119: unexpected EOF
897	953	3101	1	8118	main_v2.883i.c
897	953	3101	n/a	8118	Total
Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

MS2Extra CCN results

Post by Fred »

Lastly for now, James and Ken's MS2Extra code :

Code: Select all

fred@rwdlsd:~/EFI/ms2extra/ms2extra_beta20080105/ms2extra$ pmccabe -vtf *.c *.h
Modified McCabe Cyclomatic Complexity
|   Traditional McCabe Cyclomatic Complexity
|       |    # Statements in function
|       |        |   First line of function
|       |        |       |   # lines in function
|       |        |       |       |  filename(definition line number):function
|       |        |       |       |           |
4	4	35	4	62	ms2_extra_can.c(4): CanInit
9	13	42	67	78	ms2_extra_can.c(67): CanTxIsr
14	18	61	146	118	ms2_extra_can.c(146): CanRxIsr
1	1	1	265	4	ms2_extra_can.c(265): can_xsub01
4	4	16	270	32	ms2_extra_can.c(270): can_sendburn
4	4	18	303	37	ms2_extra_can.c(303): can_reqdata
5	5	20	342	35	ms2_extra_can.c(342): can_snddata
41	49	200	1	376	ms2_extra_can.c
53	53	142	4	276	ms2_extra_ego.c(4): ego_calc
5	5	16	281	22	ms2_extra_ego.c(281): afrLF_calc
58	58	160	1	302	ms2_extra_ego.c
5	5	64	7	88	ms2_extra_ign.c(7): ign_reset
8	8	21	96	31	ms2_extra_ign.c(96): coil_dur_table
7	7	19	128	27	ms2_extra_ign.c(128): knk_thresh_calc
27	27	96	156	170	ms2_extra_ign.c(156): wheel_fill_event_array
47	47	206	1	325	ms2_extra_ign.c
21	21	35	8	57	ms2_extra_ign_in.c(8): FIRE_COIL
3	3	7	66	11	ms2_extra_ign_in.c(66): FIRE_COIL_ROTARY
2	2	3	78	7	ms2_extra_ign_in.c(78): DWELL_COIL_ROTARY
23	23	49	86	74	ms2_extra_ign_in.c(86): DWELL_COIL
3	3	12	161	18	ms2_extra_ign_in.c(161): syncfirst
417	417	1037	181	1927	ms2_extra_ign_in.c(181): ISR_Ign_TimerIn
469	469	1152	1	2107	ms2_extra_ign_in.c
85	85	515	6	718	ms2_extra_ign_wheel.c(6): ign_wheel_init
85	85	517	1	723	ms2_extra_ign_wheel.c
1	1	3	4	6	ms2_extra_init.c(4): set_prime_ASE
2	2	8	11	15	ms2_extra_init.c(11): set_EAE_lagcomp
171	174	482	27	858	ms2_extra_init.c(27): main_init
174	177	496	1	884	ms2_extra_init.c
1	1	2	12	6	ms2_extra_inj.c(12): setup_staging
13	13	30	20	60	ms2_extra_inj.c(20): staging_on
8	8	25	84	53	ms2_extra_inj.c(84): calc_staged_pw
8	8	47	183	83	ms2_extra_inj.c(183): run_EAE_calcs
30	30	111	1	265	ms2_extra_inj.c
371	371	903	1108	1853	ms2_extra_main.c(1108): main
371	371	1023	1	2960	ms2_extra_main.c
1	1	9	9	12	ms2_extra_misc.c(9): idle_ctl_init
84	84	174	22	311	ms2_extra_misc.c(22): idle_ctl
1	1	4	334	7	ms2_extra_misc.c(334): boost_ctl_init
7	7	31	342	66	ms2_extra_misc.c(342): boost_ctl
34	34	100	410	448	ms2_extra_misc.c(410): get_adc
10	10	25	860	38	ms2_extra_misc.c(860): intrp_1dctable
8	8	23	899	38	ms2_extra_misc.c(899): intrp_1ditable
14	14	39	938	55	ms2_extra_misc.c(938): intrp_2dctable
8	8	24	995	33	ms2_extra_misc.c(995): move_IACmotor
1	1	1	1030	6	ms2_extra_misc.c(1030): barocor_eq
2	2	3	1037	26	ms2_extra_misc.c(1037): aircor_eq
13	13	35	1064	43	ms2_extra_misc.c(1064): intrp_2ditable
7	7	19	1108	27	ms2_extra_misc.c(1108): CW_table
7	7	17	1136	34	ms2_extra_misc.c(1136): set_spr_port
1	1	3	1179	9	ms2_extra_misc.c(1179): Flash_Init
10	10	99	1189	130	ms2_extra_misc.c(1189): realtime
6	6	15	1344	38	ms2_extra_misc.c(1344): calc_opentime
3	3	13	1383	24	ms2_extra_misc.c(1383): twoptlookup
2	2	15	1409	19	ms2_extra_misc.c(1409): can_init_tbl
219	219	672	1	1427	ms2_extra_misc.c
1	1	1	2	4	premain.c(2): __premain
1	1	2	1	6	premain.c
0	0	2	1	17	sigs.c
0	0	0	1	24	flash.h
0	0	1	1	224	hcs12def.h
1	1	65	41	345	ms2_extra.h(41): UnimplementedISR
1	1	4	880	151	ms2_extra.h(880): main
2	2	173	1	1152	ms2_extra.h
1497	1508	4715	n/a	10792	Total
Feel free to discuss the meaning of these figures and any interesting points below.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: MegaSquirt CCN results

Post by Fred »

It's interesting to note that lance has stolen some of Al's "}"'s leaving lances code with too many and Al's with not enough. Also interesting is although the bulk of the ms2extra code is spread thinly (as it should be) the main loop remains excessively full (almost the same as the base code, slightly more infact), and the ISR_Ign_TimerIn routine is even more complex. Because both the base code and ms2e use inline assembly regularly the results may be skewed depending on how the interpreter handles that.

For a somewhat worthless comparison, here are my FreeEMS base code CCN results :

Code: Select all

fred@rwdlsd:~/workspaces/home/freeems/src$ pmccabe -vtf *.c *.h
Modified McCabe Cyclomatic Complexity
|   Traditional McCabe Cyclomatic Complexity
|       |    # Statements in function
|       |        |   First line of function
|       |        |       |   # lines in function
|       |        |       |       |  filename(definition line number):function
|       |        |       |       |           |
0	0	0	1	23	comms_isrs.c
1	1	0	33	4	engine_position_isrs.c(33): PrimaryRPMISR
1	1	0	38	4	engine_position_isrs.c(38): SecondaryRPMISR
2	2	2	1	41	engine_position_isrs.c
1	1	0	42	4	ignition_isrs.c(42): IgnitionDwellISR
1	1	0	47	4	ignition_isrs.c(47): IgnitionFireISR
2	2	2	1	50	ignition_isrs.c
2	2	7	29	20	init.c(29): init_pll
1	1	0	50	4	init.c(50): init_ints
1	1	26	55	70	init.c(55): init_io
1	1	0	126	4	init.c(126): init_pram
1	1	5	131	16	init.c(131): init
6	6	43	1	146	init.c
1	1	1	47	4	injection_isrs.c(47): Injector1ISR
1	1	1	52	4	injection_isrs.c(52): Injector2ISR
1	1	1	57	4	injection_isrs.c(57): Injector3ISR
1	1	1	62	4	injection_isrs.c(62): Injector4ISR
1	1	1	67	4	injection_isrs.c(67): Injector5ISR
1	1	1	72	4	injection_isrs.c(72): Injector6ISR
6	6	12	1	76	injection_isrs.c
2	2	4	116	8	main.c(116): sleep
7	7	12	125	17	main.c(125): inject
3	3	10	143	21	main.c(143): main
12	12	30	1	163	main.c
1	1	0	26	1	misc_isrs.c(26): UISR
1	1	1	1	27	misc_isrs.c
0	0	0	1	975	9s12xdp512.h
0	0	0	1	71	freeems.h
0	0	0	1	49	init.h
0	0	1	1	71	interrupts.h
0	0	4	1	36	main.h
0	0	0	1	70	memory.h
29	29	95	n/a	1798	Total
High CCN numbers are considered bad for a variety of reasons, however, in this application, sometimes that has to come second to efficiency considerations. I'd accept that as a good excuse for the ISR routines where necessary, but not for the main loop that is non time critical and could be broken down safely into functions. It should also be possible to break other more important things into functions with no loss of performance using the inline keyword.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

word count results

Post by Fred »

FreeEMS so far :

Code: Select all

fred@rwdlsd:~/workspaces/home/freeems/src$ wc *
  975  4786 30575 9s12xdp512.h
   23   143   884 comms_isrs.c
   41   188  1177 engine_position_isrs.c
   71   413  2420 freeems.h
  492  1488 11089 hc9s12xdp512elfb.x
   50   327  1935 ignition_isrs.c
  146  1250  6673 init.c
   49   350  2187 init.h
   76   365  2173 injection_isrs.c
   71   454  3216 interrupts.h
  163   836  5810 main.c
   36   220  1380 main.h
  147   597  4460 Makefile
   70   330  2613 memory.h
   76   660  3961 memory.x
   27   147   927 misc_isrs.c
 2513 12554 81480 total
MS2E :

Code: Select all

fred@rwdlsd:~/EFI/ms2extra/ms2extra_beta20080105/ms2extra$ wc *.c *.h *.x *.s *.inc Makefile
   376   1745  11979 ms2_extra_can.c
   302   1170   9002 ms2_extra_ego.c
   325   1325   9416 ms2_extra_ign.c
  2107   7853  53846 ms2_extra_ign_in.c
   723   3074  21979 ms2_extra_ign_wheel.c
   884   4024  25389 ms2_extra_init.c
   265   1070   7603 ms2_extra_inj.c
  2960  13257 116360 ms2_extra_main.c
  1427   4866  51141 ms2_extra_misc.c
     6     23    154 premain.c
    17     69    511 sigs.c
    24     74    726 flash.h
   224    890   9788 hcs12def.h
  1152   6210  47050 ms2_extra.h
   351   1181   9151 m68hc12elfb.x
    16    115    693 memory.x
   496   1165  10835 isr_ign.s
    60    226   1954 isr_inj.s
  1013   2423  21898 isr_rtc.s
   961   2850  21489 isr_sci.s
    24     62    788 isr_timerovf.s
   244    690   7722 ms2_conferr.s
   159    435   4069 ms2_extra_asm.s
    93    198   1846 ms2_extra_burner.s
   112    234   2504 ms2_extra_burnfactor.s
  1151   6623  57395 ms2_sermon.s
wc: msii_flash_gcc.s:10: Invalid or incomplete multibyte or wide character
    44    188   1569 msii_flash_gcc.s
  1033   1061   5820 cltfactor.inc
  1033   1062   5379 egofactor.inc
  1033   1060   6447 maffactor.inc
  1033   1062   5821 matfactor.inc
    61    194   1853 ms2extrah.inc
    80    244   3017 ms2extra_structs.inc
   434   1972  15591 s12asmdefs.inc
    86    261   2749 Makefile
 20309  68956 553534 total
MS2

Code: Select all

fred@rwdlsd:~/EFI$ wc main_v2.883i.c 
  8118  39398 313879 main_v2.883i.c
GPIO

Code: Select all

fred@rwdlsd:~/EFI$ wc 4L60E_main.c 
wc: 4L60E_main.c:80: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:456: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:458: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:548: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:570: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:767: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:839: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:841: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:1493: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:1504: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:1506: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:1508: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:1626: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:1647: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:1650: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:1789: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:1799: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:4162: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:4323: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:4342: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:4388: Invalid or incomplete multibyte or wide character
wc: 4L60E_main.c:5417: Invalid or incomplete multibyte or wide character
  5428  29551 220228 4L60E_main.c
trans

Code: Select all

fred@rwdlsd:~/EFI/trans/trans20080106/trans$ wc *.c *.h *.x *.s *.inc Makefile
     6     23    154 premain.c
    10     51    372 sigs.c
   372   1734  12880 trans_can.c
   235   1388   7848 trans_init.c
   674   2777  24733 trans_main.c
   207    799   6027 trans_misc.c
   103    383   2678 trans_ss.c
    24     74    726 flash.h
   224    890   9788 hcs12def.h
   225    952   7898 trans.h
   351   1181   9151 m68hc12elfb.x
    17    115    691 memory.x
   157    408   3491 isr_rtc.s
   801   2466  18234 isr_sci.s
    24     62    788 isr_timerovf.s
  1151   6623  57395 ms2_sermon.s
wc: msii_flash_gcc.s:10: Invalid or incomplete multibyte or wide character
    44    188   1569 msii_flash_gcc.s
    74    164   1513 trans_burner.s
   110    240   2513 trans_burnfactor.s
   227    618   7074 trans_conferr.s
  1033   1061   5820 cltfactor.inc
  1033   1062   5821 matfactor.inc
    30    107    996 ms2extrah.inc
    15     53    514 ms2extra_structs.inc
   434   1972  15591 s12asmdefs.inc
    77    214   2031 Makefile
  7658  25605 206296 total
Enjoy :-)

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: MegaSquirt CCN results

Post by Fred »

I found some arbitrary numbers on what is considered bad and good.

Code: Select all

CC 	Type of procedure 	Risk
1-4 	A simple procedure 	Low
5-10 	A stable procedure 	Low
11-20 	Complex 		Moderate to High
21-50 	Complex 		High
>50 	Very Difficult 		Highly Risky

Code: Select all

CC 		Bad fix probability
1-10 		5%
20-30 		20%
>50 		40%
approaching 100 	60%
These came from the following link :

http://www.fromthetrench.com/category/c ... omplexity/

They are by no means hard and fast figures, but just to give you an idea.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: MegaSquirt CCN results

Post by Fred »

An additional thing I have noticed since my code has started to grow a bit is the density of information embedded in the source is a lot lower per line in mine than in MS code.

I have 4289 lines of source and script etc and I produce a 4480 Byte image for flash.

MS2E has around 22000 lines and produces a 70k image for flash.

thats about 1:1 Byte:Line for me and 3.5:1 Byte:Line for them.

Fairly meaningless at this early stage, but interesting none the less.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: MegaSquirt CCN results

Post by Fred »

Code: Select all

fred@rwdlsd:~/workspaces/home/freeems/src$ pmccabe -vtf *.c inc/*.h
Modified McCabe Cyclomatic Complexity
|   Traditional McCabe Cyclomatic Complexity
|       |    # Statements in function
|       |        |   First line of function
|       |        |       |   # lines in function
|       |        |       |       |  filename(definition line number):function
|       |        |       |       |           |
0	0	1	1	91	CHTTransferTable.c
9	9	22	34	60	commsCore.c(34): checksumAndSend
19	39	145	96	278	commsCore.c(96): decodePacketAndBuildResponse
29	61	199	375	269	commsCore.c(375): copyFlashBlockToBuffer
1	1	0	646	32	commsCore.c(646): sendError
2	2	3	681	48	commsCore.c(681): sendDebug
60	112	374	1	789	commsCore.c
1	1	3	38	5	commsISRs.c(38): sendAndIncrement
1	1	4	46	6	commsISRs.c(46): receiveAndIncrement
3	3	11	55	34	commsISRs.c(55): resetReceiveState
27	27	74	92	148	commsISRs.c(92): SCI0ISR
32	32	96	1	239	commsISRs.c
35	35	118	30	267	coreVarsGenerator.c(30): generateCoreVars
35	35	119	1	296	coreVarsGenerator.c
9	9	22	31	68	derivedVarsGenerator.c(31): generateDerivedVars
9	9	23	1	98	derivedVarsGenerator.c
25	25	104	48	286	enginePositionISRs.c(48): PrimaryRPMISR
7	7	29	335	68	enginePositionISRs.c(335): SecondaryRPMISR
32	32	135	1	402	enginePositionISRs.c
0	0	2	1	160	FixedConfig.c
0	0	1	1	28	flashConstants.c
3	3	10	54	31	flashWrite.c(54): eraseSector
3	3	11	93	22	flashWrite.c(93): writeAlignedBlock
2	2	7	141	17	flashWrite.c(141): writeWord
8	8	31	1	157	flashWrite.c
16	16	60	31	181	fuelAndIgnitionCalcs.c(31): calculateFuelAndIgnition
16	16	61	1	211	fuelAndIgnitionCalcs.c
0	0	25	1	146	globalConstants.c
0	0	1	1	91	IATTransferTable.c
5	5	14	47	40	ignitionISRs.c(47): IgnitionDwellISR
5	5	14	89	40	ignitionISRs.c(89): IgnitionFireISR
10	10	30	1	128	ignitionISRs.c
2	2	7	34	19	init.c(34): initPLL
1	1	0	55	3	init.c(55): checkChecksum
1	1	53	60	98	init.c(60): initIO
1	1	31	160	64	init.c(160): initPagedRam
1	1	20	225	38	init.c(225): initStats
1	1	40	265	60	init.c(265): initVariables
2	2	8	327	19	init.c(327): initFlash
1	1	15	348	38	init.c(348): initECTTimer
1	1	3	388	18	init.c(388): initPITTimer
1	1	3	408	42	init.c(408): initSCIStuff
6	6	15	452	63	init.c(452): initConfiguration
1	1	8	518	28	init.c(518): initInterrupts
1	1	14	548	16	init.c(548): init
20	20	230	1	563	init.c
2	2	2	31	19	injectionISRs.c(31): StagedOnISR
1	1	1	52	14	injectionISRs.c(52): StagedOffISR
3	3	5	1	136	injectionISRs.c
0	0	1	1	113	interrupts.c
0	0	2	1	148	LambdaTables.c
0	0	1	1	91	MAFTransferTable.c
11	11	62	27	141	main.c(27): main
11	11	63	1	167	main.c
1	1	1	29	4	miscISRs.c(29): UISR
1	1	2	34	6	miscISRs.c(34): PortPISR
1	1	2	42	6	miscISRs.c(42): PortJISR
2	2	5	50	105	miscISRs.c(50): PortHISR
1	1	1	157	7	miscISRs.c(157): IRQISR
1	1	1	166	7	miscISRs.c(166): XIRQISR
1	1	2	175	7	miscISRs.c(175): LowVoltageISR
8	8	21	1	181	miscISRs.c
7	7	25	32	84	realtimeISRs.c(32): RTIISR
2	2	6	118	18	realtimeISRs.c(118): ModDownCtrISR
1	1	2	138	7	realtimeISRs.c(138): TimerOverflow
10	10	36	1	154	realtimeISRs.c
0	0	2	1	5	staticInit.c
9	9	49	52	69	tableLookup.c(52): lookupMainTable
5	5	22	123	31	tableLookup.c(123): lookupTwoDTableUS
1	1	5	157	7	tableLookup.c(157): lookupPagedMainTable
15	15	79	1	163	tableLookup.c
0	0	4	1	267	TimingTables2.c
0	0	4	1	267	TimingTables.c
0	0	4	1	133	TunableConfig2.c
0	0	4	1	133	TunableConfig.c
2	2	8	31	13	utils.c(31): setupPagedRAM
1	1	3	46	14	utils.c(46): resetToNonRunningState
1	1	5	63	10	utils.c(63): adjustPWM
1	1	16	76	21	utils.c(76): sampleEachADC
2	2	7	100	17	utils.c(100): sampleLoopADC
3	3	8	120	5	utils.c(120): sleep
3	3	8	128	5	utils.c(128): sleepMicro
2	2	8	136	9	utils.c(136): checksum
2	2	8	146	11	utils.c(146): stringCopy
17	17	80	1	156	utils.c
0	0	3	1	207	VETables2.c
0	0	3	1	207	VETables.c
0	0	0	1	994	inc/9S12XDP512.h
0	0	21	1	243	inc/commsCore.h
0	0	2	1	72	inc/commsISRs.h
0	0	1	1	43	inc/coreVarsGenerator.h
0	0	1	1	43	inc/derivedVarsGenerator.h
0	0	0	1	41	inc/enginePositionISRs.h
0	0	0	1	78	inc/errorDefines.h
0	0	1	1	43	inc/flashBurn.h
0	0	0	1	39	inc/flashGlobals.h
0	0	3	1	61	inc/flashWrite.h
0	0	76	1	320	inc/freeEMS.h
0	0	1	1	80	inc/fuelAndIgnitionCalcs.h
0	0	60	1	161	inc/globalConstants.h
0	0	0	1	286	inc/globalDefines.h
0	0	0	1	41	inc/ignitionISRs.h
0	0	2	1	75	inc/init.h
0	0	1	1	65	inc/injectionISRs.h
0	0	2	1	90	inc/interrupts.h
0	0	2	1	54	inc/main.h
0	0	0	1	137	inc/memory.h
0	0	0	1	41	inc/miscISRs.h
0	0	0	1	41	inc/realtimeISRs.h
0	0	11	1	391	inc/structs.h
0	0	1	1	55	inc/tableLookup.h
0	0	4	1	115	inc/tunables.h
0	0	1	1	54	inc/utils.h
286	338	1631	n/a	9590	Total
Latest figures. It looks like I have some work to do to bring this back into line :-)

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Post Reply