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

25
LINES

< > BotCompany Repo | #1018354 // stepAllWithStats_multiThreaded

JavaX fragment (include)

svoid stepAllWithStats_multiThreaded(Steppable s) {
  if (s cast SplittableSteppable) {
    int cores = coresToUse();
    //print("Have SplittableSteppable, cores=" + cores);
    if (cores > 1) {
      MultiThreadStepper stepper = new(s.split(cores));
      //print("Have stepper, n=" + l(stepper.steppables));
      stepAllWithStats_multiThreaded(stepper);
      ret;
    }
  }
  stepAllWithStats(s);
}

svoid stepAllWithStats_multiThreaded(final MultiThreadStepper stepper) {
  long n = 0;
  final new Flag done;
  stepper.onDone(r {
    print(n2(stepper.steps(), "step") + " in " + stepper.elapsedTime + " ms on " + n2(stepper.cores, "core"));
    done.raise();
  });
  //print("Starting stepper");
  stepper.start();
  done.waitUntilUp();
}

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: 361 / 391
Version history: 8 change(s)
Referenced in: [show references]