254 lines
8.3 KiB
React
254 lines
8.3 KiB
React
// Metro module 1772 (f1773).
|
|
import { useRef, useEffect } from "react";
|
|
import * as _Module17 from "react-native";
|
|
import { View } from "react-native";
|
|
import { addWhitelistedNativeProps } from "./configureProps";
|
|
import { createAnimatedComponent } from "./Module1640";
|
|
import { useSharedValue, useAnimatedProps, useFrameCallback } from "./Module1749";
|
|
function $mk102654() {
|
|
return function push(a0) {
|
|
const r9 = this.buffer[this.next];
|
|
const count = this.count;
|
|
this.buffer[this.next] = a0;
|
|
this.next = (this.next + 1) % this.size;
|
|
this.count = Math.min(this.size, this.count + 1);
|
|
return count === this.size ? r9 : null;
|
|
};
|
|
}
|
|
function $mk102655() {
|
|
return function front() {
|
|
if (this.count > 0) {
|
|
let r0 = this.next - 1;
|
|
if (r0 < 0) {
|
|
r0 = this.size - 1;
|
|
}
|
|
return this.buffer[r0];
|
|
}
|
|
return null;
|
|
};
|
|
}
|
|
function $mk102656() {
|
|
return function back() {
|
|
return this.count > 0 ? this.buffer[this.next] : null;
|
|
};
|
|
}
|
|
function $mk117694($env) {
|
|
return (a0) => {
|
|
const r4 = $env;
|
|
if (r4[0] > 0) {
|
|
const r13 = $env.$parent;
|
|
const r11 = Math.round(a0);
|
|
const current = r13[1].current;
|
|
const r20 = Math.round(r11);
|
|
let r22 = current.push(r20);
|
|
if (r22 == null) {
|
|
r22 = r20;
|
|
}
|
|
r13[0].value = (2 * (1000 / ((r20 - r22) / current.count))).toFixed(0);
|
|
}
|
|
r4[0] = a0;
|
|
requestAnimationFrame(r4[1]);
|
|
};
|
|
}
|
|
let UiPerformance, createCircularDoublesBuffer, Component, getFps, completeBufferRoutine, c1498_11, c1498_13, c1498_14, styles;
|
|
let env1498 = {};
|
|
const JsPerformance = function JsPerformance(props) {
|
|
let env13217 = {
|
|
$parent: env1498
|
|
};
|
|
const smoothingFrames2 = props.smoothingFrames;
|
|
env13217[0] = void 0;
|
|
env13217[1] = void 0;
|
|
const sharedValue3 = useSharedValue(null);
|
|
env13217[0] = sharedValue3;
|
|
const sharedValue4 = useSharedValue(0);
|
|
env13217[1] = useRef({
|
|
next: 0,
|
|
buffer: new Float32Array(smoothingFrames2),
|
|
size: smoothingFrames2,
|
|
count: 0,
|
|
push: $mk102654(),
|
|
front: $mk102655(),
|
|
back: $mk102656()
|
|
});
|
|
(0, useEffect)(() => {
|
|
let env24675;
|
|
const r2 = env24675 = {
|
|
$parent: env13217
|
|
};
|
|
env24675[0] = 0;
|
|
env24675[1] = function loop() {
|
|
requestAnimationFrame($mk117694(env24675));
|
|
};
|
|
requestAnimationFrame($mk117694(r2));
|
|
}, [sharedValue3, sharedValue4]);
|
|
const f = function f() {
|
|
let value = env13217[0].value;
|
|
if (value == null) {
|
|
value = "N/A";
|
|
}
|
|
const text = "JS: " + value + " ";
|
|
return {
|
|
text,
|
|
defaultValue: text
|
|
};
|
|
};
|
|
f.__closure = {
|
|
jsFps: sharedValue3
|
|
};
|
|
f.__workletHash = 12993491204154;
|
|
f.__initData = c1498_11;
|
|
const animatedProps = useAnimatedProps(f);
|
|
return <View style={styles.container}>
|
|
<Component style={styles.text} animatedProps={animatedProps} editable={false} />
|
|
</View>;
|
|
};
|
|
UiPerformance = function UiPerformance(props) {
|
|
const smoothingFrames = props.smoothingFrames;
|
|
const sharedValue = useSharedValue(null);
|
|
const sharedValue2 = useSharedValue(null);
|
|
const n = function n({ timestamp }) {
|
|
if (sharedValue2.value === null) {
|
|
sharedValue2.value = {
|
|
next: 0,
|
|
buffer: new Float32Array(smoothingFrames),
|
|
size: smoothingFrames,
|
|
count: 0,
|
|
push: $mk102654(),
|
|
front: $mk102655(),
|
|
back: $mk102656()
|
|
};
|
|
}
|
|
const r28 = Math.round(timestamp);
|
|
const value = sharedValue2.value;
|
|
const r36 = Math.round(r28);
|
|
let r38 = value.push(r36);
|
|
if (r38 == null) {
|
|
r38 = r36;
|
|
}
|
|
sharedValue.value = (1000 / ((r36 - r38) / value.count)).toFixed(0);
|
|
};
|
|
n.__closure = {
|
|
circularBuffer: sharedValue2,
|
|
createCircularDoublesBuffer,
|
|
smoothingFrames,
|
|
completeBufferRoutine,
|
|
uiFps: sharedValue
|
|
};
|
|
n.__workletHash = 10137562113926;
|
|
n.__initData = c1498_13;
|
|
useFrameCallback(n);
|
|
const r29 = function() {
|
|
let value = sharedValue.value;
|
|
if (value == null) {
|
|
value = "N/A";
|
|
}
|
|
const text = "UI: " + value + " ";
|
|
return {
|
|
text,
|
|
defaultValue: text
|
|
};
|
|
};
|
|
r29.__closure = {
|
|
uiFps: sharedValue
|
|
};
|
|
r29.__workletHash = 1865752198941;
|
|
r29.__initData = c1498_14;
|
|
const animatedProps = useAnimatedProps(r29);
|
|
return <View style={styles.container}>
|
|
<Component style={styles.text} animatedProps={animatedProps} editable={false} />
|
|
</View>;
|
|
};
|
|
const { StyleSheet, TextInput } = _Module17;
|
|
const createCircularDoublesBuffer2 = function createCircularDoublesBuffer(a0) {
|
|
return {
|
|
next: 0,
|
|
buffer: new Float32Array(a0),
|
|
size: a0,
|
|
count: 0,
|
|
push: $mk102654(),
|
|
front: $mk102655(),
|
|
back: $mk102656()
|
|
};
|
|
};
|
|
createCircularDoublesBuffer2.__closure = {};
|
|
createCircularDoublesBuffer2.__workletHash = 7814494919003;
|
|
createCircularDoublesBuffer2.__initData = {
|
|
code: "function createCircularDoublesBuffer_Pnpm_PerformanceMonitorTsx1(size){return{next:0,buffer:new Float32Array(size),size:size,count:0,push:function(value){const oldValue=this.buffer[this.next];const oldCount=this.count;this.buffer[this.next]=value;this.next=(this.next+1)%this.size;this.count=Math.min(this.size,this.count+1);return oldCount===this.size?oldValue:null;},front:function(){const notEmpty=this.count>0;if(notEmpty){const current=this.next-1;const index=current<0?this.size-1:current;return this.buffer[index];}return null;},back:function(){const notEmpty=this.count>0;return notEmpty?this.buffer[this.next]:null;}};}"
|
|
};
|
|
createCircularDoublesBuffer = createCircularDoublesBuffer2;
|
|
addWhitelistedNativeProps({
|
|
text: true
|
|
});
|
|
Component = createAnimatedComponent(TextInput);
|
|
const getFps2 = function getFps(a0) {
|
|
return 1000 / a0;
|
|
};
|
|
getFps2.__closure = {};
|
|
getFps2.__workletHash = 14651351045012;
|
|
getFps2.__initData = {
|
|
code: "function getFps_Pnpm_PerformanceMonitorTsx2(renderTimeInMs){return 1000/renderTimeInMs;}"
|
|
};
|
|
getFps = getFps2;
|
|
const completeBufferRoutine2 = function completeBufferRoutine(a0, a1) {
|
|
const r8 = Math.round(a1);
|
|
let r10 = a0.push(r8);
|
|
if (r10 == null) {
|
|
r10 = r8;
|
|
}
|
|
return 1000 / ((r8 - r10) / a0.count);
|
|
};
|
|
completeBufferRoutine2.__closure = {
|
|
getFps: getFps2
|
|
};
|
|
completeBufferRoutine2.__workletHash = 5653450315763;
|
|
completeBufferRoutine2.__initData = {
|
|
code: "function completeBufferRoutine_Pnpm_PerformanceMonitorTsx3(buffer,timestamp){const{getFps}=this.__closure;var _buffer$push;timestamp=Math.round(timestamp);const droppedTimestamp=(_buffer$push=buffer.push(timestamp))!==null&&_buffer$push!==void 0?_buffer$push:timestamp;const measuredRangeDuration=timestamp-droppedTimestamp;return getFps(measuredRangeDuration/buffer.count);}"
|
|
};
|
|
completeBufferRoutine = completeBufferRoutine2;
|
|
c1498_11 = {
|
|
code: "function pnpm_PerformanceMonitorTsx4(){const{jsFps}=this.__closure;var _jsFps$value;const text='JS: '+((_jsFps$value=jsFps.value)!==null&&_jsFps$value!==void 0?_jsFps$value:'N/A')+' ';return{text:text,defaultValue:text};}"
|
|
};
|
|
c1498_13 = {
|
|
code: "function pnpm_PerformanceMonitorTsx5({timestamp:timestamp}){const{circularBuffer,createCircularDoublesBuffer,smoothingFrames,completeBufferRoutine,uiFps}=this.__closure;if(circularBuffer.value===null){circularBuffer.value=createCircularDoublesBuffer(smoothingFrames);}timestamp=Math.round(timestamp);const currentFps=completeBufferRoutine(circularBuffer.value,timestamp);uiFps.value=currentFps.toFixed(0);}"
|
|
};
|
|
c1498_14 = {
|
|
code: "function pnpm_PerformanceMonitorTsx6(){const{uiFps}=this.__closure;var _uiFps$value;const text='UI: '+((_uiFps$value=uiFps.value)!==null&&_uiFps$value!==void 0?_uiFps$value:'N/A')+' ';return{text:text,defaultValue:text};}"
|
|
};
|
|
styles = StyleSheet.create({
|
|
monitor: {
|
|
flexDirection: "row",
|
|
position: "absolute",
|
|
backgroundColor: "#0006",
|
|
zIndex: 1000
|
|
},
|
|
header: {
|
|
fontSize: 14,
|
|
color: "#ffff",
|
|
paddingHorizontal: 5
|
|
},
|
|
text: {
|
|
fontSize: 13,
|
|
fontVariant: ["tabular-nums"],
|
|
color: "#ffff",
|
|
fontFamily: "monospace",
|
|
paddingHorizontal: 3
|
|
},
|
|
container: {
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
flexDirection: "row",
|
|
flexWrap: "wrap"
|
|
}
|
|
});
|
|
export function PerformanceMonitor(props) {
|
|
let smoothingFrames2 = props.smoothingFrames;
|
|
if (smoothingFrames2 === void 0) {
|
|
smoothingFrames2 = 20;
|
|
}
|
|
return <View style={styles.monitor}>
|
|
<JsPerformance smoothingFrames={smoothingFrames2} />
|
|
<UiPerformance smoothingFrames={smoothingFrames2} />
|
|
</View>;
|
|
}
|