Improve FpsDebugFrameCallback.getTotalTimeMS accuracy (#46869)

Summary:
`FpsDebugFrameCallback.getTotalTimeMS()` implementation loses accuracy due to incorrect order of type casting to int

## Changelog:

[ANDROID] [CHANGED] - Improve FpsDebugFrameCallback.getTotalTimeMS() accuracy

Pull Request resolved: https://github.com/facebook/react-native/pull/46869

Test Plan:
- Launch some test app
- Open up the [Dev Menu](https://reactnative.dev/docs/debugging#accessing-the-dev-menu) in your app and toggle Show Perf Monitor
- Compare results of current & improved implementations

Reviewed By: rshest

Differential Revision: D64024054

Pulled By: arushikesarwani94

fbshipit-source-id: 438792bace0e3443d151cf13364f6e94b66dfb5e
This commit is contained in:
Anatoliy Magda
2024-10-08 10:49:10 -07:00
committed by Facebook GitHub Bot
parent 19fc1c75d4
commit d54c25fdae
@@ -144,7 +144,7 @@ public class FpsDebugFrameCallback(private val reactContext: ReactContext) :
public fun get4PlusFrameStutters(): Int = fourPlusFrameStutters
public val totalTimeMS: Int
get() = (lastFrameTime.toDouble() - firstFrameTime).toInt() / 1000000
get() = ((lastFrameTime.toDouble() - firstFrameTime) / 1000000.0).toInt()
/**
* Returns the FpsInfo as if stop had been called at the given upToTimeMs. Only valid if