Skip to content
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

fix: Incorrect batch status Throughput entry #4758

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

jiuker
Copy link
Contributor

@jiuker jiuker commented Nov 13, 2023

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

  • Bug fix (non-breaking change which fixes an issue) Incorrect batch status Throughput entry #4756
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

@jiuker jiuker changed the title fix https://github.com/minio/mc/issues/4756 fix: Incorrect batch status Throughput entry Nov 13, 2023
cmd/batch-status.go Outdated Show resolved Hide resolved
@jiuker
Copy link
Contributor Author

jiuker commented Nov 13, 2023

	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

@jiuker jiuker linked an issue Nov 13, 2023 that may be closed by this pull request
Copy link
Member

@vadmeste vadmeste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@harshavardhana harshavardhana merged commit c3ebf16 into minio:master Nov 13, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect batch status Throughput entry
3 participants