1 | static int burnCPUForNSeconds_dummy; |
2 | |
3 | // returns some sort of speed measure |
4 | static int burnCPUForNSeconds(double seconds) { |
5 | int n = 1, iterations = 0; |
6 | long endTime = sysTimeInNSeconds(seconds); |
7 | while (licensed() && sysNow() < endTime) { |
8 | ++iterations; |
9 | repeat 100000 { n += n*2; } |
10 | } |
11 | burnCPUForNSeconds_dummy = n; |
12 | ret iround(iterations/seconds); |
13 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1018524 |
Snippet name: | burnCPUForNSeconds |
Eternal ID of this version: | #1018524/6 |
Text MD5: | 498f375ad75766870f6d09b0ec0bec72 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-01-03 17:03:48 |
Source code size: | 376 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 291 / 367 |
Version history: | 5 change(s) |
Referenced in: | [show references] |