You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

calcQPS.ts 793B

12345678910111213141516171819202122232425
  1. // QPS를 계산하는 함수
  2. function calculateQPS(N, tRecv, tSend) {
  3. if (tRecv <= tSend) {
  4. throw new Error("Receiving time must be greater than sending time.");
  5. }
  6. const timeDifference = tRecv - tSend; // 시간 차이 계산 (단위: 초)
  7. const QPS = N / timeDifference; // QPS 계산
  8. return QPS;
  9. }
  10. // 예시 데이터 (단위는 초로 가정)
  11. const N = 5000; // 전송된 총 데이터량
  12. const tRecv = 1625140800; // 데이터 수신 시간 (예: UNIX 타임스탬프)
  13. const tSend = 1625140500; // 데이터 송신 시간 (예: UNIX 타임스탬프)
  14. // QPS 계산 및 출력
  15. try {
  16. const QPS = calculateQPS(N, tRecv, tSend);
  17. console.log("Calculated QPS:", QPS);
  18. } catch (error) {
  19. console.error(error.message);
  20. }