import * as GIA from '@ntj/gaia';
// 5秒ごとにデバッグ情報を出力
setInterval(() => {
console.log('drawCount:', map.getDrawCount());
console.log('requestCount:', map.getRequestCount());
}, 5_000);
import * as GIA from '@ntj/gaia';
const canvas = document.querySelector('#draw-count-area') as HTMLCanvasElement;
const context = canvas.getContext('2d');
let previousDrawCount = 0;
const recent: number[] = [];
const intervalId = setInterval(() => {
const drawCount = map.getDrawCount();
const diff = drawCount - previousDrawCount;
previousDrawCount = drawCount;
recent.push(diff);
if (recent.length > 90) {
recent.splice(0, recent.length - 90);
}
context?.clearRect(0, 0, 90, 90);
context?.fillRect(0, 0, 90, 90);
if (context) {
context.strokeStyle = 'green';
recent.forEach((count, i) => {
context.beginPath();
context.moveTo(i + 0.5, 90);
context.lineTo(i + 0.5, Math.max(0, 90 - count));
context.stroke();
});
}
}, 1000);
// 破棄時に停止
window.addEventListener('beforeunload', () => clearInterval(intervalId));
import * as GIA from '@ntj/gaia';
let previousRequestCount = 0;
const threshold = 200;
const intervalId = setInterval(() => {
const requestCount = map.getRequestCount();
const diff = requestCount - previousRequestCount;
previousRequestCount = requestCount;
if (diff > threshold) {
console.warn('Request burst detected:', diff);
}
}, 1000);
// 必要に応じて停止
clearInterval(intervalId);
地図のデバッグ用統計情報を取得する — 詳細な使用例
パフォーマンス計測・デバッグ目的で使用する統計情報を取得します。
getDrawCount()getRequestCount()主な用途
注意事項