Esempio n. 1
0
func (scenario *Scenario) AggregateStatistics() map[string][]byte {
	results := make(map[string][]byte)
	globalScorecard := s.NewScorecard(-1, scenario.TargetSchedule.Duration)

	// get scoreboard for each target
	for elem := scenario.TargetManager.Targets.Front(); elem != nil; elem = elem.Next() {
		target := elem.Value.(*Target)
		scoreboard := target.Scoreboard
		scorecard := scoreboard.Scorecard
		globalScorecard.Merge(scorecard)

		stats, err := json.Marshal(scoreboard.GetScorboardStatistics())
		if err == nil {
			description := "target" + strconv.Itoa(target.TargetId)
			results[description] = stats
		}
	}

	// get global scoreboard for all targets
	stats, err := json.Marshal(globalScorecard.GetScorecardStatistics(
		scenario.TargetSchedule.Duration))
	if err == nil {
		description := "summary"
		results[description] = stats
	}

	return results
}
Esempio n. 2
0
func NewScoreboard(targetId, channelSize int, timing *Timing) *Scoreboard {
	operationResultChannel := make(chan *s.OperationResult, channelSize)
	waitTimeChannel := make(chan *s.WaitTime, channelSize)
	waitTimeSummaryMap := make(map[string]*s.WaitTimeSummary)
	scorecard := s.NewScorecard(targetId, timing.SteadyStateDuration())
	return &Scoreboard{targetId, timing, 0, waitTimeSummaryMap, scorecard, waitTimeChannel, operationResultChannel}
}