@nsshunt/ststestrunner 1.1.75 → 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,7 +245,22 @@ 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 = [];
@@ -482,6 +498,7 @@ var TestCaseFhirBase = class {
482
498
  };
483
499
  StartRunner = async () => {
484
500
  this.runner.instrumentData.timer = performance.now();
501
+ this.runnerDurationList = [];
485
502
  await this.#OutputLogMessage(`StartRunner [${this.#runner.id}]`);
486
503
  await this.#ForcePublishTelemetryData();
487
504
  return true;
@@ -528,6 +545,7 @@ var TestCaseFhirBase = class {
528
545
  //#region src/libmodule/testCaseFhirQueryBase.ts
529
546
  var TestCaseFhirQueryBase = class extends TestCaseFhirBase {
530
547
  _longExecTimeoutVal = 5e3;
548
+ _durationList = [];
531
549
  constructor(workerInstance, runner) {
532
550
  super(workerInstance, runner);
533
551
  }