Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1033685 // RollingFPSCounter - produces a new value every second and averages over 5 seconds [dev.]

JavaX fragment (include)

1  
sclass RollingFPSCounter extends FPSCounter {
2  
  RollingAverage pastSeconds = new(5);
3  
  
4  
  synchronized void inc() {
5  
    if (elapsedSeconds() >= 1)
6  
      FPSCounter
7  
    counter++;
8  
  }
9  
10  
  synchronized double get() {
11  
    ret pastSeconds!;
12  
  }
13  
}

Author comment

Began life as a copy of #1033433

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033685
Snippet name: RollingFPSCounter - produces a new value every second and averages over 5 seconds [dev.]
Eternal ID of this version: #1033685/1
Text MD5: 17fa0602df5a633cdee4e492764a3d7a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-26 22:26:59
Source code size: 253 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 129 / 160
Referenced in: [show references]