AIX: profiler is inactive by default on both Client and Server

To turn it on, either|or:
- server side: aix.router.ts: DEBUG_LOG_PROFILER_ON_SERVER=true
- client side: DEV BUILD + "debug mode" + DEBUG_LOG_PROFILER_ON_CLIENT=true to show on the console
This commit is contained in:
Enrico Ros
2025-03-16 22:15:52 -07:00
parent a8752ccde0
commit 4f048a9907
2 changed files with 11 additions and 6 deletions
+8 -3
View File
@@ -21,6 +21,7 @@ const GENERATED_IMAGES_CONVERT_TO_COMPRESSED = true; // converts PNG to WebP or
const GENERATED_IMAGES_COMPRESSION_QUALITY = 0.98;
const ELLIPSIZE_DEV_ISSUE_MESSAGES = 4096;
const MERGE_ISSUES_INTO_TEXT_PART_IF_OPEN = true;
const DEBUG_LOG_PROFILER_ON_CLIENT = false; // print Profiling particles when they come in, otherwise ignore them
/**
@@ -242,9 +243,13 @@ export class ContentReassembler {
aixClientDebugger_setRequest(this.debuggerFrameId, op.dispatchRequest);
break;
case '_debugProfiler':
// only show this to developers in the console
console.warn('[AIX] chatGenerate profiler measurements:');
console.table(op.measurements);
// Profiling particles will come in if the app is in "Debug Mode" + it's a Development build!
// Additionally to show them on the console (rather than just in the debugger) set the
// constant to `true`.
if (DEBUG_LOG_PROFILER_ON_CLIENT) {
console.warn('[AIX] chatGenerate profiler measurements:');
console.table(op.measurements);
}
break;
case 'end':
this.onCGEnd(op);
+3 -3
View File
@@ -13,7 +13,7 @@ import { heartbeatsWhileAwaiting } from '../dispatch/heartbeatsWhileAwaiting';
// configuration
const DEBUG_LOG_PROFILER = false; // capture and log performance (server-side flag, it can also tbe set by the client to return the profiling data)
const DEBUG_LOG_PROFILER_ON_SERVER = false; // capture and log performance (server-side flag, it can also tbe set by the client to return the profiling data)
export const aixRouter = createTRPCRouter({
@@ -46,7 +46,7 @@ export const aixRouter = createTRPCRouter({
// Profiler, if requested by the caller
const _profiler = !(DEBUG_LOG_PROFILER || input.connectionOptions?.debugDispatchRequest) ? null
const _profiler = !(DEBUG_LOG_PROFILER_ON_SERVER || input.connectionOptions?.debugDispatchRequest) ? null
: new PerformanceProfiler();
const _profilerCompleted = !_profiler ? null : () => {
@@ -55,7 +55,7 @@ export const aixRouter = createTRPCRouter({
chatGenerateTx.addDebugProfilererData(_profiler?.getResultsData());
// print on the console, only if we have the server-side conf flag
if (DEBUG_LOG_PROFILER)
if (DEBUG_LOG_PROFILER_ON_SERVER)
performanceProfilerLog('AIX Router Performance', _profiler?.getResultsData());
// clear the profiler for the next call, for resident lambdas (the profiling framework is global)