43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
// Metro module 12876 (f12877).
|
|
import { Histogram } from "./Histogram";
|
|
import { BaseConnectionEvent } from "../_bundle/Module4286";
|
|
import Module12 from "../_bundle/Module12";
|
|
class SystemResponsiveness {
|
|
sampleStats = (a0) => {
|
|
if (a0 != null) {
|
|
Module12.forEach(a0.rtp.outbound, (a0) => {
|
|
if (a0.type === "audio") {
|
|
let pttQueueLatencyMicrosSamples = a0.pttQueueLatencyMicrosSamples;
|
|
if (pttQueueLatencyMicrosSamples == null) {
|
|
pttQueueLatencyMicrosSamples = [];
|
|
}
|
|
for (const item of pttQueueLatencyMicrosSamples) {
|
|
this.pttQueueLatencyHistogram.addSample(item / 1000);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
};
|
|
constructor(a0) {
|
|
this.connection = a0;
|
|
this.pttQueueLatencyHistogram = new Histogram();
|
|
}
|
|
start() {
|
|
this.connection.on(BaseConnectionEvent.Stats, this.sampleStats);
|
|
}
|
|
stop() {
|
|
this.connection.off(BaseConnectionEvent.Stats, this.sampleStats);
|
|
}
|
|
getPttQueueLatencyStats() {
|
|
const report = this.pttQueueLatencyHistogram.getReport([50, 95]);
|
|
return {
|
|
ptt_queue_latency_max: report.max,
|
|
ptt_queue_latency_mean: report.mean,
|
|
ptt_queue_latency_p50: report.percentiles[50],
|
|
ptt_queue_latency_p95: report.percentiles[95],
|
|
ptt_queue_latency_samples: report.samples
|
|
};
|
|
}
|
|
}
|
|
export default SystemResponsiveness;
|