Skip to content

Commit 89a752b

Browse files
committed
Add a command line argument for the effort adjustment factor.
1 parent a01003d commit 89a752b

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ func main() {
114114
2.4,
115115
"set the overhead multiplier for corporate overhead (facilities, equipment, accounting, etc.)",
116116
)
117+
flags.Float64Var(
118+
&processor.EAF,
119+
"eaf",
120+
1.0,
121+
"the effort adjustment factor derived from the cost drivers (1.0 if rated nominal)",
122+
)
117123
flags.BoolVar(
118124
&processor.Cocomo,
119125
"no-cocomo",

processor/cocomo.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ func EstimateCost(effortApplied float64, averageWage int64, overhead float64) fl
3232
}
3333

3434
// EstimateEffort calculate the effort applied using generic COCOMO weighted values
35-
func EstimateEffort(sloc int64) float64 {
36-
var eaf float64 = 1
35+
func EstimateEffort(sloc int64, eaf float64) float64 {
3736
var effortApplied = projectType[CocomoProjectType][0] * math.Pow(float64(sloc)/1000, projectType[CocomoProjectType][1]) * eaf
3837
return effortApplied
3938
}

processor/cocomo_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
func TestEstimateCost(t *testing.T) {
10-
eff := EstimateEffort(26)
10+
eff := EstimateEffort(26, 1)
1111
got := EstimateCost(eff, 56000, 2.4)
1212

1313
// Should be around 582
@@ -17,7 +17,7 @@ func TestEstimateCost(t *testing.T) {
1717
}
1818

1919
func TestEstimateCostManyLines(t *testing.T) {
20-
eff := EstimateEffort(77873)
20+
eff := EstimateEffort(77873, 1)
2121
got := EstimateCost(eff, 56000, 2.4)
2222

2323
// Should be around 2602096
@@ -27,7 +27,7 @@ func TestEstimateCostManyLines(t *testing.T) {
2727
}
2828

2929
func TestEstimateScheduleMonths(t *testing.T) {
30-
eff := EstimateEffort(537)
30+
eff := EstimateEffort(537, 1)
3131
got := EstimateScheduleMonths(eff)
3232

3333
// Should be around 2.7

processor/formatters.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ func fileSummarizeLong(input chan *FileJob) string {
816816
str.WriteString(getTabularWideBreak())
817817

818818
if !Cocomo {
819-
estimatedEffort := EstimateEffort(int64(sumCode))
819+
estimatedEffort := EstimateEffort(int64(sumCode), EAF)
820820
estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)
821821
estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort)
822822
estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths
@@ -991,7 +991,7 @@ func trimNameShort(summary LanguageSummary, trimmedName string) string {
991991

992992
func calculateCocomo(sumCode int64, str *strings.Builder) {
993993
if !Cocomo {
994-
estimatedEffort := EstimateEffort(int64(sumCode))
994+
estimatedEffort := EstimateEffort(int64(sumCode), EAF)
995995
estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)
996996
estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort)
997997
estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths

processor/processor.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ var AverageWage int64 = 56286
148148
// Overhead is the overhead multiplier for corporate overhead (facilities, equipment, accounting, etc.)
149149
var Overhead float64 = 2.4
150150

151+
// the effort adjustment factor derived from the cost drivers, i.e. 1.0 if rated nominal
152+
var EAF float64 = 1.0
153+
151154
// GcFileCount is the number of files to process before turning the GC back on
152155
var GcFileCount = 10000
153156
var gcPercent = -1

0 commit comments

Comments
 (0)