Added beter metrics for compression mechanism
This commit is contained in:
parent
bc8a62666b
commit
3545a5f73b
2 changed files with 86 additions and 59 deletions
19
main.go
19
main.go
|
@ -260,18 +260,14 @@ func PackageAndUploadProcess() {
|
|||
log.Fatalf("Error: no valid build or upload path provided.")
|
||||
}
|
||||
|
||||
// // This is stupid, it wait for the path to exist (up to a maximum wait time)
|
||||
// err := waitForPath(pathToUse, 60, 5) // Max 60 seconds, checking every 5 seconds
|
||||
// if err != nil {
|
||||
// log.Fatalf("Error: Build path or upload path not found: %v", err)
|
||||
// }
|
||||
|
||||
// Calculate and display uncompressed size
|
||||
uncompressedSize, err := spitfire.GetDirectorySize(pathToUse)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to calculate uncompressed size: %v", err)
|
||||
}
|
||||
fmt.Printf("Uncompressed directory size: %d bytes\n", uncompressedSize)
|
||||
fmt.Printf("Uncompressed directory size: %s\n", spitfire.BytesToHumanReadable(uncompressedSize))
|
||||
|
||||
// Compress the build directory
|
||||
outputCompressedFile := filepath.Join(".", fmt.Sprintf("%s-%s-%s-%s.tar.gz", component, arch, release, platform))
|
||||
if compress {
|
||||
err := spitfire.CompressDirectory(pathToUse, outputCompressedFile)
|
||||
|
@ -281,12 +277,19 @@ func PackageAndUploadProcess() {
|
|||
fmt.Printf("Build directory compressed to: %s\n", outputCompressedFile)
|
||||
}
|
||||
|
||||
// Calculate and display compressed size
|
||||
compressedSize, err := spitfire.GetFileSize(outputCompressedFile)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to get compressed file size: %v", err)
|
||||
}
|
||||
fmt.Printf("Compressed file size: %d bytes\n", compressedSize)
|
||||
fmt.Printf("Compressed file size: %s\n", spitfire.BytesToHumanReadable(compressedSize))
|
||||
|
||||
// Calculate and display compression efficiency
|
||||
compressionRatio, efficiency := spitfire.CalculateCompressionEfficiency(uncompressedSize, compressedSize)
|
||||
fmt.Printf("Compression ratio: %.2f:1\n", compressionRatio)
|
||||
fmt.Printf("Compression efficiency: %.2f%%\n", efficiency)
|
||||
|
||||
// Handle uploading
|
||||
if upload {
|
||||
config, err := spitfire.LoadConfig()
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue