Skip to content

Commit

Permalink
Merge pull request #1921 from wowsims/fixes
Browse files Browse the repository at this point in the history
Fix bug where duration used for computing metrics was slightly too short
  • Loading branch information
jimmyt857 authored Nov 25, 2022
2 parents 15f111a + ffb4abf commit 6a175a1
Show file tree
Hide file tree
Showing 31 changed files with 920 additions and 912 deletions.
8 changes: 4 additions & 4 deletions sim/core/raid.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ func (party *Party) doneIteration(sim *Simulation) {
party.hpsMetrics.Total += agent.GetCharacter().Metrics.hps.Total
}

party.dpsMetrics.doneIteration(sim.rand.GetSeed(), sim.CurrentTime.Seconds())
party.hpsMetrics.doneIteration(sim.rand.GetSeed(), sim.CurrentTime.Seconds())
party.dpsMetrics.doneIteration(sim.rand.GetSeed(), sim.Duration.Seconds())
party.hpsMetrics.doneIteration(sim.rand.GetSeed(), sim.Duration.Seconds())
}

func (party *Party) GetMetrics(numIterations int32) *proto.PartyMetrics {
Expand Down Expand Up @@ -405,8 +405,8 @@ func (raid *Raid) doneIteration(sim *Simulation) {
raid.hpsMetrics.Total += party.hpsMetrics.Total
}

raid.dpsMetrics.doneIteration(sim.rand.GetSeed(), sim.CurrentTime.Seconds())
raid.hpsMetrics.doneIteration(sim.rand.GetSeed(), sim.CurrentTime.Seconds())
raid.dpsMetrics.doneIteration(sim.rand.GetSeed(), sim.Duration.Seconds())
raid.hpsMetrics.doneIteration(sim.rand.GetSeed(), sim.Duration.Seconds())
}

func (raid *Raid) GetMetrics(numIterations int32) *proto.RaidMetrics {
Expand Down
10 changes: 8 additions & 2 deletions sim/core/sim.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ func (sim *Simulation) runOnce() {
pa.OnAction(sim)
}

// The last event loop will leave CurrentTime at some value close to but not
// quite at the Duration. Explicitly set this so that accesses to CurrentTime
// during the doneIteration phase will return the Duration value, which is
// intuitive.
sim.CurrentTime = sim.Duration

for _, pa := range sim.pendingActions {
if pa.CleanUp != nil {
pa.CleanUp(sim)
Expand All @@ -360,10 +366,10 @@ func (sim *Simulation) runOnce() {
sim.Encounter.doneIteration(sim)

for _, unit := range sim.Raid.AllUnits {
unit.Metrics.doneIteration(unit, sim.rand.GetSeed(), sim.CurrentTime.Seconds())
unit.Metrics.doneIteration(unit, sim.rand.GetSeed(), sim.Duration.Seconds())
}
for _, target := range sim.Encounter.Targets {
target.Metrics.doneIteration(&target.Unit, sim.rand.GetSeed(), sim.CurrentTime.Seconds())
target.Metrics.doneIteration(&target.Unit, sim.rand.GetSeed(), sim.Duration.Seconds())
}
}

Expand Down
4 changes: 2 additions & 2 deletions sim/deathknight/dps/TestFrost.results
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ dps_results: {
dps_results: {
key: "TestFrost-Average-Default"
value: {
dps: 7935.52774
tps: 4691.1326
dps: 7928.30373
tps: 4686.86215
}
}
dps_results: {
Expand Down
6 changes: 3 additions & 3 deletions sim/deathknight/dps/TestUnholy.results
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,9 @@ dps_results: {
dps_results: {
key: "TestUnholy-Average-Default"
value: {
dps: 8157.02672
tps: 5095.55902
hps: 273.24719
dps: 8153.96429
tps: 5093.64555
hps: 273.14462
}
}
dps_results: {
Expand Down
Loading

0 comments on commit 6a175a1

Please sign in to comment.