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

25
LINES

< > BotCompany Repo | #1018354 // stepAllWithStats_multiThreaded

JavaX fragment (include)

1  
svoid stepAllWithStats_multiThreaded(Steppable s) {
2  
  if (s cast SplittableSteppable) {
3  
    int cores = coresToUse();
4  
    //print("Have SplittableSteppable, cores=" + cores);
5  
    if (cores > 1) {
6  
      MultiThreadStepper stepper = new(s.split(cores));
7  
      //print("Have stepper, n=" + l(stepper.steppables));
8  
      stepAllWithStats_multiThreaded(stepper);
9  
      ret;
10  
    }
11  
  }
12  
  stepAllWithStats(s);
13  
}
14  
15  
svoid stepAllWithStats_multiThreaded(final MultiThreadStepper stepper) {
16  
  long n = 0;
17  
  final new Flag done;
18  
  stepper.onDone(r {
19  
    print(n2(stepper.steps(), "step") + " in " + stepper.elapsedTime + " ms on " + n2(stepper.cores, "core"));
20  
    done.raise();
21  
  });
22  
  //print("Starting stepper");
23  
  stepper.start();
24  
  done.waitUntilUp();
25  
}

Author comment

Began life as a copy of #1018351

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018354
Snippet name: stepAllWithStats_multiThreaded
Eternal ID of this version: #1018354/9
Text MD5: 92fbddc7a475ab50b3b2e6ac7138430d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-20 06:42:17
Source code size: 768 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 363 / 393
Version history: 8 change(s)
Referenced in: [show references]