feat(cli): Support displaying storage values in base-2 [#2492] (#2502)

* Update display on repository summary

* Apply throughout app

* Situate units_test

* Update Command Line documentation

* Envar cleanup

* Rename to BytesString

* Restore envar string available for test

* Remove extraneous empty check and restore UIPreferences field for frontend

* PR: config bool cleanup and missed `BaseEnv`s

* Fix lint and test
This commit is contained in:
atom
2022-10-24 20:00:36 -06:00
committed by GitHub
parent 7d47658cbb
commit c5efed01f4
40 changed files with 198 additions and 149 deletions

View File

@@ -62,7 +62,7 @@ func (c *commandBenchmarkCompression) readInputFile(ctx context.Context) ([]byte
if dataLength > defaultCompressedDataByMethod {
dataLength = defaultCompressedDataByMethod
log(ctx).Infof("NOTICE: The provided input file is too big, using first %v.", units.BytesStringBase2(dataLength))
log(ctx).Infof("NOTICE: The provided input file is too big, using first %v.", units.BytesString(dataLength))
}
data := make([]byte, dataLength)
@@ -94,7 +94,7 @@ func (c *commandBenchmarkCompression) run(ctx context.Context) error {
return errors.Errorf("empty data file")
}
log(ctx).Infof("Compressing input file %q (%v) using all compression methods.", c.dataFile, units.BytesStringBase2(int64(len(data))))
log(ctx).Infof("Compressing input file %q (%v) using all compression methods.", c.dataFile, units.BytesString(int64(len(data))))
repeatCount := c.repeat
@@ -106,7 +106,7 @@ func (c *commandBenchmarkCompression) run(ctx context.Context) error {
}
}
log(ctx).Infof("Repeating %v times per compression method (total %v). Override with --repeat=N.", repeatCount, units.BytesStringBase2(int64(repeatCount*len(data))))
log(ctx).Infof("Repeating %v times per compression method (total %v). Override with --repeat=N.", repeatCount, units.BytesString(int64(repeatCount*len(data))))
for name, comp := range compression.ByName {
if compression.IsDeprecated[name] && !c.deprecated {
@@ -211,10 +211,10 @@ func (c *commandBenchmarkCompression) printResults(results []compressionBechmark
c.out.printStdout("%3d. %-26v %-12v %-12v %-8v %v%v",
ndx,
r.compression,
units.BytesStringBase2(r.compressedSize),
units.BytesStringBase2(int64(r.throughput))+"/s",
units.BytesString(r.compressedSize),
units.BytesString(int64(r.throughput))+"/s",
r.allocations,
units.BytesStringBase2(r.allocBytes),
units.BytesString(r.allocBytes),
maybeDeprecated,
)