]> sourceware.org Git - systemtap.git/blame - session.h
2006-12-18 Josh Stone <joshua.i.stone@intel.com>
[systemtap.git] / session.h
CommitLineData
177a8ead 1// -*- C++ -*-
b20febf3 2// Copyright (C) 2005, 2006 Red Hat Inc.
177a8ead
FCE
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
12#include <string>
13#include <vector>
14#include <iostream>
15#include <sstream>
16#include <map>
17
1d3a40b6
DS
18extern "C" {
19#include <elfutils/libdw.h>
20}
21
177a8ead
FCE
22
23// forward decls for all referenced systemtap types
24struct match_node;
25struct stapfile;
26struct vardecl;
27struct functiondecl;
b20febf3
FCE
28struct derived_probe;
29struct be_derived_probe_group;
30struct dwarf_derived_probe_group;
31struct timer_derived_probe_group;
32struct profile_derived_probe_group;
33struct mark_derived_probe_group;
34struct hrtimer_derived_probe_group;
35struct perfmon_derived_probe_group;
177a8ead
FCE
36struct embeddedcode;
37struct translator_output;
38struct unparser;
39struct semantic_error;
40
41
42// XXX: a generalized form of this descriptor could be associated with
43// a vardecl instead of out here at the systemtap_session level.
44struct statistic_decl
45{
46 statistic_decl()
47 : type(none),
48 logarithmic_buckets(0),
49 linear_low(0), linear_high(0), linear_step(0)
50 {}
51 enum { none, linear, logarithmic } type;
52 int64_t logarithmic_buckets;
53 int64_t linear_low;
54 int64_t linear_high;
55 int64_t linear_step;
07c17d67
GH
56 bool operator==(statistic_decl const & other)
57 {
58 return type == other.type
59 && logarithmic_buckets == other.logarithmic_buckets
60 && linear_low == other.linear_low
61 && linear_high == other.linear_high
62 && linear_step == other.linear_step;
63 }
177a8ead
FCE
64};
65
66
67struct systemtap_session
68{
69 systemtap_session ();
b20febf3 70 // NB: new POD members likely need to be explicitly cleared in the ctor.
177a8ead
FCE
71
72 // command line args
73 std::vector<std::string> include_path;
74 std::vector<std::string> macros;
75 std::vector<std::string> args;
76 std::string kernel_release;
197a4d62 77 std::string kernel_base_release;
44ce8ed5 78 std::string architecture;
177a8ead 79 std::string runtime_path;
1b78aef5 80 std::string data_path;
177a8ead
FCE
81 std::string module_name;
82 std::string output_file;
83 std::string cmd;
84 int target_pid;
85 int last_pass;
b0ee93c4 86 unsigned verbose;
4b17d6af 87 unsigned timing;
177a8ead
FCE
88 bool keep_tmpdir;
89 bool guru_mode;
90 bool bulk_mode;
cbfbbf69 91 bool unoptimized;
f272aacc 92 bool merge;
177a8ead 93 int buffer_size;
47dd066d 94 unsigned perfmon;
f1bad60c 95 bool symtab;
177a8ead 96
1b78aef5
DS
97 // Cache data
98 bool use_cache;
99 std::string cache_path;
100 std::string hash_path;
101
177a8ead
FCE
102 // temporary directory for module builds etc.
103 // hazardous - it is "rm -rf"'d at exit
104 std::string tmpdir;
105 std::string translated_source; // C source code
106
107 match_node* pattern_root;
108 void register_library_aliases();
109
110 // parse trees for the various script files
111 stapfile* user_file;
112 std::vector<stapfile*> library_files;
113
114 // resolved globals/functions/probes for the run as a whole
115 std::vector<stapfile*> files;
116 std::vector<vardecl*> globals;
117 std::vector<functiondecl*> functions;
b20febf3 118 std::vector<derived_probe*> probes; // see also *_probes groups below
177a8ead
FCE
119 std::vector<embeddedcode*> embeds;
120 std::map<std::string, statistic_decl> stat_decls;
121 // XXX: vector<*> instead please?
122
b20febf3
FCE
123 // Every probe in these groups must also appear in the
124 // session.probes vector.
125 be_derived_probe_group* be_derived_probes;
126 dwarf_derived_probe_group* dwarf_derived_probes;
127 timer_derived_probe_group* timer_derived_probes;
128 profile_derived_probe_group* profile_derived_probes;
129 mark_derived_probe_group* mark_derived_probes;
130 hrtimer_derived_probe_group* hrtimer_derived_probes;
131 perfmon_derived_probe_group* perfmon_derived_probes;
177a8ead
FCE
132
133 // unparser data
134 translator_output* op;
135 unparser* up;
136
1d3a40b6
DS
137 // kprobes_text data
138 bool kprobes_text_initialized;
139 Dwarf_Addr kprobes_text_start;
140 Dwarf_Addr kprobes_text_end;
141
177a8ead
FCE
142 unsigned num_errors;
143 // void print_error (const parse_error& e);
144 void print_error (const semantic_error& e);
b20febf3
FCE
145
146 // reNB: new POD members likely need to be explicitly cleared in the ctor.
177a8ead
FCE
147};
148
149
150#endif // SESSION_H
This page took 0.04506 seconds and 5 git commands to generate.