mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #29085 from overleaf/em-metrics-dependencies
Log noteworthy dependencies in the CLSI performance log GitOrigin-RevId: 8412251e0cc77f305867d645ad5d9d3bbb9b0890
This commit is contained in:
@@ -8,6 +8,9 @@ function convertToMs(timeStr) {
|
||||
return Math.floor(parseFloat(timeStr, 10) * 1000)
|
||||
}
|
||||
|
||||
const NOTEWORTHY_DEPENDENCIES_REGEXP =
|
||||
/\/(beamer\.cls|tikz\.sty|microtype\.sty|minted\.sty)$/
|
||||
|
||||
/* An array of metric parsers for `latexmk` time output (`-time` flag).
|
||||
* Each entry is a tuple containing a metric name and a function to parse that
|
||||
* metric from the `latexmk` log output.
|
||||
@@ -152,33 +155,36 @@ function addLatexFdbMetrics(fdbContent, stats) {
|
||||
if (!fdbContent) {
|
||||
return
|
||||
}
|
||||
const { systemFileTypes, userFileTypes } = parseFdbContent(fdbContent)
|
||||
const { systemFileTypes, userFileTypes, dependencies } =
|
||||
parseFdbContent(fdbContent)
|
||||
|
||||
if (
|
||||
Object.keys(systemFileTypes).length === 0 &&
|
||||
Object.keys(userFileTypes).length === 0
|
||||
Object.keys(systemFileTypes).length > 0 ||
|
||||
Object.keys(userFileTypes).length > 0
|
||||
) {
|
||||
return
|
||||
const userSummary = summarizeFileTypes(userFileTypes)
|
||||
const systemSummary = summarizeFileTypes(systemFileTypes)
|
||||
|
||||
stats.latexmk['fdb-file-types'] = {
|
||||
total: {
|
||||
systemFileCount: systemSummary.total.count,
|
||||
systemFileSize: systemSummary.total.size,
|
||||
imageFileCount: userSummary.image.count,
|
||||
imageFileSize: userSummary.image.size,
|
||||
textFileCount: userSummary.text.count,
|
||||
textFileSize: userSummary.text.size,
|
||||
fontFileCount: userSummary.font.count,
|
||||
fontFileSize: userSummary.font.size,
|
||||
otherFileCount: userSummary.other.count,
|
||||
otherFileSize: userSummary.other.size,
|
||||
},
|
||||
system: convertToArray(systemFileTypes),
|
||||
user: convertToArray(userFileTypes),
|
||||
}
|
||||
}
|
||||
|
||||
const userSummary = summarizeFileTypes(userFileTypes)
|
||||
const systemSummary = summarizeFileTypes(systemFileTypes)
|
||||
|
||||
stats.latexmk['fdb-file-types'] = {
|
||||
total: {
|
||||
systemFileCount: systemSummary.total.count,
|
||||
systemFileSize: systemSummary.total.size,
|
||||
imageFileCount: userSummary.image.count,
|
||||
imageFileSize: userSummary.image.size,
|
||||
textFileCount: userSummary.text.count,
|
||||
textFileSize: userSummary.text.size,
|
||||
fontFileCount: userSummary.font.count,
|
||||
fontFileSize: userSummary.font.size,
|
||||
otherFileCount: userSummary.other.count,
|
||||
otherFileSize: userSummary.other.size,
|
||||
},
|
||||
system: convertToArray(systemFileTypes),
|
||||
user: convertToArray(userFileTypes),
|
||||
if (dependencies.length > 0) {
|
||||
stats.latexmk['fdb-dependencies'] = dependencies
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +192,7 @@ function parseFdbContent(fdbContent) {
|
||||
const systemFileTypes = {}
|
||||
const userFileTypes = {}
|
||||
const seenFiles = new Set()
|
||||
const dependencies = new Set()
|
||||
// Extract the file path and size from lines like:
|
||||
// FILENAME TIMESTAMP SIZE CHECKSUM ...
|
||||
// "main.tex" 1760016467 6147 9da336eb1132ecb1d61cd1f5a70cfa62 ""
|
||||
@@ -208,9 +215,19 @@ function parseFdbContent(fdbContent) {
|
||||
}
|
||||
fileTypes[ext].count++
|
||||
fileTypes[ext].size += fileSize
|
||||
|
||||
const depMatch = filePath.match(NOTEWORTHY_DEPENDENCIES_REGEXP)
|
||||
if (depMatch) {
|
||||
dependencies.add(depMatch[1])
|
||||
}
|
||||
|
||||
seenFiles.add(filePath)
|
||||
}
|
||||
return { systemFileTypes, userFileTypes }
|
||||
return {
|
||||
systemFileTypes,
|
||||
userFileTypes,
|
||||
dependencies: Array.from(dependencies),
|
||||
}
|
||||
}
|
||||
|
||||
function getFileTypeCategory(ext) {
|
||||
|
||||
Reference in New Issue
Block a user