Skip to content

Commit

Permalink
Add a overhead commandline flag to set the multiplier for corporate o…
Browse files Browse the repository at this point in the history
…verhead. #281
  • Loading branch information
fschaefer committed Oct 29, 2021
1 parent 57056b4 commit c4747cc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions main.go
Expand Up @@ -108,6 +108,12 @@ func main() {
56286,
"average wage value used for basic COCOMO calculation",
)
flags.Float64Var(
&processor.Overhead,
"overhead",
2.4,
"set the overhead multiplier for corporate overhead (facilities, equipment, accounting, etc.)",
)
flags.BoolVar(
&processor.Cocomo,
"no-cocomo",
Expand Down
4 changes: 2 additions & 2 deletions processor/cocomo.go
Expand Up @@ -27,8 +27,8 @@ var projectType = map[string][]float64{

// EstimateCost calculates the cost in dollars applied using generic COCOMO weighted values based
// on the average yearly wage
func EstimateCost(effortApplied float64, averageWage int64) float64 {
return effortApplied * float64(averageWage/12) * 2.4
func EstimateCost(effortApplied float64, averageWage int64, overhead float64) float64 {
return effortApplied * float64(averageWage/12) * overhead
}

// EstimateEffort calculate the effort applied using generic COCOMO weighted values
Expand Down
4 changes: 2 additions & 2 deletions processor/cocomo_test.go
Expand Up @@ -8,7 +8,7 @@ import (

func TestEstimateCost(t *testing.T) {
eff := EstimateEffort(26)
got := EstimateCost(eff, 56000)
got := EstimateCost(eff, 56000, 2.4)

// Should be around 582
if got < 580 || got > 585 {
Expand All @@ -18,7 +18,7 @@ func TestEstimateCost(t *testing.T) {

func TestEstimateCostManyLines(t *testing.T) {
eff := EstimateEffort(77873)
got := EstimateCost(eff, 56000)
got := EstimateCost(eff, 56000, 2.4)

// Should be around 2602096
if got < 2602000 || got > 2602100 {
Expand Down
4 changes: 2 additions & 2 deletions processor/formatters.go
Expand Up @@ -817,7 +817,7 @@ func fileSummarizeLong(input chan *FileJob) string {

if !Cocomo {
estimatedEffort := EstimateEffort(int64(sumCode))
estimatedCost := EstimateCost(estimatedEffort, AverageWage)
estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)
estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort)
estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths

Expand Down Expand Up @@ -992,7 +992,7 @@ func trimNameShort(summary LanguageSummary, trimmedName string) string {
func calculateCocomo(sumCode int64, str *strings.Builder) {
if !Cocomo {
estimatedEffort := EstimateEffort(int64(sumCode))
estimatedCost := EstimateCost(estimatedEffort, AverageWage)
estimatedCost := EstimateCost(estimatedEffort, AverageWage, Overhead)
estimatedScheduleMonths := EstimateScheduleMonths(estimatedEffort)
estimatedPeopleRequired := estimatedEffort / estimatedScheduleMonths

Expand Down
3 changes: 3 additions & 0 deletions processor/processor.go
Expand Up @@ -145,6 +145,9 @@ var AllowListExtensions = []string{}
// AverageWage is the average wage in dollars used for the COCOMO cost estimate
var AverageWage int64 = 56286

// Overhead is the overhead multiplier for corporate overhead (facilities, equipment, accounting, etc.)
var Overhead float64 = 2.4

// GcFileCount is the number of files to process before turning the GC back on
var GcFileCount = 10000
var gcPercent = -1
Expand Down

0 comments on commit c4747cc

Please sign in to comment.