@universal-packages/time-measurer 1.0.0
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.
- package/Measurement.d.ts +16 -0
- package/Measurement.js +76 -0
- package/Measurement.js.map +1 -0
- package/Measurement.types.d.ts +1 -0
- package/Measurement.types.js +3 -0
- package/Measurement.types.js.map +1 -0
- package/TimeMeasurer.d.ts +27 -0
- package/TimeMeasurer.js +43 -0
- package/TimeMeasurer.js.map +1 -0
- package/index.d.ts +5 -0
- package/index.js +29 -0
- package/index.js.map +1 -0
- package/package.json +46 -0
- package/singleton.d.ts +3 -0
- package/singleton.js +17 -0
- package/singleton.js.map +1 -0
- package/sleep.d.ts +1 -0
- package/sleep.js +7 -0
- package/sleep.js.map +1 -0
package/Measurement.d.ts
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
import { TimeFormat } from './Measurement.types';
|
2
|
+
export default class Measurement {
|
3
|
+
readonly hours: number;
|
4
|
+
readonly minutes: number;
|
5
|
+
readonly seconds: number;
|
6
|
+
readonly milliseconds: number;
|
7
|
+
constructor(nanoseconds: bigint);
|
8
|
+
/** Returns the measured time in a formated string */
|
9
|
+
toString(format?: TimeFormat): string;
|
10
|
+
/** Returns the measured time in a formated string */
|
11
|
+
toDate(): Date;
|
12
|
+
private getCondenced;
|
13
|
+
private getHuman;
|
14
|
+
private gerExpressive;
|
15
|
+
private pad;
|
16
|
+
}
|
package/Measurement.js
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
class Measurement {
|
4
|
+
constructor(nanoseconds) {
|
5
|
+
let currentNanoseconds = nanoseconds;
|
6
|
+
this.hours = Number(currentNanoseconds / 3600000000000n);
|
7
|
+
currentNanoseconds = currentNanoseconds - BigInt(Math.floor(this.hours)) * 3600000000000n;
|
8
|
+
this.minutes = Number(currentNanoseconds / 60000000000n);
|
9
|
+
currentNanoseconds = currentNanoseconds - BigInt(Math.floor(this.minutes)) * 60000000000n;
|
10
|
+
this.seconds = Number(currentNanoseconds / 1000000000n);
|
11
|
+
currentNanoseconds = currentNanoseconds - BigInt(Math.floor(this.seconds)) * 1000000000n;
|
12
|
+
this.milliseconds = Number(currentNanoseconds) / 1000000;
|
13
|
+
}
|
14
|
+
/** Returns the measured time in a formated string */
|
15
|
+
toString(format = 'Human') {
|
16
|
+
switch (format) {
|
17
|
+
case 'Condensed':
|
18
|
+
return this.getCondenced();
|
19
|
+
case 'Human':
|
20
|
+
return this.getHuman();
|
21
|
+
case 'Expressive':
|
22
|
+
return this.gerExpressive();
|
23
|
+
}
|
24
|
+
}
|
25
|
+
/** Returns the measured time in a formated string */
|
26
|
+
toDate() {
|
27
|
+
return new Date(0, 0, 0, this.hours, this.minutes, this.seconds, this.milliseconds);
|
28
|
+
}
|
29
|
+
getCondenced() {
|
30
|
+
if (this.hours !== 0) {
|
31
|
+
return `${this.pad(this.hours)}:${this.pad(this.minutes)}:${this.pad(this.seconds)}.${this.pad(this.milliseconds, 3)}`;
|
32
|
+
}
|
33
|
+
else if (this.minutes !== 0) {
|
34
|
+
return `${this.pad(this.minutes)}:${this.pad(this.seconds)}.${this.pad(this.milliseconds, 3)}`;
|
35
|
+
}
|
36
|
+
else if (this.seconds !== 0) {
|
37
|
+
return `${this.seconds}.${this.pad(this.milliseconds, 3)}`;
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
return `${this.pad(this.milliseconds, 3, 2)}`;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
getHuman() {
|
44
|
+
if (this.hours !== 0) {
|
45
|
+
return `${this.pad(this.hours)}hrs ${this.pad(this.minutes)}min ${this.pad(this.seconds)}.${this.pad(this.milliseconds, 3)}sec`;
|
46
|
+
}
|
47
|
+
else if (this.minutes !== 0) {
|
48
|
+
return `${this.pad(this.minutes)}min ${this.pad(this.seconds)}.${this.pad(this.milliseconds, 3)}sec`;
|
49
|
+
}
|
50
|
+
else if (this.seconds !== 0) {
|
51
|
+
return `${this.pad(this.seconds)}.${this.pad(this.milliseconds, 3)}sec`;
|
52
|
+
}
|
53
|
+
else {
|
54
|
+
return `${this.pad(this.milliseconds, 3, 2)}ms`;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
gerExpressive() {
|
58
|
+
if (this.hours !== 0) {
|
59
|
+
return `${this.pad(this.hours)} Hours, ${this.pad(this.minutes)} Minutes, and ${this.pad(this.seconds)}.${this.pad(this.milliseconds, 3)} Seconds`;
|
60
|
+
}
|
61
|
+
else if (this.minutes !== 0) {
|
62
|
+
return `${this.pad(this.minutes)} Minutes, and ${this.pad(this.seconds)}.${this.pad(this.milliseconds, 3)} Seconds`;
|
63
|
+
}
|
64
|
+
else if (this.seconds !== 0) {
|
65
|
+
return `${this.pad(this.seconds)}.${this.pad(this.milliseconds, 3)} Seconds`;
|
66
|
+
}
|
67
|
+
else {
|
68
|
+
return `${this.pad(this.milliseconds, 3, 2)} Milliseconds`;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
pad(num, places = 2, fixPositions = 0) {
|
72
|
+
return num.toFixed(fixPositions).padStart(places, '0');
|
73
|
+
}
|
74
|
+
}
|
75
|
+
exports.default = Measurement;
|
76
|
+
//# sourceMappingURL=Measurement.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Measurement.js","sourceRoot":"","sources":["../src/Measurement.ts"],"names":[],"mappings":";;AAEA,MAAqB,WAAW;IAM9B,YAAmB,WAAmB;QACpC,IAAI,kBAAkB,GAAG,WAAW,CAAA;QAEpC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,kBAAkB,GAAG,cAAc,CAAC,CAAA;QACxD,kBAAkB,GAAG,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,cAAc,CAAA;QAEzF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,kBAAkB,GAAG,YAAY,CAAC,CAAA;QACxD,k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GAAG,CAAC,CAAA;IACxD,CAAC;CACF;AA7ED,8BA6EC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare type TimeFormat = 'Expressive' | 'Human' | 'Condensed';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Measurement.types.js","sourceRoot":"","sources":["../src/Measurement.types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import Measurement from './Measurement';
|
2
|
+
/**
|
3
|
+
*
|
4
|
+
* It meassures the time a process takes from the time start is called
|
5
|
+
* to when the finish method is called
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
export default class TimeMeasurer {
|
9
|
+
private hrstart;
|
10
|
+
/** Starts a measurement */
|
11
|
+
start(): void;
|
12
|
+
/** Returns a measurement representing the time passed from when start wass colled */
|
13
|
+
finish(): Measurement;
|
14
|
+
/**
|
15
|
+
* Simple waitable timeout to sleep the process
|
16
|
+
*
|
17
|
+
* Example:
|
18
|
+
*
|
19
|
+
* ```ts
|
20
|
+
* // In milliseconds
|
21
|
+
* await TimeMeasurer.sleep(1000)
|
22
|
+
*
|
23
|
+
* ```
|
24
|
+
*
|
25
|
+
* */
|
26
|
+
static sleep(time: number): Promise<void>;
|
27
|
+
}
|
package/TimeMeasurer.js
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const Measurement_1 = __importDefault(require("./Measurement"));
|
7
|
+
const sleep_1 = __importDefault(require("./sleep"));
|
8
|
+
/**
|
9
|
+
*
|
10
|
+
* It meassures the time a process takes from the time start is called
|
11
|
+
* to when the finish method is called
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
class TimeMeasurer {
|
15
|
+
/** Starts a measurement */
|
16
|
+
start() {
|
17
|
+
this.hrstart = process.hrtime.bigint();
|
18
|
+
}
|
19
|
+
/** Returns a measurement representing the time passed from when start wass colled */
|
20
|
+
finish() {
|
21
|
+
if (this.hrstart === undefined)
|
22
|
+
throw new Error('Time measurer finished without previously started');
|
23
|
+
const nanoseconds = process.hrtime.bigint() - this.hrstart;
|
24
|
+
return new Measurement_1.default(nanoseconds);
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* Simple waitable timeout to sleep the process
|
28
|
+
*
|
29
|
+
* Example:
|
30
|
+
*
|
31
|
+
* ```ts
|
32
|
+
* // In milliseconds
|
33
|
+
* await TimeMeasurer.sleep(1000)
|
34
|
+
*
|
35
|
+
* ```
|
36
|
+
*
|
37
|
+
* */
|
38
|
+
static async sleep(time) {
|
39
|
+
return (0, sleep_1.default)(time);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
exports.default = TimeMeasurer;
|
43
|
+
//# sourceMappingURL=TimeMeasurer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TimeMeasurer.js","sourceRoot":"","sources":["../src/TimeMeasurer.ts"],"names":[],"mappings":";;;;;AAAA,gEAAuC;AACvC,oDAA2B;AAE3B;;;;;GAKG;AACH,MAAqB,YAAY;IAG/B,2BAA2B;IACpB,KAAK;QACV,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;IACxC,CAAC;IAED,qFAAqF;IAC9E,MAAM;QACX,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;QAEpG,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAA;QAE1D,OAAO,IAAI,qBAAW,CAAC,WAAW,CAAC,CAAA;IACrC,CAAC;IAED;;;;;;;;;;;SAWK;IACE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAY;QACpC,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,CAAA;IACpB,CAAC;CACF;AAhCD,+BAgCC"}
|
package/index.d.ts
ADDED
package/index.js
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
|
+
};
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
+
exports.sleep = exports.Measurement = exports.default = void 0;
|
21
|
+
var TimeMeasurer_1 = require("./TimeMeasurer");
|
22
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(TimeMeasurer_1).default; } });
|
23
|
+
var Measurement_1 = require("./Measurement");
|
24
|
+
Object.defineProperty(exports, "Measurement", { enumerable: true, get: function () { return __importDefault(Measurement_1).default; } });
|
25
|
+
__exportStar(require("./Measurement.types"), exports);
|
26
|
+
var sleep_1 = require("./sleep");
|
27
|
+
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return __importDefault(sleep_1).default; } });
|
28
|
+
__exportStar(require("./singleton"), exports);
|
29
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,+CAAwC;AAA/B,wHAAA,OAAO,OAAA;AAChB,6CAAsD;AAA7C,2HAAA,OAAO,OAAe;AAC/B,sDAAmC;AACnC,iCAA0C;AAAjC,+GAAA,OAAO,OAAS;AACzB,8CAA2B"}
|
package/package.json
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
{
|
2
|
+
"name": "@universal-packages/time-measurer",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "Utility to measure routines times with precision",
|
5
|
+
"author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)",
|
6
|
+
"license": "MIT",
|
7
|
+
"main": "index.js",
|
8
|
+
"types": "index.d.ts",
|
9
|
+
"repository": "git://git@github.com/universal-packeges/universal-time-measurer.git",
|
10
|
+
"scripts": {
|
11
|
+
"build": "tsc --p tsconfig.dis.json",
|
12
|
+
"test": "jest --watch",
|
13
|
+
"test:full": "jest --coverage --verbose"
|
14
|
+
},
|
15
|
+
"dependencies": {},
|
16
|
+
"devDependencies": {
|
17
|
+
"@types/jest": "^28.1.0",
|
18
|
+
"@types/node": "^17.0.39",
|
19
|
+
"jest": "^28.1.0",
|
20
|
+
"jest-circus": "^28.1.0",
|
21
|
+
"ts-jest": "^28.0.4",
|
22
|
+
"typescript": "^4.7.3"
|
23
|
+
},
|
24
|
+
"jest": {
|
25
|
+
"testRunner": "jest-circus/runner",
|
26
|
+
"transform": {
|
27
|
+
"^.+\\.(ts|tsx)$": "ts-jest"
|
28
|
+
},
|
29
|
+
"testRegex": "(/tests/.*\\.test\\.ts?)$",
|
30
|
+
"collectCoverageFrom": [
|
31
|
+
"src/**/*.ts"
|
32
|
+
],
|
33
|
+
"setupFilesAfterEnv": [
|
34
|
+
"<rootDir>/tests/setupTests.ts"
|
35
|
+
],
|
36
|
+
"watchPathIgnorePatterns": [
|
37
|
+
"<rootDir>/tmp"
|
38
|
+
]
|
39
|
+
},
|
40
|
+
"prettier": {
|
41
|
+
"semi": false,
|
42
|
+
"singleQuote": true,
|
43
|
+
"printWidth": 180,
|
44
|
+
"trailingComma": "none"
|
45
|
+
}
|
46
|
+
}
|
package/singleton.d.ts
ADDED
package/singleton.js
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.finish = exports.start = void 0;
|
7
|
+
const TimeMeasurer_1 = __importDefault(require("./TimeMeasurer"));
|
8
|
+
const PROCESS_MEASURER = new TimeMeasurer_1.default();
|
9
|
+
function start() {
|
10
|
+
PROCESS_MEASURER.start();
|
11
|
+
}
|
12
|
+
exports.start = start;
|
13
|
+
function finish() {
|
14
|
+
return PROCESS_MEASURER.finish();
|
15
|
+
}
|
16
|
+
exports.finish = finish;
|
17
|
+
//# sourceMappingURL=singleton.js.map
|
package/singleton.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"singleton.js","sourceRoot":"","sources":["../src/singleton.ts"],"names":[],"mappings":";;;;;;AACA,kEAAyC;AAEzC,MAAM,gBAAgB,GAAG,IAAI,sBAAY,EAAE,CAAA;AAE3C,SAAgB,KAAK;IACnB,gBAAgB,CAAC,KAAK,EAAE,CAAA;AAC1B,CAAC;AAFD,sBAEC;AAED,SAAgB,MAAM;IACpB,OAAO,gBAAgB,CAAC,MAAM,EAAE,CAAA;AAClC,CAAC;AAFD,wBAEC"}
|
package/sleep.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export default function sleep(time: number): Promise<void>;
|
package/sleep.js
ADDED
package/sleep.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../src/sleep.ts"],"names":[],"mappings":";;AAAe,KAAK,UAAU,KAAK,CAAC,IAAY;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAkB,EAAE,CAAC,UAAU,CAAC,GAAS,EAAE,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;AAC1F,CAAC;AAFD,wBAEC"}
|