mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
A simple query
This commit is contained in:
@@ -210,6 +210,8 @@ module KindPredicatesLog {
|
||||
|
||||
AppearsAs getAppearsAs() { result = this.getObject("appearsAs") }
|
||||
|
||||
int getMillis() { result = this.getNumber("millis") }
|
||||
|
||||
predicate hasCompletionTime(
|
||||
int year, string month, int day, int hours, int minute, int second, int millisecond
|
||||
) {
|
||||
@@ -228,6 +230,12 @@ module KindPredicatesLog {
|
||||
}
|
||||
|
||||
float getResultSize() { result = this.getFloat("resultSize") }
|
||||
|
||||
override string toString() {
|
||||
if exists(this.getPredicateName())
|
||||
then result = getPredicateName()
|
||||
else result = "<Summary event>"
|
||||
}
|
||||
}
|
||||
|
||||
class SentinelEmpty extends SummaryEvent {
|
||||
|
||||
15
ql/ql/src/experimental/queries/SlowPredicates.ql
Normal file
15
ql/ql/src/experimental/queries/SlowPredicates.ql
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Shows a list of the "slow" predicates by wallclock time.
|
||||
*/
|
||||
|
||||
import ql
|
||||
import codeql_ql.StructuredLogs
|
||||
|
||||
int predicateRank(KindPredicatesLog::SummaryEvent evt) {
|
||||
evt =
|
||||
rank[result](KindPredicatesLog::ComputeSimple y, int m | m = y.getMillis() | y order by m desc)
|
||||
}
|
||||
|
||||
from KindPredicatesLog::SummaryEvent evt
|
||||
where predicateRank(evt) < 50
|
||||
select evt, evt.getMillis() as time order by time desc
|
||||
Reference in New Issue
Block a user