add profiler

This commit is contained in:
fyears
2024-05-09 00:01:30 +08:00
parent 67467a5034
commit 36079fc1d0
7 changed files with 220 additions and 22 deletions
+17 -2
View File
@@ -62,7 +62,7 @@ import { getClient } from "./fsGetter";
import { FakeFsLocal } from "./fsLocal";
import { DEFAULT_WEBDIS_CONFIG } from "./fsWebdis";
import { changeMobileStatusBar } from "./misc";
import { Profiler } from "./profiler";
import { DEFAULT_PROFILER_CONFIG, Profiler } from "./profiler";
import { syncer } from "./sync";
const DEFAULT_SETTINGS: RemotelySavePluginSettings = {
@@ -96,6 +96,7 @@ const DEFAULT_SETTINGS: RemotelySavePluginSettings = {
obfuscateSettingFile: true,
enableMobileStatusBar: false,
encryptionMethod: "unknown",
profiler: DEFAULT_PROFILER_CONFIG,
};
interface OAuth2Info {
@@ -151,7 +152,11 @@ export default class RemotelySavePlugin extends Plugin {
appContainerObserver?: MutationObserver;
async syncRun(triggerSource: SyncTriggerSourceType = "manual") {
const profiler = new Profiler();
const profiler = new Profiler(
undefined,
this.settings.profiler?.enablePrinting ?? false,
this.settings.profiler?.recordSize ?? false
);
const fsLocal = new FakeFsLocal(
this.app.vault,
this.settings.syncConfigDir ?? false,
@@ -940,6 +945,16 @@ export default class RemotelySavePlugin extends Plugin {
}
}
if (this.settings.profiler === undefined) {
this.settings.profiler = DEFAULT_PROFILER_CONFIG;
}
if (this.settings.profiler.enablePrinting === undefined) {
this.settings.profiler.enablePrinting = false;
}
if (this.settings.profiler.recordSize === undefined) {
this.settings.profiler.recordSize = false;
}
await this.saveSettings();
}