From c37f7195675df67d23c3c008ec5ab5fd7b8d0394 Mon Sep 17 00:00:00 2001 From: John Porto Date: Wed, 6 Jul 2022 20:00:15 -0700 Subject: [PATCH] Migrates off getInstrumentedStats' deprecated fields Summary: This diffs replaces uses of the deprecated fields from HermesInternal.getInstrumentedStats() with the ones from Hermes' TimedRuntime. Changelog: [General][Added] - JSITimerInternal descriptor Reviewed By: rubennorte Differential Revision: D36625701 fbshipit-source-id: fbdb554e5cfb0b3556fcbe01f9e2930ace66a619 --- flow/JSITimerInternalType.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 flow/JSITimerInternalType.js diff --git a/flow/JSITimerInternalType.js b/flow/JSITimerInternalType.js new file mode 100644 index 00000000000000..d6ace6a943749e --- /dev/null +++ b/flow/JSITimerInternalType.js @@ -0,0 +1,30 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +// Declarations for functionality exposed by Hermes' TimerStats decorator. +// +// For backwards-compatibility, code that uses such functionality must also +// check explicitly at run-time whether the object(s) and method(s) exist, and +// fail safely if not. + +/** + * JSITimerInternalType is the global object installed by Hermes' TimedRuntime + * decorator, and it is used to extract runtime timing information. + */ +declare type $JSITimerInternalType = { + /** + * Returns the counters that TimedRuntime keep track. + * There are no guarantees about what keys exist in it, but they can be + * printed for informational purposes. + * @return An object that maps strings to various types of performance + * statistics. + */ + +getTimes?: () => {[string]: number | string, ...}, +};