Python: CG trace: Add overall metrics query

This commit is contained in:
Rasmus Wriedt Larsen
2020-07-22 00:46:24 +02:00
parent 278ab4b883
commit b227a7ec90
2 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import RecordedCalls
from string text, float number, float ratio
where
exists(int all_rcs | all_rcs = count(XMLRecordedCall rc) and ratio = number / all_rcs |
text = "Number of XMLRecordedCall" and number = all_rcs
or
text = "Number of IdentifiedRecordedCall" and number = count(IdentifiedRecordedCall rc)
or
text = "Number of UnidentifiedRecordedCall" and number = count(UnidentifiedRecordedCall rc)
)
or
exists(int all_identified_rcs |
all_identified_rcs = count(IdentifiedRecordedCall rc) and ratio = number / all_identified_rcs
|
text = "Number of points-to ResolvableRecordedCall" and
number = count(PointsToBasedCallGraph::ResolvableRecordedCall rc)
or
text = "Number of points-to NOT ResolvableRecordedCall" and
number = all_identified_rcs - count(PointsToBasedCallGraph::ResolvableRecordedCall rc)
)
select text, number, ratio * 100 + "%" as percent

View File

@@ -77,6 +77,14 @@ class XMLCall extends XMLElement {
bytecode.(XMLBytecodeAttribute).get_object_data())
or
matchBytecodeExpr(expr.(Call).getFunc(), bytecode.(XMLBytecodeCall).get_function_data())
// I experimented with allowing partial matches with
// ```
// or
// bytecode instanceof XMLBytecodeUnknown
// ```
// but that only gave 1% improvement for Identified calls with approx 4200 calls
// in total (only supporting BytecodeVariableName/BytecodeAttribute/BytecodeCall).
// Since it's a potential performance problem, I did not enable.
)
}
}