MCPcopy Create free account
hub / github.com/Facets-cloud/flow / ComputeSavings

Function ComputeSavings

internal/stats/model.go:78–89  ·  view source on GitHub ↗

ComputeSavings applies the counterfactual model. TotalHours sums only the two time-valued levers (automation + context-switch); ContextTokens (tokens) and AddressableCount (a count) are reported separately by design. ContextTokens is NOT computed here — it is derived from real file sizes by BuildSta

(c Constants, n Counts)

Source from the content-addressed store, hash-verified

76// ContextTokens is NOT computed here — it is derived from real file sizes by
77// BuildStats and assigned after this call.
78func ComputeSavings(c Constants, n Counts) Savings {
79 auto := float64(n.AutoRuns+n.OwnerTicks) * c.MinutesPerUnattendedRun / 60.0
80 sw := float64(n.ResumeLookups+n.RefLookups) * c.MinutesPerContextSwitch / 60.0
81 total := auto + sw
82 return Savings{
83 AutomationHours: auto,
84 ContextSwitchHours: sw,
85 AddressableCount: n.CrossLookups + n.RefLookups,
86 TotalHours: total,
87 TotalDollars: total * c.DollarPerHour,
88 }
89}

Callers 2

TestComputeSavingsFunction · 0.85
BuildStatsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestComputeSavingsFunction · 0.68