Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
532ce243
Commit
532ce243
authored
11 months ago
by
Andre Maroneze
Committed by
David Bühler
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[Eva] add datatype for flamegraph data
parent
a131c462
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/eva/utils/eva_perf.ml
+18
-1
18 additions, 1 deletion
src/plugins/eva/utils/eva_perf.ml
src/plugins/eva/utils/eva_perf.mli
+3
-0
3 additions, 0 deletions
src/plugins/eva/utils/eva_perf.mli
with
21 additions
and
1 deletion
src/plugins/eva/utils/eva_perf.ml
+
18
−
1
View file @
532ce243
...
@@ -364,6 +364,16 @@ let stack_flamegraph = ref []
...
@@ -364,6 +364,16 @@ let stack_flamegraph = ref []
callee, or when the analysis of the function ends. This stack is never
callee, or when the analysis of the function ends. This stack is never
empty when an analysis is in progress. *)
empty when an analysis is in progress. *)
module
EvaFlamegraph
=
State_builder
.
Hashtbl
(
Callstack
.
Hashtbl
)
(
Datatype
.
Float
)
(
struct
let
name
=
"Eva.Flamegraph"
let
dependencies
=
[
Ast
.
self
]
let
size
=
20
end
)
(* pretty-prints the functions in a Value callstack, starting by main (i.e.
(* pretty-prints the functions in a Value callstack, starting by main (i.e.
in reverse order). *)
in reverse order). *)
let
pretty_callstack
oc
callstack
=
let
pretty_callstack
oc
callstack
=
...
@@ -392,6 +402,7 @@ let start_doing_flamegraph callstack =
...
@@ -392,6 +402,7 @@ let start_doing_flamegraph callstack =
let
file
=
Parameters
.
ValPerfFlamegraphs
.
get
()
in
let
file
=
Parameters
.
ValPerfFlamegraphs
.
get
()
in
try
try
(* Flamegraphs must be computed. Set up the stack and the output file *)
(* Flamegraphs must be computed. Set up the stack and the output file *)
EvaFlamegraph
.
clear
()
;
let
oc
=
open_out
(
file
:>
string
)
in
let
oc
=
open_out
(
file
:>
string
)
in
oc_flamegraph
:=
Some
oc
;
oc_flamegraph
:=
Some
oc
;
stack_flamegraph
:=
[
(
Sys
.
time
()
,
0
.
)
]
stack_flamegraph
:=
[
(
Sys
.
time
()
,
0
.
)
]
...
@@ -421,6 +432,10 @@ let stop_doing_flamegraph callstack =
...
@@ -421,6 +432,10 @@ let stop_doing_flamegraph callstack =
|
[]
->
assert
false
|
[]
->
assert
false
|
(
_
,
total
)
::
q
->
|
(
_
,
total
)
::
q
->
(* dump the total time (that we just updated) for the current function *)
(* dump the total time (that we just updated) for the current function *)
let
prev_total
=
try
EvaFlamegraph
.
find
callstack
with
Not_found
->
0
.
0
in
EvaFlamegraph
.
replace
callstack
(
prev_total
+.
total
);
Printf
.
fprintf
oc
"%a %.3f
\n
%!"
Printf
.
fprintf
oc
"%a %.3f
\n
%!"
pretty_callstack
callstack
(
total
*.
1000
.
);
pretty_callstack
callstack
(
total
*.
1000
.
);
match
q
with
match
q
with
...
@@ -435,7 +450,9 @@ let stop_doing_flamegraph callstack =
...
@@ -435,7 +450,9 @@ let stop_doing_flamegraph callstack =
let
reset_flamegraph
()
=
let
reset_flamegraph
()
=
match
!
oc_flamegraph
with
match
!
oc_flamegraph
with
|
None
->
()
|
None
->
()
|
Some
fd
->
close_out
fd
;
stack_flamegraph
:=
[]
;
oc_flamegraph
:=
None
|
Some
fd
->
close_out
fd
;
stack_flamegraph
:=
[]
;
oc_flamegraph
:=
None
;
EvaFlamegraph
.
clear
()
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
...
...
This diff is collapsed.
Click to expand it.
src/plugins/eva/utils/eva_perf.mli
+
3
−
0
View file @
532ce243
...
@@ -35,3 +35,6 @@ val display: Format.formatter -> unit
...
@@ -35,3 +35,6 @@ val display: Format.formatter -> unit
(** Reset the internal state of the module; to call at the very
(** Reset the internal state of the module; to call at the very
beginning of the analysis. *)
beginning of the analysis. *)
val
reset
:
unit
->
unit
val
reset
:
unit
->
unit
module
EvaFlamegraph
:
State_builder
.
Hashtbl
with
type
key
=
Callstack
.
t
and
type
data
=
float
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment