diff options
author | partouf <partouf@gmail.com> | 2022-05-31 23:46:20 +0200 |
---|---|---|
committer | partouf <partouf@gmail.com> | 2022-05-31 23:46:20 +0200 |
commit | 3c5a53d05c5088a98f496c39058383ee95ef91e9 (patch) | |
tree | 3ab01e30ba9e7c80e2fe3ea974c3a840b8b9dad9 | |
parent | a21c7e1d70f475ba325cc33cc3ef10f394f04f24 (diff) | |
download | compiler-explorer-gh-3204.tar.gz compiler-explorer-gh-3204.zip |
initialize directlygh-3204
-rw-r--r-- | lib/base-compiler.ts | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/base-compiler.ts b/lib/base-compiler.ts index a1c79a018..020dc84fa 100644 --- a/lib/base-compiler.ts +++ b/lib/base-compiler.ts @@ -25,6 +25,7 @@ import path from 'path'; import fs from 'fs-extra'; +import * as PromClient from 'prom-client'; import temp from 'temp'; import _ from 'underscore'; @@ -59,7 +60,6 @@ import {AsmParser} from './parsers/asm-parser'; import {IAsmParser} from './parsers/asm-parser.interfaces'; import {getToolchainPath} from './toolchain-utils'; import * as utils from './utils'; -import * as PromClient from 'prom-client'; export class BaseCompiler { public compiler: any; @@ -87,7 +87,11 @@ export class BaseCompiler { protected externalparser: null | ExternalParserBase; protected supportedLibraries?: Record<string, Library>; protected packager: Packager; - private static objdumpAndParseGauge?; + private static objdumpAndParseCounter = new PromClient.Counter({ + name: 'ce_objdumpandparsetime_total', + help: 'Time spent on objdump and parsing of objdumps', + labelNames: [], + }); constructor(compilerInfo, env) { // Information about our compiler @@ -97,14 +101,6 @@ export class BaseCompiler { throw new Error(`Missing language info for ${compilerInfo.lang}`); } - if (!BaseCompiler.objdumpAndParseGauge) { - BaseCompiler.objdumpAndParseGauge = new PromClient.Counter({ - name: 'ce_objdumpandparsetime_total', - help: 'Time spent on objdump and parsing of objdumps', - labelNames: [], - }); - } - this.compileFilename = `example${this.lang.extensions[0]}`; this.env = env; // Partial application of compilerProps with the proper language id applied to it @@ -2076,7 +2072,7 @@ export class BaseCompiler { result.filteredCount = res.filteredCount; if (result.objdumpTime) { const dumpAndParseTime = parseInt(result.objdumpTime) + parseInt(result.parsingTime); - BaseCompiler.objdumpAndParseGauge.inc(dumpAndParseTime); + BaseCompiler.objdumpAndParseCounter.inc(dumpAndParseTime); } } else { result.asm = [{text: result.asm}]; |