Branch data Line data Source code
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 : : #include "staptree.h"
14 : :
15 : : #include <string>
16 : :
17 : :
18 : : /*
19 : :
20 : : tuples: file, line number, column, type of object, name
21 : : values: number of times object "pulled_in", number of times "removed",
22 : : times executed
23 : :
24 : : if (compiled == 0) object never compiled
25 : : if (compiled > 0) object compiled
26 : :
27 : : The following are not currently implemented.
28 : : if (executed == 0) never executed
29 : : if (executed > 0) executed
30 : :
31 : :
32 : : Want to make sure that the data base accurately reflects testing.
33 : : 1) atomic updates, either commit all or none of information
34 : : 2) only update coverage db compile info, if compile successful
35 : : 3) only update coverage db execute info, if instrumentation run suscessfully
36 : :
37 : :
38 : : Would like to have something that looks for interesting features in db:
39 : :
40 : : list which things are not compile
41 : : list which things are not exectuted
42 : :
43 : : ratio of compiled/total (overall, by file, by line)
44 : : ratio of executed/total (overall, by file, by line)
45 : :
46 : : */
47 : :
48 : : enum db_type {
49 : : db_type_probe = 1,
50 : : db_type_function = 2,
51 : : db_type_local = 3,
52 : : db_type_global = 4,
53 : : };
54 : :
55 [ # # ][ # # ]: 0 : class coverage_element {
56 : : public:
57 : : std::string file;
58 : : int line;
59 : : int col;
60 : : int type;
61 : : std::string name;
62 : : std::string parent;
63 : : int compiled;
64 : : int executed;
65 : :
66 : : coverage_element():
67 : : line(0), col(0), compiled(0), executed(0) {}
68 : :
69 : 0 : coverage_element(source_loc &place):
70 : : file(place.file->name), line(place.line), col(place.column),
71 [ # # ][ # # ]: 0 : type(0), compiled(0), executed(0) {}
72 : : };
73 : :
74 : :
75 : :
76 : : void print_coverage_info(systemtap_session &s);
77 : : void update_coverage_db(systemtap_session &s);
78 : :
79 : : #endif
80 : :
81 : : /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
|