-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: add encoded histogram export #84
Conversation
@@ -25,6 +25,7 @@ enum OutputFormat: String, ExpressibleByArgument, CaseIterable { | |||
case percentiles | |||
case tsv | |||
case jmh | |||
case encodedHistogram |
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.
added this for completeness sake
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #84 +/- ##
=======================================
Coverage 81.48% 81.48%
=======================================
Files 19 19
Lines 2209 2209
=======================================
Hits 1800 1800
Misses 409 409
Continue to review full report at Codecov.
|
@@ -88,6 +88,56 @@ extension BenchmarkTool { | |||
} | |||
} | |||
|
|||
/// Writes raw data into a file. |
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.
Without Foundation, which wasn't imported, there wasn't a super convenient way to transform an array of [UInt8]
into String
, so I made a variant of the write
function that accepted [UInt8]
and wrote the raw data into the file.
If there's a better/preferred way of tackling this, I'd be happy to do so.
@@ -27,13 +27,19 @@ enum Grouping: String, ExpressibleByArgument { | |||
case benchmark | |||
} | |||
|
|||
/// The benchmark data output format. |
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.
I added DocC comments to this OutputFormat enum, which otherwise seemed to be replicated in 3 places. I'm not sure where would be most appropriate, or if DocC additions make any notable difference here.
@@ -126,10 +132,10 @@ struct BenchmarkTool: AsyncParsableCommand { | |||
} | |||
|
|||
func shouldRunBenchmark(_ name: String) throws -> Bool { |
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.
These changes flowed into place when I ran swiftformat .
using the configuration within the repo. I presumed that was desired when submitting code changes. If not, I can back these out.
@@ -47,10 +47,10 @@ public struct BenchmarkRunner: AsyncParsableCommand, BenchmarkRunnerReadWrite { | |||
var debug = false | |||
|
|||
func shouldRunBenchmark(_ name: String) throws -> Bool { |
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.
These changes flowed into place when I ran swiftformat .
using the configuration within the repo. I presumed that was desired when submitting code changes. If not, I can back these out.
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.
LGTM, thanks for the contribution! 🎉
Description
A work-around solution to #82, adding a feature to export the underlying histograms using their codable conformance. The preferred longer term solution requires additional features/capabilities on package-histogram to support cross-platform encoding and decoding of the raw histogram data.
This encoded histogram does not include the units of measurement selected for the various benchmarks.
How Has This Been Tested?
swift test
within a linux container (Swift:5.7
)swift package --allow-writing-to-package-directory benchmark --format encodedHistogram
from the main branch within a Linux container, and on macOS desktop.Minimal checklist:
DocC
code-level documentation for any public interfaces exported by the package