10 lines
261 B
JavaScript
10 lines
261 B
JavaScript
let lastReceivedAt = new Date();
|
|
export let rps = 0;
|
|
export let packageCounts = 0;
|
|
|
|
export const markReceive = () => {
|
|
const now = new Date();
|
|
rps = (1000 / (now.getTime() - lastReceivedAt.getTime())).toFixed(2);
|
|
lastReceivedAt = now;
|
|
packageCounts++;
|
|
} |