@nsshunt/ststestrunner 1.1.76 → 1.1.77

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.
@@ -54,6 +54,7 @@ var TestCaseFhirBase = class {
54
54
  #resetSocketClientTrigger = 50;
55
55
  #clientSocketFetchCount = 0;
56
56
  #authAgentManager;
57
+ runnerDurationList = [];
57
58
  _authMaxTimeout = 5e3;
58
59
  accessTokenTime = performance.now();
59
60
  newTokenLimitTime = 30;
@@ -244,13 +245,27 @@ var TestCaseFhirBase = class {
244
245
  process.nextTick(resolve);
245
246
  });
246
247
  }
248
+ #CalculatePercentile = () => {
249
+ this.runnerDurationList.sort((a, b) => a - b);
250
+ const size = this.runnerDurationList.length;
251
+ const _GetP = (factor) => {
252
+ const pos = Math.floor(size * factor);
253
+ if (pos >= 0 && pos < size) return this.runnerDurationList[pos];
254
+ else return -1;
255
+ };
256
+ this.#runner.instrumentData.perc["50"] = _GetP(.5);
257
+ this.#runner.instrumentData.perc["80"] = _GetP(.8);
258
+ this.#runner.instrumentData.perc["90"] = _GetP(.9);
259
+ this.#runner.instrumentData.perc["95"] = _GetP(.95);
260
+ this.#runner.instrumentData.perc["98"] = _GetP(.98);
261
+ };
247
262
  #PublishTelemetryData = async () => {
263
+ this.#CalculatePercentile();
248
264
  this.#runnerExecutionWorker.PostTelemetryById(this.#runner.id);
249
265
  this.#runner.instrumentData.velocity = 0;
250
266
  this.#runner.instrumentData.message = [];
251
267
  this.#runner.instrumentData.tx = 0;
252
268
  this.#runner.instrumentData.rx = 0;
253
- this.#runner.instrumentData.durationData = [];
254
269
  await this.SleepImmediate();
255
270
  };
256
271
  ExtractOrigin = (uri) => {
@@ -483,6 +498,7 @@ var TestCaseFhirBase = class {
483
498
  };
484
499
  StartRunner = async () => {
485
500
  this.runner.instrumentData.timer = performance.now();
501
+ this.runnerDurationList = [];
486
502
  await this.#OutputLogMessage(`StartRunner [${this.#runner.id}]`);
487
503
  await this.#ForcePublishTelemetryData();
488
504
  return true;
@@ -529,6 +545,7 @@ var TestCaseFhirBase = class {
529
545
  //#region src/libmodule/testCaseFhirQueryBase.ts
530
546
  var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
531
547
  _longExecTimeoutVal = 5e3;
548
+ _durationList = [];
532
549
  constructor(workerInstance, runner) {
533
550
  super(workerInstance, runner);
534
551
  }
@@ -577,7 +594,6 @@ var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
577
594
  this.runner.instrumentData.activeRequestCount--;
578
595
  const diff = performance.now() - start;
579
596
  this.runner.instrumentData.duration = diff;
580
- this.runner.instrumentData.durationData.push(diff);
581
597
  if (diff <= 5) this.runner.instrumentData.duration5++;
582
598
  else if (diff <= 10) this.runner.instrumentData.duration10++;
583
599
  else if (diff <= 20) this.runner.instrumentData.duration20++;