-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Percentile support #86
Closed
Closed
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e165ab9
Add Percentile support
zhiburt 2cb7be8
Merge scenarius when doing p(95)
zhiburt da6968d
Merge branch 'master' of github.com:ddosify/ddosify into patch-percen…
zhiburt 97cbdd4
Report percentile only on report stage + add CLI flags
zhiburt 6a39bcd
Fix ordering of percentiles in stdout
zhiburt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,12 +54,13 @@ type stdout struct { | |
var blue = color.New(color.FgHiBlue).SprintFunc() | ||
var green = color.New(color.FgHiGreen).SprintFunc() | ||
var red = color.New(color.FgHiRed).SprintFunc() | ||
var cyan = color.New(color.FgHiCyan).SprintFunc() | ||
var realTimePrintInterval = time.Duration(1500) * time.Millisecond | ||
|
||
func (s *stdout) Init() (err error) { | ||
s.doneChan = make(chan struct{}) | ||
s.result = &Result{ | ||
ItemReports: make(map[int16]*ScenarioItemReport), | ||
ItemReports: make(map[int16]*ScenarioResult), | ||
} | ||
|
||
color.Cyan("%s Initializing... \n", emoji.Gear) | ||
|
@@ -107,12 +108,14 @@ func (s *stdout) realTimePrintStart() { | |
} | ||
|
||
func (s *stdout) liveResultPrint() { | ||
fmt.Fprintf(out, "%s %s %s\n", | ||
green(fmt.Sprintf("%s Successful Run: %-6d %3d%% %5s", | ||
emoji.CheckMark, s.result.SuccessCount, s.result.successPercentage(), "")), | ||
red(fmt.Sprintf("%s Failed Run: %-6d %3d%% %5s", | ||
emoji.CrossMark, s.result.FailedCount, s.result.failedPercentage(), "")), | ||
blue(fmt.Sprintf("%s Avg. Duration: %.5fs", emoji.Stopwatch, s.result.AvgDuration))) | ||
p := s.result.DurationPercentile(95) | ||
|
||
fmt.Fprintf(out, "%s %s %s %s\n", | ||
green(fmt.Sprintf("%s Successful Run: %-6d %3d%% %5s", emoji.CheckMark, s.result.SuccessCount, s.result.successPercentage(), "")), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The max. line-length is limited to 120 chars as stated in the linter settings (at .golangci.yml). Let's follow the standards. |
||
red(fmt.Sprintf("%s Failed Run: %-6d %3d%% %5s", emoji.CrossMark, s.result.FailedCount, s.result.failedPercentage(), "")), | ||
blue(fmt.Sprintf("%s Avg. Duration: %.5fs", emoji.Stopwatch, s.result.AvgDuration)), | ||
cyan(fmt.Sprintf("%s p(95): %.5fs", emoji.HourglassNotDone, p)), | ||
) | ||
} | ||
|
||
func (s *stdout) realTimePrintStop() { | ||
|
@@ -145,7 +148,7 @@ func (s *stdout) printDetails() { | |
sort.Ints(keys) | ||
|
||
for _, k := range keys { | ||
v := s.result.ItemReports[int16(k)] | ||
v := s.result.ItemReports[int16(k)].Report | ||
|
||
if len(keys) > 1 { | ||
stepHeader := v.Name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this extra loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add below code snippet at line 57 or anywhere in that
else
statementI think the aggregator should store durations only if the percentage report is enabled.