1 : // coveragedb.cxx
2 : // Copyright (C) 2007 Red Hat Inc.
3 : //
4 : // This file is part of systemtap, and is free software. You can
5 : // redistribute it and/or modify it under the terms of the GNU General
6 : // Public License (GPL); either version 2, or (at your option) any
7 : // later version.
8 :
9 : #ifndef COVERAGEDB_H
10 : #define COVERAGEDB_H
11 :
12 : #include "session.h"
13 :
14 : #include <string>
15 :
16 :
17 : /*
18 :
19 : tuples: file, line number, column, type of object, name
20 : values: number of times object "pulled_in", number of times "removed",
21 : times executed
22 :
23 : if (compiled == 0) object never compiled
24 : if (compiled > 0) object compiled
25 :
26 : The following are not currently implemented.
27 : if (executed == 0) never executed
28 : if (executed > 0) executed
29 :
30 :
31 : Want to make sure that the data base accurately reflects testing.
32 : 1) atomic updates, either commit all or none of information
33 : 2) only update coverage db compile info, if compile successful
34 : 3) only update coverage db execute info, if instrumentation run suscessfully
35 :
36 :
37 : Would like to have something that looks for interesting features in db:
38 :
39 : list which things are not compile
40 : list which things are not exectuted
41 :
42 : ratio of compiled/total (overall, by file, by line)
43 : ratio of executed/total (overall, by file, by line)
44 :
45 : */
46 :
47 : enum db_type {
48 : db_type_probe = 1,
49 : db_type_function = 2,
50 : db_type_local = 3,
51 : db_type_global = 4,
52 : };
53 :
54 0 : class coverage_element {
55 : public:
56 : std::string file;
57 : int line;
58 : int col;
59 : int type;
60 : std::string name;
61 : std::string parent;
62 : int compiled;
63 : int executed;
64 :
65 : coverage_element() { line = 0; col = 0;
66 : compiled = 0; executed = 0; }
67 :
68 0 : coverage_element(source_loc &place) {
69 0 : file = place.file; line = place.line; col = place.column;
70 0 : compiled = 0; executed = 0; }
71 : };
72 :
73 :
74 :
75 : void print_coverage_info(systemtap_session &s);
76 : void update_coverage_db(systemtap_session &s);
77 :
78 : #endif
79 :
|