Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[fb7fe6]: gui / oprof_start.h Maximize Restore History

Download this file

oprof_start.h    163 lines (131 with data), 4.4 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
/* COPYRIGHT (C) 2001 Philippe Elie
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef OPROF_START_H
#define OPROF_START_H
#include <vector>
#include "ui/oprof_start.base.h"
#include "oprof_start_config.h"
#include "oprof_start_util.h"
#include "persistent_config.h"
#include "op_hw_config.h"
#include "op_events.h"
#include "op_events_desc.h"
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
u8 val;
/// unit mask values if applicable
const op_unit_mask * unit;
/// unit mask descriptions if applicable
const op_unit_desc * um_desc;
/// 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();
/// select the System.map filename
void choose_system_map_filename();
/// flush profiler
void on_flush_profiler_data();
/// start profiler
void on_start_profiler();
/// stop profiler
void on_stop_profiler();
/// the counter combo has been activated
void counter_selected(int);
/// an event has been selected
void event_selected(QListViewItem *);
/// the mouse is over an event
void event_over(QListViewItem *);
/// enabled has been changed
void enabled_toggled(bool);
/// close the dialog
void accept();
/// WM hide event
void closeEvent(QCloseEvent * e);
/// timer event
void timerEvent(QTimerEvent * e);
private:
/// find an event description by name
const op_event_descr & locate_event(std::string const & name);
/// 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(struct op_event_descr const * descrp);
/// hide unit mask widgets
void hide_masks(void);
/// update the counter combo at given position
void set_counter_combo(uint);
/// load the event config file
void load_event_config_file(uint ctr);
/// save the event config file
bool save_event_config_file(uint ctr);
/// load the extra config file
void load_config_file();
/// save the extra config file
bool save_config_file();
/// validator for event count
QIntValidator* event_count_validator;
/// all available events for this hardware
std::vector<op_event_descr> v_events;
/// the current counter in the GUI
uint current_ctr;
/// current event selections for each counter
struct op_event_descr const * current_event[OP_MAX_COUNTERS];
/// current event configs for each counter
persistent_config_t<event_setting> event_cfgs[OP_MAX_COUNTERS];
/// enabled status for each counter
bool ctr_enabled[OP_MAX_COUNTERS];
/// current config
config_setting config;
/// the expansion of "~" directory
std::string user_dir;
/// CPU type
op_cpu cpu_type;
/// CPU speed in MHz
unsigned long 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