File tree Expand file tree Collapse file tree 2 files changed +28
-25
lines changed Expand file tree Collapse file tree 2 files changed +28
-25
lines changed Original file line number Diff line number Diff line change @@ -362,31 +362,6 @@ module KindPredicatesLog {
362362 )
363363 }
364364
365- /**
366- * Holds if the predicate represented by `inLayer` was run in the `iteration`'iteration
367- * of the SCC computation rooted at `recursive`.
368- */
369- private predicate ran ( ComputeRecursive recursive , int iteration , InLayer inLayer ) {
370- exists ( int index |
371- inLayer = layerEventRank ( recursive , index ) and
372- inLayer .getPredicateIterationMillis ( ) .getNumber ( iteration ) >= 0
373- )
374- }
375-
376- /**
377- * Gets the next iteration in which the predicate `pred` in the `iteration`'th iteration
378- * of a recursive SCC rooted at `recursive` should be evaluated.
379- */
380- int nextPipeline ( ComputeRecursive recursive , int iteration , InLayer inLayer ) {
381- iteration = 0 and
382- if ran ( recursive , iteration , inLayer ) then result = 1 else result = 0
383- or
384- iteration > 1 and
385- exists ( int n | n = nextPipeline ( recursive , iteration - 1 , inLayer ) |
386- if ran ( recursive , iteration , inLayer ) then result = n + 1 else result = n
387- )
388- }
389-
390365 bindingset [ this ]
391366 signature class ResultSig ;
392367
Original file line number Diff line number Diff line change 1+ /**
2+ * Shows a list of the "slow" predicates by tuple sum.
3+ */
4+
5+ import ql
6+ import codeql_ql.StructuredLogs
7+ import KindPredicatesLog
8+
9+ module SumCounts implements Fold< int > {
10+ int base ( PipeLineRun run ) { result = sum ( int i | | run .getCount ( i ) ) }
11+
12+ bindingset [ s]
13+ int fold ( PipeLineRun run , int s ) { result = sum ( int i | | run .getCount ( i ) ) + s }
14+ }
15+
16+ int sumTuples ( SummaryEvent event ) {
17+ result = strictsum ( int i | | event .( ComputeSimple ) .getPipelineRun ( ) .getCount ( i ) )
18+ or
19+ result = Iterate< int , SumCounts > :: iterate ( event )
20+ }
21+
22+ int predicateRank ( SummaryEvent evt ) {
23+ evt = rank [ result ] ( SummaryEvent y , int s | s = sumTuples ( y ) | y order by s desc )
24+ }
25+
26+ from SummaryEvent evt , int s
27+ where predicateRank ( evt ) < 50 and s = sumTuples ( evt )
28+ select evt , s order by s desc
You can’t perform that action at this time.
0 commit comments