Temporarily collect metrics on job time and queue time (#4790)

Collecting raw data points for job time and queue time for a few days.
Briefly discussed with Matt, will be reverting in a few days.
This commit is contained in:
Jeremy Rifkin
2023-02-27 18:05:41 -05:00
committed by GitHub
parent fcd9ee7c87
commit 5fee0e24a6
2 changed files with 16 additions and 3 deletions

View File

@@ -334,7 +334,7 @@ export class BaseCompiler implements ICompiler {
const key = this.getCompilerCacheKey(compiler, args, options);
let result = await this.env.compilerCacheGet(key as any);
if (!result) {
result = await this.env.enqueue(async () => await exec.execute(compiler, args, options));
result = await this.env.enqueue(async () => await exec.execute(compiler, args, options), true);
if (result.okToCache) {
this.env
.compilerCachePut(key as any, result, undefined)

View File

@@ -151,8 +151,21 @@ export class CompilationEnvironment {
return this.executableCache.put(key, fs.readFileSync(filepath));
}
enqueue<T>(job: Job<T>) {
return this.compilationQueue.enqueue(job);
enqueue<T>(job: Job<T>, silent?: boolean) {
const enqueue_time = performance.now();
return this.compilationQueue.enqueue(async () => {
const launch_time = performance.now();
const res = await job();
const finish_time = performance.now();
if (!silent) {
logger.info(
`(compilation wall clock time: ${Math.round(finish_time - launch_time)} ms, queue time: ${
launch_time - enqueue_time
} ms)`,
);
}
return res;
});
}
findBadOptions(options: string[]) {