aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris E Ferron <chris.e.ferron@linux.intel.com>2012-10-24 15:53:41 -0700
committerChris E Ferron <chris.e.ferron@linux.intel.com>2012-10-24 15:53:41 -0700
commite0e99320abfe54e0ffb2c3a510a5fc4e202f238b (patch)
tree64c4accf5fed35868791cfa51274b5914e708bc4
parentc8e4a622b92511bc66778c905d9a876f84058348 (diff)
downloadpowertop-2.0-v2-e0e99320abfe54e0ffb2c3a510a5fc4e202f238b.tar.gz
Added a "type" field to the abstract to be used in its identification and set along with the number.
Added the "field" to reporting, so that the type and number are used from the abstract rather then hard coding the type in reporting. Update TO-DO list while I was at it.
-rw-r--r--TODO2
-rw-r--r--src/cpu/cpu.cpp32
-rw-r--r--src/cpu/cpu.h7
3 files changed, 24 insertions, 17 deletions
diff --git a/TODO b/TODO
index 7e704af..6735b82 100644
--- a/TODO
+++ b/TODO
@@ -6,7 +6,6 @@ Needed for 2.2
* audio calibration? Need appropriate sample
* reporting for workload mode
* Add GPU stats to reports [csv,html]
-* In tunables suggest writing min_power to all SATA ports
Nice to Have
@@ -19,3 +18,4 @@ NCURSES STUB (anyone who may care to do this)
DONE for 2.2
----------------------------------
* interactive mode scrolling
+* In tunables suggest writing min_power to all SATA ports
diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
index e65d828..18cbffc 100644
--- a/src/cpu/cpu.cpp
+++ b/src/cpu/cpu.cpp
@@ -87,6 +87,7 @@ static class abstract_cpu * new_package(int package, int cpu, char * vendor, int
ret = new class cpu_package;
ret->set_number(package, cpu);
+ ret->set_type("Package");
ret->childcount = 0;
sprintf(packagename, _("cpu package %i"), cpu);
@@ -122,6 +123,7 @@ static class abstract_cpu * new_core(int core, int cpu, char * vendor, int famil
ret = new class cpu_core;
ret->set_number(core, cpu);
ret->childcount = 0;
+ ret->set_type("Core");
return ret;
}
@@ -132,6 +134,7 @@ static class abstract_cpu * new_i965_gpu(void)
ret = new class i965_core;
ret->childcount = 0;
+ ret->set_type("GPU");
return ret;
}
@@ -162,6 +165,7 @@ static class abstract_cpu * new_cpu(int number, char * vendor, int family, int m
if (!ret)
ret = new class cpu_linux;
ret->set_number(number, number);
+ ret->set_type("CPU");
ret->childcount = 0;
return ret;
@@ -239,7 +243,7 @@ static void handle_i965_gpu(void)
package = system_level.children[0];
-
+
core_number = package->children.size();
if (package->children.size() <= core_number)
@@ -314,7 +318,7 @@ void enumerate_cpus(void)
if (number >= 0) {
handle_one_cpu(number, vendor, family, model);
set_max_cpu(number);
- number = -2;
+ number = -2;
}
}
}
@@ -430,7 +434,7 @@ void report_display_cpu_cstates(void)
if (line == LEVEL_HEADER) {
if (first_core) {
report.begin_cell(CELL_FIRST_PACKAGE_HEADER);
- report.addf(__("Package %i"), _package->get_number());
+ report.addf(__("%s %i"), _package->get_type(), _package->get_number());
} else {
report.begin_cell(CELL_EMPTY_PACKAGE_HEADER);
report.add_empty_cell();
@@ -454,10 +458,10 @@ void report_display_cpu_cstates(void)
if (line == LEVEL_HEADER) {
report.begin_cell(CELL_CORE_HEADER);
- report.addf(__("Core %i"), _core->get_number());
- } else {
- report.begin_cell(CELL_STATE_NAME);
- report.add(_core->fill_cstate_name(line, buffer));
+ report.addf(__("%s %i"), _core->get_type(), _core->get_number());
+ } else {
+ report.begin_cell(CELL_STATE_NAME);
+ report.add(_core->fill_cstate_name(line, buffer));
report.begin_cell(CELL_CORE_STATE_VALUE);
report.add(_core->fill_cstate_line(line, buffer2));
}
@@ -474,7 +478,7 @@ void report_display_cpu_cstates(void)
report.set_cpu_number(cpu);
if (line == LEVEL_HEADER) {
report.begin_cell(CELL_CPU_CSTATE_HEADER);
- report.addf(__("CPU %i"), _cpu->get_number());
+ report.addf(__("%s %i"), _cpu->get_type(), _cpu->get_number());
continue;
}
@@ -507,10 +511,10 @@ void report_display_cpu_pstates(void)
int line;
class abstract_cpu *_package, * _core, * _cpu;
unsigned int i, pstates_num;
-
+
for (i = 0, pstates_num = 0; i < all_cpus.size(); i++)
if (all_cpus[i] && all_cpus[i]->pstates.size() > pstates_num)
- pstates_num = all_cpus[i]->pstates.size();
+ pstates_num = all_cpus[i]->pstates.size();
report.begin_section(SECTION_CPUFREQ);
report.add_header("Processor Frequency Report");
@@ -544,7 +548,7 @@ void report_display_cpu_pstates(void)
if (first_core) {
if (line == LEVEL_HEADER) {
report.begin_cell(CELL_FIRST_PACKAGE_HEADER);
- report.addf(__("Package %i"), _package->get_number());
+ report.addf(__("%s %i"), _package->get_type(), _package->get_number());
} else {
report.begin_cell(CELL_STATE_NAME);
report.add(_package->fill_pstate_name(line, buffer));
@@ -564,7 +568,7 @@ void report_display_cpu_pstates(void)
buffer2[0] = 0;
if (line == LEVEL_HEADER) {
report.begin_cell(CELL_CORE_HEADER);
- report.addf(__("Core %i"), _core->get_number());
+ report.addf(__("%s %i"), _core->get_type(), _core->get_number());
} else {
report.begin_cell(CELL_STATE_NAME);
report.add(_core->fill_pstate_name(line, buffer));
@@ -585,7 +589,7 @@ void report_display_cpu_pstates(void)
report.set_cpu_number(cpu);
if (line == LEVEL_HEADER) {
report.begin_cell(CELL_CPU_PSTATE_HEADER);
- report.addf(__("CPU %i"), _cpu->get_number());
+ report.addf(__("%s %i"), _cpu->get_type(), _cpu->get_number());
continue;
}
@@ -763,7 +767,7 @@ void perf_power_bundle::handle_trace_point(void *trace, int cpunr, uint64_t time
cpu->go_idle(time);
}
- if (strcmp(event->name, "power_frequency") == 0
+ if (strcmp(event->name, "power_frequency") == 0
|| strcmp(event->name, "cpu_frequency") == 0){
ret = pevent_get_field_val(NULL, event, "state", &rec, &val, 0);
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 13340a2..4480b11 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -88,6 +88,7 @@ public:
uint64_t total_stamp;
int number;
int childcount;
+ const char* name;
bool idle, old_idle;
uint64_t current_frequency;
uint64_t effective_frequency;
@@ -101,8 +102,10 @@ public:
class abstract_cpu *parent;
- void set_number(int _number, int cpu) {this->number = _number; this->first_cpu = cpu;};
- int get_number(void) { return number; };
+ void set_number(int _number, int cpu) {this->number = _number; this->first_cpu = cpu;};
+ void set_type(const char* _name) {this->name = _name;};
+ int get_number(void) { return number; };
+ const char* get_type(void) { return name; };
virtual void measurement_start(void);
virtual void measurement_end(void);