[7e4a10]: gui / oprof_start.h  Maximize  Restore  History

Download this file

171 lines (132 with data), 4.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**
* @file oprof_start.h
* The GUI start main class
*
* @remark Copyright 2002 OProfile authors
* @remark Read the file COPYING
*
* @author Philippe Elie
* @author John Levon
*/
#ifndef OPROF_START_H
#define OPROF_START_H
#include <vector>
#include <map>
#include <set>
#include "config.h"
#include "ui/oprof_start.base.h"
#include "oprof_start_config.h"
#include "op_events.h"
#ifndef QT3_SUPPORT
#define Q3ListViewItem QListViewItem
#endif
class QIntValidator;
class QListViewItem;
class QTimerEvent;
/// a struct describing a particular event type
struct op_event_descr {
op_event_descr();
/// bit mask of allowed counters
uint counter_mask;
/// hardware event number
u32 val;
/// unit mask values if applicable
op_unit_mask const * unit;
/// name of event
std::string name;
/// description of event
std::string help_str;
/// minimum counter value
uint min_count;
};
class oprof_start : public oprof_start_base
{
Q_OBJECT
public:
oprof_start();
protected slots:
/// select the kernel image filename
void choose_kernel_filename();
/// flush profiler
void on_flush_profiler_data();
/// start profiler
void on_start_profiler();
/// stop profiler
void on_stop_profiler();
/// events selection change
void event_selected();
/// the mouse is over an event
void event_over(Q3ListViewItem *);
/// state of separate_kernel_cb changed
void on_separate_kernel_cb_changed(int);
/// reset sample files
void on_reset_sample_files();
/// close the dialog
void accept();
/// WM hide event
void closeEvent(QCloseEvent * e);
/// timer event
void timerEvent(QTimerEvent * e);
private:
/// the counter combo has been activated
void fill_events_listbox();
/// fill the event details and gui setup
void fill_events();
/// find an event description by name
op_event_descr const & locate_event(std::string const & name) const;
/// update config on user change
void record_selected_event_config();
/// update config and validate
bool record_config();
/// calculate unit mask for given event and unit mask part
void get_unit_mask_part(op_event_descr const & descr, uint num, bool selected, uint & mask);
/// calculate unit mask for given event
uint get_unit_mask(op_event_descr const & descr);
/// set the unit mask widgets for given event
void setup_unit_masks(op_event_descr const & descr);
/// return the maximum perf counter value for the current cpu type
uint max_perf_count() const;
/// show an event's settings
void display_event(op_event_descr const & descrp);
/// hide unit mask widgets
void hide_masks(void);
/// read the events set in daemonrc
void read_set_events();
/// use the default event
void setup_default_event();
/// load the extra config file
void load_config_file();
/// save the config
bool save_config();
/// redraw the event list by changing icon status
void draw_event_list();
/// return true if item is selectable or already selected
bool is_selectable_event(Q3ListViewItem * item);
/// try to alloc counters for the selected_events
bool alloc_selected_events() const;
/// validator for event count
QIntValidator* event_count_validator;
/// all available events for this hardware
std::vector<op_event_descr> v_events;
/// current event configs for each counter
typedef std::map<std::string, event_setting> event_setting_map;
event_setting_map event_cfgs;
/// The currently selected events. We must track this because
/// with multiple selection listbox QT doesn't allow to know
/// what is the last selected item. events_selected() update it
std::set<Q3ListViewItem *> selected_events;
Q3ListViewItem * current_event;
/// current config
config_setting config;
/// the expansion of "~" directory
std::string user_dir;
/// CPU type
op_cpu cpu_type;
/// CPU speed in MHz
double cpu_speed;
/// total number of available HW counters
uint op_nr_counters;
/// Total number of samples for this run
unsigned long total_nr_interrupts;
};
#endif // OPROF_START_H

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks