@nsshunt/ststestrunner 1.1.76 → 1.1.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,6 +31,7 @@ var TestCaseFhirBase = class {
31
31
  #resetSocketClientTrigger = 50;
32
32
  #clientSocketFetchCount = 0;
33
33
  #authAgentManager;
34
+ runnerDurationList = [];
34
35
  _authMaxTimeout = 5e3;
35
36
  accessTokenTime = performance.now();
36
37
  newTokenLimitTime = 30;
@@ -221,13 +222,27 @@ var TestCaseFhirBase = class {
221
222
  process.nextTick(resolve);
222
223
  });
223
224
  }
225
+ #CalculatePercentile = () => {
226
+ this.runnerDurationList.sort((a, b) => a - b);
227
+ const size = this.runnerDurationList.length;
228
+ const _GetP = (factor) => {
229
+ const pos = Math.floor(size * factor);
230
+ if (pos >= 0 && pos < size) return this.runnerDurationList[pos];
231
+ else return -1;
232
+ };
233
+ this.#runner.instrumentData.perc["50"] = _GetP(.5);
234
+ this.#runner.instrumentData.perc["80"] = _GetP(.8);
235
+ this.#runner.instrumentData.perc["90"] = _GetP(.9);
236
+ this.#runner.instrumentData.perc["95"] = _GetP(.95);
237
+ this.#runner.instrumentData.perc["98"] = _GetP(.98);
238
+ };
224
239
  #PublishTelemetryData = async () => {
240
+ this.#CalculatePercentile();
225
241
  this.#runnerExecutionWorker.PostTelemetryById(this.#runner.id);
226
242
  this.#runner.instrumentData.velocity = 0;
227
243
  this.#runner.instrumentData.message = [];
228
244
  this.#runner.instrumentData.tx = 0;
229
245
  this.#runner.instrumentData.rx = 0;
230
- this.#runner.instrumentData.durationData = [];
231
246
  await this.SleepImmediate();
232
247
  };
233
248
  ExtractOrigin = (uri) => {
@@ -460,6 +475,7 @@ var TestCaseFhirBase = class {
460
475
  };
461
476
  StartRunner = async () => {
462
477
  this.runner.instrumentData.timer = performance.now();
478
+ this.runnerDurationList = [];
463
479
  await this.#OutputLogMessage(`StartRunner [${this.#runner.id}]`);
464
480
  await this.#ForcePublishTelemetryData();
465
481
  return true;
@@ -506,6 +522,7 @@ var TestCaseFhirBase = class {
506
522
  //#region src/libmodule/testCaseFhirQueryBase.ts
507
523
  var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
508
524
  _longExecTimeoutVal = 5e3;
525
+ _durationList = [];
509
526
  constructor(workerInstance, runner) {
510
527
  super(workerInstance, runner);
511
528
  }
@@ -554,7 +571,7 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
554
571
  this.runner.instrumentData.activeRequestCount--;
555
572
  const diff = performance.now() - start;
556
573
  this.runner.instrumentData.duration = diff;
557
- this.runner.instrumentData.durationData.push(diff);
574
+ this.runnerDurationList.push(diff);
558
575
  if (diff <= 5) this.runner.instrumentData.duration5++;
559
576
  else if (diff <= 10) this.runner.instrumentData.duration10++;
560
577
  else if (diff <= 20) this.runner.instrumentData.duration20++;