Skip to content

Commit 5d6997c

Browse files
author
Esben Sparre Andreasen
committed
JS: additional extraction metrics cleanup
1 parent 03d38ca commit 5d6997c

File tree

5 files changed

+13
-23
lines changed

5 files changed

+13
-23
lines changed

javascript/ql/src/meta/extraction-metrics/FileData.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/**
2-
* @name File correlations
3-
* @description
2+
* @name Extraction metrics file data
3+
* @description Extraction metrics and related information for profiling the extraction of individual files.
44
* @kind table
55
* @id js/meta/extraction/file-data
6+
* @tags meta
67
*/
78

89
import javascript

javascript/ql/src/meta/extraction-metrics/MissingMetrics.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
/**
22
* @name File with missing extraction metrics
33
* @description A file missing extraction metrics is indicative of a faulty extractor.
4-
* @kind table
5-
* @problem.severity error
4+
* @kind problem
5+
* @problem.severity warning
6+
* @precision low
67
* @id js/meta/extraction/missing-metrics
8+
* @tags meta
79
*/
810

911
import javascript

javascript/ql/src/meta/extraction-metrics/PhaseTimings.ql

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
* @description An overview of how time was spent during extraction
44
* @kind table
55
* @id js/meta/extraction/phase-timings
6+
* @tags meta
67
*/
78

89
import semmle.javascript.meta.ExtractionMetrics::ExtractionMetrics
910

10-
from PhaseName phaseName, float cpuTime, int cpuPerc
11-
where
12-
cpuTime = Aggregated::getCpuTime(phaseName) and
13-
cpuPerc = ((cpuTime / Aggregated::getCpuTime()) * 100).floor()
14-
select phaseName, cpuTime as CPU_NANO, cpuPerc as CPU_PERC
11+
from PhaseName phaseName
12+
select phaseName, Aggregated::getCpuTime(phaseName) as CPU_NANO, Aggregated::getWallclockTime(phaseName) as WALLCLOCK_NANO

javascript/ql/src/semmle/javascript/meta/ExtractionMetrics.qll

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ module ExtractionMetrics {
9494
* The name of a phase of the extraction.
9595
*/
9696
class PhaseName extends string {
97-
bindingset[this]
9897
PhaseName() { this = getExtractionPhaseName(_) }
9998
}
10099

@@ -118,24 +117,14 @@ module ExtractionMetrics {
118117
* Gets the total CPU time spent in phase `phaseName` of the extraction.
119118
*/
120119
float getCpuTime(PhaseName phaseName) {
121-
/* bind */ phaseName = getExtractionPhaseName(_) and
122120
result = strictsum(any(FileWithExtractionMetrics f).getCpuTime(phaseName))
123121
}
124122

125123
/**
126124
* Gets the total wallclock time spent in phase `phaseName` of the extraction.
127125
*/
128126
float getWallclockTime(PhaseName phaseName) {
129-
/* bind */ phaseName = getExtractionPhaseName(_) and
130127
result = strictsum(any(FileWithExtractionMetrics f).getWallclockTime(phaseName))
131128
}
132129
}
133-
134-
/**
135-
* Gets `nanoseconds` formatted as a whole number of milliseconds.
136-
*/
137-
bindingset[nanoSeconds]
138-
string formatAsMilliSeconds(float nanoSeconds) {
139-
result = (nanoSeconds / (1000 * 1000)).ceil() + ""
140-
}
141130
}

javascript/ql/src/semmlecode.javascript.dbscheme

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ configLocations(
11391139

11401140
/**
11411141
* The time taken for the extraction of a file.
1142-
* This table contains non-deternistic content.
1142+
* This table contains non-deterministic content.
11431143
*
11441144
* The sum of the `time` column for each (`file`, `timerKind`) pair
11451145
* is the total time taken for extraction of `file`. The `extractionPhase`
@@ -1149,14 +1149,14 @@ extraction_time(
11491149
int file : @file ref,
11501150
// see `com.semmle.js.extractor.ExtractionMetrics.ExtractionPhase`.
11511151
int extractionPhase: int ref,
1152-
// 0 for the elapsed CPU time in nanoseconds, 1 for the wall elapsed wallclock time in nanoseconds
1152+
// 0 for the elapsed CPU time in nanoseconds, 1 for the elapsed wallclock time in nanoseconds
11531153
int timerKind: int ref,
11541154
float time: float ref
11551155
)
11561156

11571157
/**
11581158
* Non-timing related data for the extraction of a single file.
1159-
* This table contains non-deternistic content.
1159+
* This table contains non-deterministic content.
11601160
*/
11611161
extraction_data(
11621162
int file : @file ref,

0 commit comments

Comments
 (0)