sliftutils 1.2.0 → 1.2.1

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/index.d.ts CHANGED
@@ -691,6 +691,11 @@ declare module "sliftutils/render-utils/asyncObservable" {
691
691
 
692
692
  }
693
693
 
694
+ declare module "sliftutils/render-utils/autoMeasure" {
695
+ export declare function runAutoMeasure(): void;
696
+
697
+ }
698
+
694
699
  declare module "sliftutils/render-utils/colors" {
695
700
  export declare const redButton: string;
696
701
  export declare const yellowButton: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -0,0 +1 @@
1
+ export declare function runAutoMeasure(): void;
@@ -0,0 +1,43 @@
1
+ import { runInfinitePoll } from "socket-function/src/batching";
2
+ import { timeInSecond } from "socket-function/src/misc";
3
+ import { startMeasure, logMeasureTable } from "socket-function/src/profiling/measure";
4
+
5
+ export function runAutoMeasure() {
6
+ let measureObj = startMeasure();
7
+
8
+ function logProfileMeasuresTimingsNow(force = false) {
9
+ let profile = measureObj.finish();
10
+ measureObj = startMeasure();
11
+ logMeasureTable(profile, {
12
+ name: `watchdog at ${new Date().toLocaleString()}`,
13
+ // NOTE: Much higher min log times, now that we are combining logs.
14
+ minTimeToLog: force ? 0 : 250,
15
+ thresholdInTable: 0,
16
+ setTitle: true
17
+ });
18
+ logMeasureTable(profile, {
19
+ name: `watchdog at ${new Date().toLocaleString()}`,
20
+ mergeDepth: 1,
21
+ minTimeToLog: force ? 0 : 250,
22
+ });
23
+ }
24
+ function logNow() {
25
+ logProfileMeasuresTimingsNow(true);
26
+ }
27
+ (globalThis as any).logProfileMeasuresNow = logNow;
28
+ (globalThis as any).logAll = logNow;
29
+ (globalThis as any).logNow = logNow;
30
+
31
+ (globalThis as any).logUnfiltered = function logUnfiltered(depth = 2) {
32
+ let profile = measureObj.finish();
33
+ measureObj = startMeasure();
34
+ logMeasureTable(profile, {
35
+ name: `all logs at ${new Date().toLocaleString()}`,
36
+ mergeDepth: depth,
37
+ minTimeToLog: 0,
38
+ maxTableEntries: 10000000,
39
+ thresholdInTable: 0
40
+ });
41
+ };
42
+ runInfinitePoll(timeInSecond * 60, logProfileMeasuresTimingsNow);
43
+ }