Commit d3d94886 by ken

试试看吧

parent 9465a4fd
...@@ -4,6 +4,7 @@ let total = 0; ...@@ -4,6 +4,7 @@ let total = 0;
let total2 = 0; let total2 = 0;
let time = 0; let time = 0;
let lastData = null; let lastData = null;
let lastTimestamp = 0;
setInterval(()=>{ setInterval(()=>{
run(); run();
...@@ -22,10 +23,11 @@ function run() { ...@@ -22,10 +23,11 @@ function run() {
total2 += ((after - before) - total / time) * ((after - before) - total / time); total2 += ((after - before) - total / time) * ((after - before) - total / time);
// console.log('平均值:' + (total / time) + ' 标准差:' + Math.sqrt(total2 / time)); // console.log('平均值:' + (total / time) + ' 标准差:' + Math.sqrt(total2 / time));
// console.log(data); // console.log(data);
if (lastData) { if (lastData && data.timeStamp > lastTimestamp) {
if (JSON.stringify(lastData) != JSON.stringify(data)) { if (JSON.stringify(lastData) != JSON.stringify(data)) {
console.log("diff@" + data.timestamp) console.log("diff@" + data.timestamp)
} }
lastTimestamp = data.timeStamp;
} }
lastData = data; lastData = data;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment