minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.86k stars 548 forks source link

fix: Incorrect batch status Throughput entry #4758

Closed jiuker closed 11 months ago

jiuker commented 11 months ago

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers under the terms of the [Apache 2 license] (https://www.apache.org/licenses/LICENSE-2.0). By creating this pull request I represent that I have the right to license the contributions to the project maintainers under the Apache 2 license.

Description

    start, _ := time.Parse(time.RFC3339Nano, "2023-11-12T17:58:58.001226911Z")

    end, _ := time.Parse(time.RFC3339Nano, "2023-11-13T08:52:39.490707688Z")

    accElapsedTime := end.Sub(start)

    BytesTransferred := int64(40891298634197)

    bytesTransferredPerSec := float64(int64(time.Second)*BytesTransferred) / float64(accElapsedTime)
        // check if overflow int64
    fmt.Println(BytesTransferred)
       // show the result
    fmt.Println(bytesTransferredPerSec)
      // show the pr's result
    bytesTransferredPerSec = float64(BytesTransferred) / float64(accElapsedTime) * float64(time.Second)
    fmt.Println(bytesTransferredPerSec)
    fmt.Println(float64(BytesTransferred) / accElapsedTime.Seconds())
40891298634197
-95726.12150052408
7.625916219439652e+08
7.625916219439652e+08

Motivation and Context

How to test this PR?

Types of changes

Checklist:

jiuker commented 11 months ago
    start, _ := time.Parse(time.RFC3339Nano, "2023-11-12T17:58:58.001226911Z")
    end, _ := time.Parse(time.RFC3339Nano, "2023-11-13T08:52:39.490707688Z")
    accElapsedTime := end.Sub(start)
    BytesTransferred := int64(40891298634197)

    bytesTransferredPerSec :=float64(BytesTransferred) / accElapsedTime.Seconds()
    fmt.Println(bytesTransferredPerSec)
    fmt.Println(humanize.IBytes(uint64(bytesTransferredPerSec)))
    return
7.625916219439652e+08
727 MiB

@harshavardhana