-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add call graph/overrides performance tracking
Summary: Adding performance timers to call graph and overrides Reviewed By: arthaud Differential Revision: D33358207 fbshipit-source-id: 1f4bdbf3757e2a2da6aea931b2f193550186e86e
- Loading branch information
1 parent
c54a80b
commit 6345198
Showing
2 changed files
with
36 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1360,6 +1360,7 @@ let call_graph_of_define | |
~environment | ||
~define:({ Define.signature = { Define.Signature.name; parent; _ }; _ } as define) | ||
= | ||
let timer = Timer.start () in | ||
let callees_at_location = Location.Table.create () in | ||
let module DefineFixpoint = DefineCallGraphFixpoint (struct | ||
let global_resolution = TypeEnvironment.ReadOnly.global_resolution environment | ||
|
@@ -1388,17 +1389,28 @@ let call_graph_of_define | |
in | ||
|
||
DefineFixpoint.forward ~cfg:(Cfg.create define) ~initial:() |> ignore; | ||
Location.Table.to_alist callees_at_location | ||
|> List.map ~f:(fun (location, unprocessed_callees) -> | ||
match String.Map.Tree.to_alist unprocessed_callees with | ||
| [] -> failwith "unreachable" | ||
| [(_, callees)] -> | ||
location, LocationCallees.Singleton (ExpressionCallees.deduplicate callees) | ||
| _ -> | ||
( location, | ||
LocationCallees.Compound | ||
(Core.String.Map.Tree.map ~f:ExpressionCallees.deduplicate unprocessed_callees) )) | ||
|> Location.Map.of_alist_exn | ||
let call_graph = | ||
Location.Table.to_alist callees_at_location | ||
|> List.map ~f:(fun (location, unprocessed_callees) -> | ||
match String.Map.Tree.to_alist unprocessed_callees with | ||
| [] -> failwith "unreachable" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
alexkassil
Author
Contributor
|
||
| [(_, callees)] -> | ||
location, LocationCallees.Singleton (ExpressionCallees.deduplicate callees) | ||
| _ -> | ||
( location, | ||
LocationCallees.Compound | ||
(Core.String.Map.Tree.map ~f:ExpressionCallees.deduplicate unprocessed_callees) )) | ||
|> Location.Map.of_alist_exn | ||
in | ||
Statistics.performance | ||
~randomly_log_every:1000 | ||
~always_log_time_threshold:1.0 (* Seconds *) | ||
~name:"Call graph built" | ||
~section:`DependencyGraph | ||
~normals:["callable", Reference.show name] | ||
~timer | ||
(); | ||
call_graph | ||
|
||
|
||
module SharedMemory = struct | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nit: you were unreachable when we wanted to hang out :(