package frama-c
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Platform dedicated to the analysis of source code written in C
Install
dune-project
Dependency
Authors
-
MMichele Alberti
-
TThibaud Antignac
-
GGergö Barany
-
PPatrick Baudin
-
NNicolas Bellec
-
TThibaut Benjamin
-
AAllan Blanchard
-
LLionel Blatter
-
FFrançois Bobot
-
RRichard Bonichon
-
VVincent Botbol
-
QQuentin Bouillaguet
-
DDavid Bühler
-
ZZakaria Chihani
-
SSylvain Chiron
-
LLoïc Correnson
-
JJulien Crétin
-
PPascal Cuoq
-
ZZaynah Dargaye
-
BBasile Desloges
-
JJean-Christophe Filliâtre
-
PPhilippe Herrmann
-
JJordan Ischard
-
MMaxime Jacquemin
-
BBenjamin Jorge
-
FFlorent Kirchner
-
AAlexander Kogtenkov
-
RRemi Lazarini
-
TTristan Le Gall
-
KKilyan Le Gallic
-
JJean-Christophe Léchenet
-
MMatthieu Lemerre
-
DDara Ly
-
DDavid Maison
-
CClaude Marché
-
AAndré Maroneze
-
TThibault Martin
-
FFonenantsoa Maurica
-
MMelody Méaulle
-
BBenjamin Monate
-
NNicky Mouha
-
YYannick Moy
-
PPierre Nigron
-
AAnne Pacalet
-
VValentin Perrelle
-
GGuillaume Petiot
-
DDario Pinto
-
VVirgile Prevosto
-
AArmand Puccetti
-
FFélix Ridoux
-
VVirgile Robles
-
JJan Rochel
-
MMuriel Roger
-
CCécile Ruet-Cros
-
JJulien Signoles
-
FFabien Siron
-
NNicolas Stouls
-
HHugo Thievenaz
-
KKostyantyn Vorobyov
-
BBoris Yakobowski
Maintainers
Sources
frama-c-33.0-Arsenic.tar.gz
sha256=9c1cbffd28bb33c17a668107e39c96e4ae7378a3d8249f69b47afc7ee964e9b8
doc/src/frama-c-eva.server_api/stats_requests.ml.html
Source file stats_requests.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274(**************************************************************************) (* *) (* SPDX-License-Identifier LGPL-2.1 *) (* Copyright (C) *) (* CEA (Commissariat à l'énergie atomique et aux énergies alternatives) *) (* *) (**************************************************************************) (** Server requests about general statistics on the Eva analysis. *) open Server open Cil_types let package = let title = "Statistics about Eva analysis" in Package.package ~plugin:"eva" ~name:"stats" ~title () (* ----- Analysis statistics ------------------------------------------------ *) module AlarmCategory = struct open Server.Data module Tags = struct let dictionary = Enum.dictionary () (* Give a normal representation of the category *) let repr = let e = List.hd Cil_datatype.Exp.reprs in let lv = List.hd Cil_datatype.Lval.reprs in let typ = List.hd Cil_datatype.Typ.reprs in function | Summary.Division_by_zero -> Alarms.Division_by_zero e | Memory_access -> Memory_access (lv, For_reading) | Index_out_of_bound-> Index_out_of_bound (e, None) | Unaligned_pointer -> Unaligned_pointer (e, typ) | Invalid_shift -> Invalid_shift (e, None) | Overflow -> Overflow (Signed, e, Z.one, Lower_bound) | Uninitialized -> Uninitialized lv | Dangling -> Dangling lv | Nan_or_infinite -> Is_nan_or_infinite (e, FFloat) | Float_to_int -> Float_to_int (e, Z.one, Lower_bound) | Other -> assert false let register alarm_category = let name, descr = match alarm_category with | Summary.Other -> "other", "Any other alarm" | alarm_category -> let alarm = repr alarm_category in Alarms.(get_short_name alarm, get_description alarm) in Enum.tag dictionary ~name ~label:(Markdown.plain name) ~descr:(Markdown.plain descr) let division_by_zero = register Division_by_zero let memory_access = register Memory_access let index_out_of_bound = register Index_out_of_bound let unaligned_pointer = register Unaligned_pointer let invalid_shift = register Invalid_shift let overflow = register Overflow let uninitialized = register Uninitialized let dangling = register Dangling let nan_or_infinite = register Nan_or_infinite let float_to_int = register Float_to_int let other = register Other let () = Enum.set_lookup dictionary begin function | Summary.Division_by_zero -> division_by_zero | Memory_access -> memory_access | Index_out_of_bound -> index_out_of_bound | Unaligned_pointer -> unaligned_pointer | Invalid_shift -> invalid_shift | Overflow -> overflow | Uninitialized -> uninitialized | Dangling -> dangling | Nan_or_infinite -> nan_or_infinite | Float_to_int -> float_to_int | Other -> other end end let name = "alarmCategory" let descr = Markdown.plain "The alarms are counted after being grouped by these categories" let data = Request.dictionary ~package ~name ~descr Tags.dictionary include (val data : S with type t = Summary.alarm_category) end module Coverage = struct open Summary type t = coverage let jtype = Package.( Jrecord [ "reachable",Jnumber ; "dead",Jnumber ; ]) let to_json x = `Assoc [ "reachable", `Int x.reachable ; "dead", `Int x.dead ; ] end module Events = struct open Summary let jtype = Package.( Jrecord [ "errors",Jnumber ; "warnings",Jnumber ; ]) let to_json x = `Assoc [ "errors", `Int x.errors ; "warnings", `Int x.warnings ; ] end module Statuses = struct open Summary type t = statuses let jtype = Data.declare ~package ~name:"statusesEntry" ~descr:(Markdown.plain "Statuses count.") Package.(Jrecord [ "valid",Jnumber ; "unknown",Jnumber ; "invalid",Jnumber ; ]) let to_json x = `Assoc [ "valid", `Int x.valid ; "unknown", `Int x.unknown ; "invalid", `Int x.invalid ; ] end module AlarmEntry = struct let jtype = Data.declare ~package ~name:"alarmEntry" ~descr:(Markdown.plain "Alarm count for each alarm category.") Package.(Jrecord [ "category", AlarmCategory.jtype ; "count", Jnumber ]) let to_json (a,c) = `Assoc [ "category", AlarmCategory.to_json a ; "count", `Int c ] end module Alarms = struct type t = (AlarmCategory.t * int) list let jtype = Package.Jarray AlarmEntry.jtype let to_json x = `List (List.map AlarmEntry.to_json x) end module Statistics = struct open Summary type t = program_stats let jtype = Data.declare ~package ~name:"programStatsType" ~descr:(Markdown.plain "Statistics about an Eva analysis.") Package.(Jrecord [ "progFunCoverage",Coverage.jtype ; "progStmtCoverage",Coverage.jtype ; "progAlarms", Alarms.jtype ; "evaEvents",Events.jtype ; "kernelEvents",Events.jtype ; "alarmsStatuses",Statuses.jtype ; "assertionsStatuses",Statuses.jtype ; "precondsStatuses",Statuses.jtype ]) let to_json x = `Assoc [ "progFunCoverage", Coverage.to_json x.prog_fun_coverage ; "progStmtCoverage", Coverage.to_json x.prog_stmt_coverage ; "progAlarms", Alarms.to_json x.prog_alarms ; "evaEvents", Events.to_json x.eva_events ; "kernelEvents", Events.to_json x.kernel_events ; "alarmsStatuses", Statuses.to_json x.alarms_statuses ; "assertionsStatuses", Statuses.to_json x.assertions_statuses ; "precondsStatuses", Statuses.to_json x.preconds_statuses ] end let _computed_signal = States.register_value ~package ~name:"programStats" ~descr:(Markdown.plain "Statistics about the last Eva analysis for the whole program") ~output:(module Statistics) ~get:Summary.compute_stats ~add_hook:Update.add_computation_hook () let _functionStats = let open Summary in let model = States.model () in States.column model ~name:"fctName" ~descr:(Markdown.plain "Function name") ~data:(module Data.Jalpha) ~get:(fun (kf,_) -> Kernel_function.get_name kf); States.column model ~name:"coverage" ~descr:(Markdown.plain "Coverage of the Eva analysis") ~data:(module Coverage) ~get:(fun (_kf,stats) -> stats.fun_coverage); States.column model ~name:"alarmCount" ~descr:(Markdown.plain "Alarms raised by the Eva analysis by category") ~data:(module Alarms) ~get:(fun (_kf,stats) -> stats.fun_alarm_count); States.column model ~name:"alarmStatuses" ~descr:(Markdown.plain "Alarms statuses emitted by the Eva analysis") ~data:(module Statuses) ~get:(fun (_kf,stats) -> stats.fun_alarm_statuses); States.register_framac_array ~package ~name:"functionStats" ~descr:(Markdown.plain "Statistics about the last Eva analysis for each function") ~key:(fun kf -> Kernel_ast.Decl.index (SFunction kf)) ~keyType:(Kernel_ast.Decl.jtype) model (module FunctionStats) (* ----- Flamegraph and execution times ------------------------------------- *) let callstack_to_string kf_list = let pp_list = Pretty_utils.pp_list ~sep:":" Kernel_function.pretty in Format.asprintf "%a" pp_list (List.rev kf_list) let _evaFlamegraph = let model = States.model () in States.column model ~name:"stackNames" ~descr:(Markdown.plain "Callstack as functions name list, starting from main") ~data:(module Data.Jlist (Data.Jstring)) ~get:(fun (cs, _) -> List.rev_map Kernel_function.get_name cs); States.column model ~name:"nbCalls" ~descr:(Markdown.plain "Number of times the callstack has been analyzed") ~data:(module Data.Jint) ~get:(fun (_cs, stat) -> stat.Eva_perf.nb_calls); States.column model ~name:"selfTime" ~descr:(Markdown.plain "Computation time for the callstack itself") ~data:(module Data.Jfloat) ~get:(fun (_cs, stat) -> stat.Eva_perf.self_duration); States.column model ~name:"totalTime" ~descr:(Markdown.plain "Total computation time, including functions called") ~data:(module Data.Jfloat) ~get:(fun (_cs, stat) -> stat.Eva_perf.total_duration); States.column model ~name:"kfDecl" ~descr:(Markdown.plain "Declaration of the top function") ~data:(module Kernel_ast.Decl) ~get:(fun (cs, _) -> Printer_tag.SFunction (List.hd cs)); States.register_framac_array ~package ~name:"flamegraph" ~descr:(Markdown.plain "Data for flamegraph: execution times by callstack") ~key:callstack_to_string model (module Eva_perf.StatByCallstack)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>