re-enable profiler
This commit is contained in:
@@ -140,6 +140,7 @@ export type CipherMethodType = "rclone-base64" | "openssl-base64" | "unknown";
|
||||
export type QRExportType = "basic_and_advanced" | SUPPORTED_SERVICES_TYPE;
|
||||
|
||||
export interface ProfilerConfig {
|
||||
enable?: boolean;
|
||||
enablePrinting?: boolean;
|
||||
recordSize?: boolean;
|
||||
}
|
||||
|
||||
@@ -361,6 +361,8 @@
|
||||
"settings_profiler_results_desc": "The plugin records the time cost of each steps. Here you can export them to know which step is slow.",
|
||||
"settings_profiler_results_notice": "Profiler results exported.",
|
||||
"settings_profiler_results_button_all": "Export All",
|
||||
"settings_profiler_enableprofiler": "Enable Profiler",
|
||||
"settings_profiler_enableprofiler_desc": "Collect performance data or not?",
|
||||
"settings_profiler_enabledebugprint": "Enable Profiler Printing",
|
||||
"settings_profiler_enabledebugprint_desc": "Print profiler result in each insertion to console or not?",
|
||||
"settings_profiler_recordsize": "Enable Profiler Recording Size",
|
||||
|
||||
@@ -360,6 +360,12 @@
|
||||
"settings_profiler_results_desc": "插件记录了每次同步每一步的耗时。这里可以导出记录得知哪一步最慢。",
|
||||
"settings_profiler_results_notice": "性能数据已导出",
|
||||
"settings_profiler_results_button_all": "导出所有",
|
||||
"settings_profiler_enableprofiler": "性能收集",
|
||||
"settings_profiler_enableprofiler_desc": "是否开启性能收集功能?",
|
||||
"settings_profiler_enabledebugprint": "性能收集输出",
|
||||
"settings_profiler_enabledebugprint_desc": "是否直接输出性能收集结果到终端里?",
|
||||
"settings_profiler_recordsize": "性能收集统计对象大小",
|
||||
"settings_profiler_recordsize_desc": "是否收集对象的大小?",
|
||||
"settings_outputbasepathvaultid": "输出资料库对应的位置和随机分配的 ID",
|
||||
"settings_outputbasepathvaultid_desc": "用于调试。",
|
||||
"settings_outputbasepathvaultid_button": "输出",
|
||||
|
||||
@@ -359,6 +359,12 @@
|
||||
"settings_profiler_results_desc": "外掛記錄了每次同步每一步的耗時。這裡可以匯出記錄得知哪一步最慢。",
|
||||
"settings_profiler_results_notice": "效能資料已匯出",
|
||||
"settings_profiler_results_button_all": "匯出所有",
|
||||
"settings_profiler_enableprofiler": "效能收集",
|
||||
"settings_profiler_enableprofiler_desc": "是否開啟效能收集功能?",
|
||||
"settings_profiler_enabledebugprint": "效能收集輸出",
|
||||
"settings_profiler_enabledebugprint_desc": "是否直接輸出效能收集結果到終端裡?",
|
||||
"settings_profiler_recordsize": "效能收集統計物件大小",
|
||||
"settings_profiler_recordsize_desc": "是否收集物件的大小?",
|
||||
"settings_outputbasepathvaultid": "輸出資料庫對應的位置和隨機分配的 ID",
|
||||
"settings_outputbasepathvaultid_desc": "用於除錯。",
|
||||
"settings_outputbasepathvaultid_button": "輸出",
|
||||
|
||||
+12
-7
@@ -108,7 +108,7 @@ import {
|
||||
upsertPluginVersionByVault,
|
||||
} from "./localdb";
|
||||
import { changeMobileStatusBar } from "./misc";
|
||||
import { DEFAULT_PROFILER_CONFIG, type Profiler } from "./profiler";
|
||||
import { DEFAULT_PROFILER_CONFIG, Profiler } from "./profiler";
|
||||
import { RemotelySaveSettingTab } from "./settings";
|
||||
import { SyncAlgoV3Modal } from "./syncAlgoV3Notice";
|
||||
|
||||
@@ -232,12 +232,14 @@ export default class RemotelySavePlugin extends Plugin {
|
||||
appContainerObserver?: MutationObserver;
|
||||
|
||||
async syncRun(triggerSource: SyncTriggerSourceType = "manual") {
|
||||
// const profiler = new Profiler(
|
||||
// undefined,
|
||||
// this.settings.profiler?.enablePrinting ?? false,
|
||||
// this.settings.profiler?.recordSize ?? false
|
||||
// );
|
||||
const profiler: Profiler | undefined = undefined;
|
||||
let profiler: Profiler | undefined = undefined;
|
||||
if (this.settings.profiler?.enable ?? false) {
|
||||
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,
|
||||
@@ -1471,6 +1473,9 @@ export default class RemotelySavePlugin extends Plugin {
|
||||
if (this.settings.profiler === undefined) {
|
||||
this.settings.profiler = DEFAULT_PROFILER_CONFIG;
|
||||
}
|
||||
if (this.settings.profiler.enable === undefined) {
|
||||
this.settings.profiler.enable = false;
|
||||
}
|
||||
if (this.settings.profiler.enablePrinting === undefined) {
|
||||
this.settings.profiler.enablePrinting = false;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ interface BreakPoint {
|
||||
}
|
||||
|
||||
export const DEFAULT_PROFILER_CONFIG: ProfilerConfig = {
|
||||
enable: false,
|
||||
enablePrinting: false,
|
||||
recordSize: false,
|
||||
};
|
||||
|
||||
@@ -2940,6 +2940,25 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(debugDiv)
|
||||
.setName(t("settings_profiler_enableprofiler"))
|
||||
.setDesc(t("settings_profiler_enableprofiler_desc"))
|
||||
.addDropdown((dropdown) => {
|
||||
dropdown.addOption("enable", t("enable"));
|
||||
dropdown.addOption("disable", t("disable"));
|
||||
dropdown
|
||||
.setValue(
|
||||
this.plugin.settings.profiler?.enable ? "enable" : "disable"
|
||||
)
|
||||
.onChange(async (val: string) => {
|
||||
if (this.plugin.settings.profiler === undefined) {
|
||||
this.plugin.settings.profiler = DEFAULT_PROFILER_CONFIG;
|
||||
}
|
||||
this.plugin.settings.profiler.enable = val === "enable";
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(debugDiv)
|
||||
.setName(t("settings_profiler_enabledebugprint"))
|
||||
.setDesc(t("settings_profiler_enabledebugprint_desc"))
|
||||
|
||||
Reference in New Issue
Block a user