3 * The GUI start main class
5 * @remark Copyright 2002 OProfile authors
6 * @remark Read the file COPYING
8 * @author Philippe Elie
21 #include "ui/oprof_start.base.h"
22 #include "oprof_start_config.h"
24 #include "op_events.h"
27 #define Q3ListViewItem QListViewItem
34 /// a struct describing a particular event type
35 struct op_event_descr {
38 /// bit mask of allowed counters
40 /// hardware event number
42 /// unit mask values if applicable
43 op_unit_mask const * unit;
46 /// description of event
48 /// minimum counter value
52 class oprof_start : public oprof_start_base
60 /// select the kernel image filename
61 void choose_kernel_filename();
63 void on_flush_profiler_data();
65 void on_start_profiler();
67 void on_stop_profiler();
68 /// events selection change
69 void event_selected();
70 /// the mouse is over an event
71 void event_over(Q3ListViewItem *);
72 /// state of separate_kernel_cb changed
73 void on_separate_kernel_cb_changed(int);
74 /// reset sample files
75 void on_reset_sample_files();
81 void closeEvent(QCloseEvent * e);
84 void timerEvent(QTimerEvent * e);
87 /// the counter combo has been activated
88 void fill_events_listbox();
90 /// fill the event details and gui setup
93 /// find an event description by name
94 op_event_descr const & locate_event(std::string const & name) const;
96 /// update config on user change
97 void record_selected_event_config();
98 /// update config and validate
101 /// calculate unit mask for given event and unit mask part
102 void get_unit_mask_part(op_event_descr const & descr, uint num, bool selected, uint & mask);
103 /// calculate unit mask for given event
104 uint get_unit_mask(op_event_descr const & descr);
105 /// set the unit mask widgets for given event
106 void setup_unit_masks(op_event_descr const & descr);
108 /// return the maximum perf counter value for the current cpu type
109 uint max_perf_count() const;
111 /// show an event's settings
112 void display_event(op_event_descr const & descrp);
114 /// hide unit mask widgets
115 void hide_masks(void);
117 /// read the events set in daemonrc
118 void read_set_events();
119 /// use the default event
120 void setup_default_event();
121 /// load the extra config file
122 void load_config_file();
126 /// redraw the event list by changing icon status
127 void draw_event_list();
129 /// return true if item is selectable or already selected
130 bool is_selectable_event(Q3ListViewItem * item);
132 /// try to alloc counters for the selected_events
133 bool alloc_selected_events() const;
135 /// validator for event count
136 QIntValidator* event_count_validator;
138 /// all available events for this hardware
139 std::vector<op_event_descr> v_events;
141 /// current event configs for each counter
142 typedef std::map<std::string, event_setting> event_setting_map;
143 event_setting_map event_cfgs;
145 /// The currently selected events. We must track this because
146 /// with multiple selection listbox QT doesn't allow to know
147 /// what is the last selected item. events_selected() update it
148 std::set<Q3ListViewItem *> selected_events;
149 Q3ListViewItem * current_event;
152 config_setting config;
154 /// the expansion of "~" directory
155 std::string user_dir;
163 /// total number of available HW counters
166 /// Total number of samples for this run
167 unsigned long total_nr_interrupts;
170 #endif // OPROF_START_H