You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/tools/recorded-call-graph-metrics/README.md
+29-6Lines changed: 29 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,28 @@ also known as _call graph tracing_.
4
4
5
5
Execute a python program and for each call being made, record the call and callee. This allows us to compare call graph resolution from static analysis with actual data -- that is, can we statically determine the target of each actual call correctly.
6
6
7
-
## How do I give it a spin?
7
+
Using the call graph tracer does incur heave toll on the performance. Expect 10x longer to execute program.
8
8
9
-
After following setup instructions below, you should be able to reproduce the example trace by running
9
+
Number of calls recorded vary a little from run to run. I have not been able to pinpoint why.
Currently it's possible to gather metrics from traced runs against two projects (defined in [projects.json](./projects.json)): `youtube-dl` and `wcwidth`.
14
+
15
+
To run against all projects, use
16
+
17
+
```bash
18
+
$ ./helper.sh all $(./helper.sh projects)
13
19
```
14
20
15
-
You can also run traces for all tests and build a database by running `tests/create-test-db.sh`. Then run the queries inside the `ql/` directory.
21
+
To view the results, use
22
+
```
23
+
$ head -n 100 projects/*/Metrics.txt
24
+
```
16
25
26
+
## Local development
17
27
18
-
## Setup
28
+
###Setup
19
29
20
30
1. Ensure you have at least Python 3.7
21
31
@@ -47,9 +57,22 @@ You can also run traces for all tests and build a database by running `tests/cre
47
57
48
58
6. Enjoy writing code, and being able to run `cg-trace` on your command line :tada:
49
59
60
+
### Using it
61
+
62
+
After following setup instructions above, you should be able to reproduce the example trace by running
You can also run traces for all tests and build a database by running `tests/create-test-db.sh`. Then run the queries inside the `ql/` directory.
50
69
51
70
## Tracing Limitations
52
71
72
+
### Multi-threading
73
+
74
+
Should be possible by using [`threading.setprofile`](https://docs.python.org/3.8/library/threading.html#threading.setprofile), but that hasn't been done yet.
75
+
53
76
### Code that uses `sys.setprofile`
54
77
55
78
Since that is our mechanism for recording calls, any code that uses `sys.setprofile` will not work together with the call-graph tracer.
0 commit comments