]>
Commit | Line | Data |
---|---|---|
177a8ead FCE |
1 | // -*- C++ -*- |
2 | // Copyright (C) 2005 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 SESSION_H | |
10 | #define SESSION_H | |
11 | ||
dc38c0ae | 12 | #include "elaborate.h" |
177a8ead FCE |
13 | #include <string> |
14 | #include <vector> | |
15 | #include <iostream> | |
16 | #include <sstream> | |
17 | #include <map> | |
18 | ||
19 | ||
20 | // forward decls for all referenced systemtap types | |
21 | struct match_node; | |
22 | struct stapfile; | |
23 | struct vardecl; | |
24 | struct functiondecl; | |
dc38c0ae | 25 | struct derived_probe_group_container; |
177a8ead FCE |
26 | struct embeddedcode; |
27 | struct translator_output; | |
28 | struct unparser; | |
29 | struct semantic_error; | |
30 | ||
31 | ||
32 | // XXX: a generalized form of this descriptor could be associated with | |
33 | // a vardecl instead of out here at the systemtap_session level. | |
34 | struct statistic_decl | |
35 | { | |
36 | statistic_decl() | |
37 | : type(none), | |
38 | logarithmic_buckets(0), | |
39 | linear_low(0), linear_high(0), linear_step(0) | |
40 | {} | |
41 | enum { none, linear, logarithmic } type; | |
42 | int64_t logarithmic_buckets; | |
43 | int64_t linear_low; | |
44 | int64_t linear_high; | |
45 | int64_t linear_step; | |
07c17d67 GH |
46 | bool operator==(statistic_decl const & other) |
47 | { | |
48 | return type == other.type | |
49 | && logarithmic_buckets == other.logarithmic_buckets | |
50 | && linear_low == other.linear_low | |
51 | && linear_high == other.linear_high | |
52 | && linear_step == other.linear_step; | |
53 | } | |
177a8ead FCE |
54 | }; |
55 | ||
56 | ||
57 | struct systemtap_session | |
58 | { | |
59 | systemtap_session (); | |
60 | ||
61 | // command line args | |
62 | std::vector<std::string> include_path; | |
63 | std::vector<std::string> macros; | |
64 | std::vector<std::string> args; | |
65 | std::string kernel_release; | |
44ce8ed5 | 66 | std::string architecture; |
177a8ead FCE |
67 | std::string runtime_path; |
68 | std::string module_name; | |
69 | std::string output_file; | |
70 | std::string cmd; | |
71 | int target_pid; | |
72 | int last_pass; | |
b0ee93c4 | 73 | unsigned verbose; |
4b17d6af | 74 | unsigned timing; |
177a8ead FCE |
75 | bool keep_tmpdir; |
76 | bool guru_mode; | |
77 | bool bulk_mode; | |
cbfbbf69 | 78 | bool unoptimized; |
f272aacc | 79 | bool merge; |
177a8ead | 80 | int buffer_size; |
47dd066d | 81 | unsigned perfmon; |
177a8ead FCE |
82 | |
83 | // temporary directory for module builds etc. | |
84 | // hazardous - it is "rm -rf"'d at exit | |
85 | std::string tmpdir; | |
86 | std::string translated_source; // C source code | |
87 | ||
88 | match_node* pattern_root; | |
89 | void register_library_aliases(); | |
90 | ||
91 | // parse trees for the various script files | |
92 | stapfile* user_file; | |
93 | std::vector<stapfile*> library_files; | |
94 | ||
95 | // resolved globals/functions/probes for the run as a whole | |
96 | std::vector<stapfile*> files; | |
97 | std::vector<vardecl*> globals; | |
98 | std::vector<functiondecl*> functions; | |
dc38c0ae | 99 | derived_probe_group_container probes; |
177a8ead FCE |
100 | std::vector<embeddedcode*> embeds; |
101 | std::map<std::string, statistic_decl> stat_decls; | |
102 | // XXX: vector<*> instead please? | |
103 | ||
104 | // module-referencing file handles | |
105 | std::map<std::string,int> module_fds; | |
106 | ||
107 | // unparser data | |
108 | translator_output* op; | |
109 | unparser* up; | |
110 | ||
111 | unsigned num_errors; | |
112 | // void print_error (const parse_error& e); | |
113 | void print_error (const semantic_error& e); | |
114 | }; | |
115 | ||
116 | ||
117 | #endif // SESSION_H |