Skip to contentSkip to conversation

Report Redesign

PATCH Superseded Alexandra Yates 2 participants 32 messages Oct 30, 2013 – Oct 31, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Alexandra Yates

author
#0 lore raw

cover Report Redesign

This patches are to be applied post release 2.5.

This set of patches include the redesign changes for HTML
and CSV reports. Additionally, includes removing the suggestion to use on demand cpu frequency governor. This feature was removed because the Intel P-States driver is the Intel recommended method for CPU frequency.

Alexandra Yates (29):
report-formater-html: add logo
report: call powertop logo
html-report: add title and div tags
report: report maker add title and div
report-csv: title, div, logo, header
report-html: summary list and navigation
report-maker: navigation & summary
report-csv: Added navigation & summary list
report-html: Table generation
report-maker: modular table generation
report-csv: modular table
report: Logo and system Information
report-html-css: html 5 and css for new design
report-summary: enable html and csv new styles
report: redesign html menu
report: Cpu Idle section redesigned html & csv
report: Fixed html summary & menu colapse styles
report: CPU Frequency html & csv
report: redesign System Information csv and html
report: redesign Device Power Report css & html
report: Redesign Device Activity css & html
report: cleanup csv title and unused vars
report: report tuning with new desig html csv
report-html: fixed not hidding sections errors
report: fixed empty SW settings in need of tunning
report: design batery discharge/system baseline
report: conditional runs ncurses & cpu html report
report: logo size & menu compatibility
tunables: removed on-demand cpu frequency governor

 PowerTop.png                         |  Bin 0 -> 6975 bytes
 src/Makefile.am                      |    1 +
 src/cpu/cpu.cpp                      |  327 ++++++++++++++++++++++++----------
 src/devices/device.cpp               |   81 +++++----
 src/devlist.cpp                      |   44 +++--
 src/main.cpp                         |    7 +-
 src/powertop.css                     |  287 +++++++++++++----------------
 src/process/do_process.cpp           |  233 ++++++++++++++----------
 src/report/report-data-html.cpp      |  118 ++++++++++++
 src/report/report-data-html.h        |   69 +++++++
 src/report/report-formatter-csv.cpp  |   92 +++++++++-
 src/report/report-formatter-csv.h    |   15 +-
 src/report/report-formatter-html.cpp |  123 ++++++++++++-
 src/report/report-formatter-html.h   |   16 +-
 src/report/report-formatter.h        |   13 ++
 src/report/report-maker.cpp          |   57 ++++++
 src/report/report-maker.h            |   13 +-
 src/report/report.cpp                |   83 +++++----
 src/tuning/cpufreq.cpp               |  213 ----------------------
 src/tuning/cpufreq.h                 |   50 ------
 src/tuning/tuning.cpp                |  130 ++++++++------
 21 files changed, 1213 insertions(+), 759 deletions(-)
 create mode 100644 PowerTop.png
 create mode 100644 src/report/report-data-html.cpp
 create mode 100644 src/report/report-data-html.h
 delete mode 100644 src/tuning/cpufreq.cpp
 delete mode 100644 src/tuning/cpufreq.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/29 report-formater-html: add logo

Adds html new logo implementation

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 PowerTop.png                         |  Bin 0 -> 6975 bytes
 src/report/report-formatter-html.cpp |   18 ++++++++++++++++++
 src/report/report-formatter-html.h   |    5 +++++
 3 files changed, 23 insertions(+)
 create mode 100644 PowerTop.png
PowerTop.png new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..d8474107f189549d45cf854db5c801ffd935dbb9
GIT binary patch
src/report/report-formatter-html.cpp +18 -0
index 5851575..79a0c35 100644
@@ -463,3 +463,21 @@ report_formatter_html::set_cpu_number(int nr)
 
 	cpu_nr = nr;
 }
+
+void
+report_formatter_html::add_logo()
+{
+	add_exact("<img alt=\"PowerTop\" class=\"pwtop_logo\" src=\"./PowerTop.png\">");
+}
+
+void
+report_formatter_html::add_header()
+{
+	add_exact("<header id=\"main_header\">\n");
+}
+
+void
+report_formatter_html::end_hheader()
+{
+	add_exact("</header>\n\n");
+}
src/report/report-formatter-html.h +5 -0
index 4d00efe..1ade760 100644
@@ -82,6 +82,11 @@ public:
 
 	void set_cpu_number(int nr);
 
+	/* Report Style */
+	void add_logo();
+	void add_header();
+	void end_hheader();
+
 private:
 	/* Document structure related functions */
 	void init_markup();
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/29 report: call powertop logo

In reply to Alexandra Yates

Implements add_logo in report generator

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter.h |    5 +++++
 src/report/report-maker.cpp   |   21 +++++++++++++++++++++
 src/report/report-maker.h     |    5 +++++
 3 files changed, 31 insertions(+)
src/report/report-formatter.h +5 -0
index d532f30..449fae7 100644
@@ -60,6 +60,11 @@ public:
 
 	/* For quad-colouring CPU tables in HTML */
 	virtual void set_cpu_number(int nr) {}
+
+	/* *** Report Style *** */
+	virtual void add_logo() {}
+	virtual void add_header() {}
+	virtual void end_hheader() {}
 };
 
 #endif /* _REPORT_FORMATTER_H_ */
src/report/report-maker.cpp +21 -0
index 59e83d9..8eba618 100644
@@ -329,3 +329,24 @@ report_maker::end_paragraph()
 	paragraph_opened = false;
 	formatter->end_paragraph();
 }
+
+
+/* *** Report Style *** */
+void
+report_maker::add_logo()
+{
+	formatter->add_logo();
+}
+
+void
+report_maker::add_header()
+{
+	formatter->add_header();
+}
+
+void
+report_maker::end_hheader()
+{
+	formatter->end_hheader();
+}
+
src/report/report-maker.h +5 -0
index 75e0d06..fab9589 100644
@@ -192,6 +192,11 @@ public:
 
 	void set_cpu_number(int nr);
 
+	/* *** Report Style *** */
+	void add_header();
+	void end_hheader();
+	void add_logo();
+
 private:
 	void setup_report_formatter();
 
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH 3/29 html-report: add title and div tags

In reply to Alexandra Yates

Implements add_title and add_div methods that pass css attributes for modular styling.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-data-html.h        |    4 ++++
 src/report/report-formatter-html.cpp |   33 +++++++++++++++++++++++++++++++++
 src/report/report-formatter-html.h   |    5 ++++-
 3 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 src/report/report-data-html.h
src/report/report-data-html.h new file +4 -0
new file mode 100644
index 0000000..70ccbdb
@@ -0,0 +1,4 @@
+struct tag_attr {
+	const char *css_class;
+	const char *css_id;
+};
src/report/report-formatter-html.cpp +33 -0
index 79a0c35..db21c8c 100644
@@ -464,6 +464,8 @@ report_formatter_html::set_cpu_number(int nr)
 	cpu_nr = nr;
 }
 
+
+/* Report Style */
 void
 report_formatter_html::add_logo()
 {
@@ -481,3 +483,34 @@ report_formatter_html::end_hheader()
 {
 	add_exact("</header>\n\n");
 }
+void
+report_formatter_html::add_div(struct tag_attr * div_attr)
+{
+	std::string empty="";
+	std::string tmp_str;
+
+	if (div_attr->css_class == empty && div_attr->css_id == empty)
+	add_exact("<div>\n");
+
+	else if (div_attr->css_class == empty && div_attr->css_id != empty)
+	addf_exact("<div id=\"%s\">\n", div_attr->css_id);
+
+	else if (div_attr->css_class != empty && div_attr->css_id == empty)
+	addf_exact("<div class=\"%s\">\n", div_attr->css_class);
+
+	else if (div_attr->css_class != empty && div_attr->css_id != empty)
+	addf_exact("<div class=\"%s\" id=\"%s\">\n", div_attr->css_class, div_attr->css_id);
+}
+
+void
+report_formatter_html::end_div()
+{
+	add_exact("</div>\n");
+}
+
+void
+report_formatter_html::add_title(struct tag_attr *title_att, const char *title)
+{
+	addf_exact("<h2 class=\"%s\"> %s </h2>\n", title_att->css_class, title);
+}
+
src/report/report-formatter-html.h +4 -1
index 1ade760..0f508d3 100644
@@ -29,7 +29,7 @@
 #include <string>
 
 #include "report-formatter-base.h"
-
+#include "report-data-html.h"
 /* Whether to replace " and ' in HTML by &quot; and &apos; respectively */
 /*#define REPORT_HTML_ESCAPE_QUOTES*/
 
@@ -86,6 +86,9 @@ public:
 	void add_logo();
 	void add_header();
 	void end_hheader();
+	void add_div(struct tag_attr *div_attr);
+	void end_div();
+	void add_title(struct tag_attr *title_att, const char *title);
 
 private:
 	/* Document structure related functions */
Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH 4/29 report: report maker add title and div

In reply to Alexandra Yates

Calls to add a title and add a division from report maker using report object to the generated report.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter.h |    3 +++
 src/report/report-maker.cpp   |   18 ++++++++++++++++++
 src/report/report-maker.h     |    3 +++
 3 files changed, 24 insertions(+)
src/report/report-formatter.h +3 -0
index 449fae7..78382d8 100644
@@ -65,6 +65,9 @@ public:
 	virtual void add_logo() {}
 	virtual void add_header() {}
 	virtual void end_hheader() {}
+	virtual void add_div(struct tag_attr *div_attr) {}
+	virtual void end_div() {}
+	virtual void add_title(struct tag_attr *att_title, const char *title) {}
 };
 
 #endif /* _REPORT_FORMATTER_H_ */
src/report/report-maker.cpp +18 -0
index 8eba618..ff87f1e 100644
@@ -350,3 +350,21 @@ report_maker::end_hheader()
 	formatter->end_hheader();
 }
 
+void
+report_maker::add_title(struct tag_attr *att_title, const char *title)
+{
+	formatter->add_title(att_title, title);
+}
+
+void
+report_maker::add_div(struct tag_attr * div_attr)
+{
+	formatter->add_div(div_attr);
+}
+
+void
+report_maker::end_div()
+{
+	formatter->end_div();
+}
+
src/report/report-maker.h +3 -0
index fab9589..0c17635 100644
@@ -196,6 +196,9 @@ public:
 	void add_header();
 	void end_hheader();
 	void add_logo();
+	void add_div(struct tag_attr *div_attr);
+	void end_div();
+	void add_title(struct tag_attr *att_title, const char *title);
 
 private:
 	void setup_report_formatter();
Signature · 1 line
1.7.9.5
author
#5 lore raw

PATCH 5/29 report-csv: title, div, logo, header

In reply to Alexandra Yates

Implements csv report functionality to add title, division, header, and logo.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter-csv.cpp |   39 +++++++++++++++++++++++++++++++++++
 src/report/report-formatter-csv.h   |    8 +++++++
 2 files changed, 47 insertions(+)
src/report/report-formatter-csv.cpp +39 -0
index cd70d91..bd9dfd3 100644
@@ -222,3 +222,42 @@ report_formatter_csv::set_cpu_number(int nr UNUSED)
 {
 	/* Do nothing */
 }
+
+/* Report Style */
+void
+report_formatter_csv::add_header()
+{
+	add_exact("\n====================================================================\n");
+}
+
+void
+report_formatter_csv::end_hheader()
+{
+	/* Do nothing */
+}
+
+void
+report_formatter_csv::add_logo()
+{
+	add_exact("\t\t\tP o w e r T o p\n");
+}
+
+
+void
+report_formatter_csv::add_div(struct tag_attr * div_attr)
+{
+	add_exact("\n");
+}
+
+void
+report_formatter_csv::end_div()
+{
+	/*Do nothing*/
+}
+
+void
+report_formatter_csv::add_title(struct tag_attr *title_att, const char *title)
+{
+	add_exact("____________________________________________________________________\n");
+	addf_exact(" *  *  *   %s   *  *  *\n", title);
+}
src/report/report-formatter-csv.h +8 -0
index 8dd2976..2c1c0fd 100644
@@ -71,6 +71,14 @@ public:
 
 	void set_cpu_number(int nr);
 
+	/* Report Style */
+	void add_logo();
+	void add_header();
+	void end_hheader();
+	void add_div(struct tag_attr *div_attr);
+	void end_div();
+	void add_title(struct tag_attr *title_att, const char *title);
+
 private:
 	void add_doc_header();
 
Signature · 1 line
1.7.9.5
author
#6 lore raw

PATCH 6/29 report-html: summary list and navigation

In reply to Alexandra Yates

Generates the html tags to add navigation and summary including css attribute support.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter-html.cpp |   18 ++++++++++++++++++
 src/report/report-formatter-html.h   |    2 ++
 2 files changed, 20 insertions(+)
src/report/report-formatter-html.cpp +18 -0
index db21c8c..8038181 100644
@@ -514,3 +514,21 @@ report_formatter_html::add_title(struct tag_attr *title_att, const char *title)
 	addf_exact("<h2 class=\"%s\"> %s </h2>\n", title_att->css_class, title);
 }
 
+void
+report_formatter_html::add_navigation()
+{
+	add_exact("<br/><nav id=\"main_menu\"> </nav>\n");
+}
+
+void
+report_formatter_html::add_summary_list(std::string *list, int size)
+{
+	int i;
+	add_exact("<div><br/> <ul>\n");
+	for (i=0; i < size; i+=2){
+		addf_exact("<li class=\"summary_list\"> <b> %s </b> %s </li>",
+				list[i].c_str(), list[i+1].c_str());
+	}
+	add_exact("</ul> </div> <br />\n");
+}
+
src/report/report-formatter-html.h +2 -0
index 0f508d3..261e0dd 100644
@@ -89,6 +89,8 @@ public:
 	void add_div(struct tag_attr *div_attr);
 	void end_div();
 	void add_title(struct tag_attr *title_att, const char *title);
+	void add_navigation();
+	void add_summary_list(std::string *list, int size);
 
 private:
 	/* Document structure related functions */
Signature · 1 line
1.7.9.5
author
#7 lore raw

PATCH 7/29 report-maker: navigation & summary

In reply to Alexandra Yates

Implements methods to generate navigation and summary from the report object.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter.h |    3 +++
 src/report/report-maker.cpp   |   12 ++++++++++++
 src/report/report-maker.h     |    4 +++-
 3 files changed, 18 insertions(+), 1 deletion(-)
src/report/report-formatter.h +3 -0
index 78382d8..5e5b8d7 100644
@@ -27,6 +27,7 @@
 #define _REPORT_FORMATTER_H_
 
 #include "report-maker.h"
+using namespace std;
 
 class report_formatter
 {
@@ -68,6 +69,8 @@ public:
 	virtual void add_div(struct tag_attr *div_attr) {}
 	virtual void end_div() {}
 	virtual void add_title(struct tag_attr *att_title, const char *title) {}
+	virtual void add_navigation() {}
+	virtual void add_summary_list(string *list, int size) {}
 };
 
 #endif /* _REPORT_FORMATTER_H_ */
src/report/report-maker.cpp +12 -0
index ff87f1e..ccfbec4 100644
@@ -368,3 +368,15 @@ report_maker::end_div()
 	formatter->end_div();
 }
 
+void
+report_maker::add_navigation()
+{
+	formatter->add_navigation();
+}
+
+void
+report_maker::add_summary_list(string *list, int size)
+{
+	formatter->add_summary_list(list, size);
+}
+
src/report/report-maker.h +3 -1
index 0c17635..6e5f4d1 100644
@@ -73,7 +73,7 @@
 #include <stdarg.h>
 
 #include <string>
-
+using namespace std;
 /* Conditional gettext. We need original strings for CSV. */
 #define __(STRING) \
 	((report.get_type() == REPORT_CSV) ? (STRING) : gettext(STRING))
@@ -199,6 +199,8 @@ public:
 	void add_div(struct tag_attr *div_attr);
 	void end_div();
 	void add_title(struct tag_attr *att_title, const char *title);
+	void add_navigation();
+	void add_summary_list(string *list, int size);
 
 private:
 	void setup_report_formatter();
Signature · 1 line
1.7.9.5
author
#8 lore raw

PATCH 8/29 report-csv: Added navigation & summary list

In reply to Alexandra Yates

Implements csv report functionality to add navigation and summary on the csv report.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter-csv.cpp |   22 ++++++++++++++++++++--
 src/report/report-formatter-csv.h   |    6 +++++-
 2 files changed, 25 insertions(+), 3 deletions(-)
src/report/report-formatter-csv.cpp +20 -2
index bd9dfd3..2981940 100644
@@ -189,10 +189,10 @@ report_formatter_csv::end_paragraph()
 
 /* ************************************************************************ */
 
-std::string
+string
 report_formatter_csv::escape_string(const char *str)
 {
-	std::string res;
+	string res;
 
 	assert(str);
 
@@ -261,3 +261,21 @@ report_formatter_csv::add_title(struct tag_attr *title_att, const char *title)
 	add_exact("____________________________________________________________________\n");
 	addf_exact(" *  *  *   %s   *  *  *\n", title);
 }
+
+void
+report_formatter_csv::add_navigation()
+{
+	/* No nav in csv - thinking on table of contents */
+}
+
+void
+report_formatter_csv::add_summary_list(string *list, int size)
+{
+	int i;
+	add_exact("\n");
+	for (i=0; i < size; i+=2){
+		addf_exact("%s %s,", list[i].c_str(), list[i+1].c_str());
+	}
+	add_exact("\n");
+}
+
src/report/report-formatter-csv.h +5 -1
index 2c1c0fd..daf723e 100644
@@ -42,6 +42,8 @@
 /* Whether to escape with quotes empty cell values with spaces */
 /*#define REPORT_CSV_SPACE_NEED_QUOTES*/
 
+using namespace std;
+
 /* ************************************************************************ */
 
 class report_formatter_csv: public report_formatter_string_base
@@ -78,13 +80,15 @@ public:
 	void add_div(struct tag_attr *div_attr);
 	void end_div();
 	void add_title(struct tag_attr *title_att, const char *title);
+	void add_navigation();
+	void add_summary_list(string *list, int size);
 
 private:
 	void add_doc_header();
 
 	void add_quotes();
 
-	std::string escape_string(const char *str);
+	string escape_string(const char *str);
 
 	bool csv_need_quotes;
 	size_t table_cell_number, text_start;
Signature · 1 line
1.7.9.5
author
#9 lore raw

PATCH 9/29 report-html: Table generation

In reply to Alexandra Yates

Generates modular html tables using table_size, css_attributes, and a set of data. The data is stored in a single dimesional array, using row major order.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-data-html.h        |   18 +++++++++++
 src/report/report-formatter-html.cpp |   59 +++++++++++++++++++++++++++++++---
 src/report/report-formatter-html.h   |    9 ++++--
 3 files changed, 79 insertions(+), 7 deletions(-)
src/report/report-data-html.h +18 -0
index 70ccbdb..282d8b5 100644
@@ -2,3 +2,21 @@ struct tag_attr {
 	const char *css_class;
 	const char *css_id;
 };
+/* T:Top, L:Left, TL:Top-Left, TLC: Top-Left-Center */
+enum position { T, L, TL, TC, TLC };
+
+struct table_attributes {
+	const char *table_class;
+	const char *td_class;
+	const char *tr_class;
+	const char *th_class;
+	position pos_table_title;
+	int title_mod;
+};
+
+
+struct table_size {
+	int rows;
+	int cols;
+};
+
src/report/report-formatter-html.cpp +54 -5

82 lines not on this page · raw message

src/report/report-formatter-html.h +7 -2
index 261e0dd..d625ced 100644
@@ -30,6 +30,9 @@
 
 #include "report-formatter-base.h"
 #include "report-data-html.h"
+
+using namespace std;
+
 /* Whether to replace " and ' in HTML by &quot; and &apos; respectively */
 /*#define REPORT_HTML_ESCAPE_QUOTES*/
 
@@ -90,7 +93,9 @@ public:
 	void end_div();
 	void add_title(struct tag_attr *title_att, const char *title);
 	void add_navigation();
-	void add_summary_list(std::string *list, int size);
+	void add_summary_list(string *list, int size);
+	void add_table(string *system_data, struct table_size *size,
+			struct table_attributes *tb_attr);
 
 private:
 	/* Document structure related functions */
@@ -113,7 +118,7 @@ private:
 	void add_doc_header();
 	void add_doc_footer();
 
-	std::string escape_string(const char *str);
+	string escape_string(const char *str);
 
 	html_section sections[SECTION_MAX];
 	html_table tables[TABLE_MAX];
Signature · 1 line
1.7.9.5
author
#10 lore raw

PATCH 10/29 report-maker: modular table generation

In reply to Alexandra Yates

Generates a modular table when using the report maker object. It passess table_size, css_attributes, and data. The data is stored in a single dimensional array using row major order.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter.h |    3 +++
 src/report/report-maker.cpp   |    7 +++++++
 src/report/report-maker.h     |    2 ++
 3 files changed, 12 insertions(+)
src/report/report-formatter.h +3 -0
index 5e5b8d7..4fe2c42 100644
@@ -71,6 +71,9 @@ public:
 	virtual void add_title(struct tag_attr *att_title, const char *title) {}
 	virtual void add_navigation() {}
 	virtual void add_summary_list(string *list, int size) {}
+	virtual void add_table(string *system_data,
+			struct table_size *size,
+			struct table_attributes *tb_attr)     {}
 };
 
 #endif /* _REPORT_FORMATTER_H_ */
src/report/report-maker.cpp +7 -0
index ccfbec4..031b692 100644
@@ -380,3 +380,10 @@ report_maker::add_summary_list(string *list, int size)
 	formatter->add_summary_list(list, size);
 }
 
+void
+report_maker::add_table(string *system_data, struct table_size *size,
+		struct table_attributes *tb_attr)
+{
+	formatter->add_table(system_data, size, tb_attr);
+}
+
src/report/report-maker.h +2 -0
index 6e5f4d1..e75c99a 100644
@@ -201,6 +201,8 @@ public:
 	void add_title(struct tag_attr *att_title, const char *title);
 	void add_navigation();
 	void add_summary_list(string *list, int size);
+	void add_table(string *system_data, struct table_size *size,
+			struct table_attributes *tb_attr);
 
 private:
 	void setup_report_formatter();
Signature · 1 line
1.7.9.5
author
#11 lore raw

PATCH 11/29 report-csv: modular table

In reply to Alexandra Yates

Generates a modular table to the csv report using the table_size and a set of data stored in a single dimensional array stored in row major order.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter-csv.cpp |   28 ++++++++++++++++++++++++++++
 src/report/report-formatter-csv.h   |    2 ++
 2 files changed, 30 insertions(+)
src/report/report-formatter-csv.cpp +28 -0
index 2981940..b9336ad 100644
@@ -33,6 +33,7 @@
 #include <stdarg.h>
 
 #include "report-formatter-csv.h"
+#include "report-data-html.h"
 
 static const char report_csv_header[] = "PowerTOP Report";
 
@@ -279,3 +280,30 @@ report_formatter_csv::add_summary_list(string *list, int size)
 	add_exact("\n");
 }
 
+void
+report_formatter_csv::add_table(string *system_data, struct table_size *size,
+		struct table_attributes* tb_attr)
+{
+	int i, j;
+	int offset=0;
+	string tmp_str="";
+	int empty_row=0;
+	add_exact("\n");
+	for (i=0; i < size->rows; i++){
+		for (j=0; j < size->cols; j++){
+			offset = i * (size->cols) + j;
+			tmp_str=system_data[offset];
+
+			if(tmp_str == "&nbsp;")
+				empty_row+=1;
+			else{
+				addf_exact("%s", system_data[offset].c_str());
+				if(j < (size->cols - 1))
+					add_exact(",");
+			}
+		}
+		if(empty_row < size->cols)
+		add_exact("\n");
+		empty_row=0;
+	}
+}
src/report/report-formatter-csv.h +2 -0
index daf723e..994b765 100644
@@ -82,6 +82,8 @@ public:
 	void add_title(struct tag_attr *title_att, const char *title);
 	void add_navigation();
 	void add_summary_list(string *list, int size);
+	void add_table(string *system_data, struct table_size *size,
+			struct table_attributes *tb_attr);
 
 private:
 	void add_doc_header();
Signature · 1 line
1.7.9.5
author
#12 lore raw

PATCH 12/29 report: Logo and system Information

In reply to Alexandra Yates

Reports PowerTop logo and the system information table with the redesign css and organization.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/Makefile.am                      |    1 +
 src/report/report-data-html.cpp      |   25 +++++++++++
 src/report/report-data-html.h        |   16 +++++--
 src/report/report-formatter-csv.cpp  |   13 +++---
 src/report/report-formatter-csv.h    |    3 +-
 src/report/report-formatter-html.cpp |    8 ++--
 src/report/report-formatter-html.h   |    3 +-
 src/report/report-formatter.h        |    1 -
 src/report/report-maker.cpp          |    5 +--
 src/report/report-maker.h            |    3 +-
 src/report/report.cpp                |   81 ++++++++++++++++++++--------------
 11 files changed, 100 insertions(+), 59 deletions(-)
 create mode 100644 src/report/report-data-html.cpp
src/Makefile.am +1 -0
index 19950a1..e19b606 100644
@@ -31,6 +31,7 @@ powertop_SOURCES = parameters/persistent.cpp parameters/learn.cpp parameters/par
 		report/report-formatter-base.cpp report/report-formatter-base.h \
 		report/report-formatter-csv.cpp report/report-formatter-csv.h \
 		report/report-formatter-html.cpp report/report-formatter-html.h \
+		report/report-data-html.cpp report/report-data-html.h \
 		main.cpp css.h powertop.css cpu/intel_gpu.cpp \
 		cpu/rapl/rapl_interface.cpp cpu/cpu_rapl_device.cpp cpu/rapl/rapl_interface.h\
 		cpu/dram_rapl_device.cpp devices/gpu_rapl_device.cpp cpu/cpu_rapl_device.h \
src/report/report-data-html.cpp new file +25 -0
new file mode 100644
index 0000000..e150961
@@ -0,0 +1,25 @@
+#include "report-data-html.h"
+
+void init_div(struct tag_attr *div_attr, const char *css_class, const char *css_id)
+{
+	div_attr->css_class=css_class;
+	div_attr->css_id=css_id;
+}
+
+void
+init_top_table_attr(struct table_attributes *table_css, int rows, int cols){
+	table_css->pos_table_title=L;
+	table_css->table_class="emphasis1";
+	table_css->th_class="table_sysinfo";
+	table_css->td_class="";
+	table_css->tr_class="";
+	table_css->title_mod=0;
+	table_css->rows=rows;
+	table_css->cols=cols;
+}
+
+void init_title_attr(struct tag_attr *title_attr)
+{
+	title_attr->css_class="content_title";
+	title_attr->css_id="";
+}
src/report/report-data-html.h +12 -4
index 282d8b5..7db7d4b 100644
@@ -12,11 +12,19 @@ struct table_attributes {
 	const char *th_class;
 	position pos_table_title;
 	int title_mod;
-};
-
-
-struct table_size {
 	int rows;
 	int cols;
 };
 
+/* Definition of css atributes for the cases that apply to powertop
+ * html report
+ * */
+
+void
+init_div(struct tag_attr *div_attr, const char *css_class, const char *css_id);
+
+void
+init_top_table_attr(struct table_attributes *table_css, int rows, int cols);
+
+void
+init_title_attr(struct tag_attr *title_attr);
src/report/report-formatter-csv.cpp +6 -7
index b9336ad..086cc79 100644
@@ -281,28 +281,27 @@ report_formatter_csv::add_summary_list(string *list, int size)
 }
 
 void
-report_formatter_csv::add_table(string *system_data, struct table_size *size,
-		struct table_attributes* tb_attr)
+report_formatter_csv::add_table(string *system_data, struct table_attributes* tb_attr)
 {
 	int i, j;
 	int offset=0;
 	string tmp_str="";
 	int empty_row=0;
 	add_exact("\n");
-	for (i=0; i < size->rows; i++){
-		for (j=0; j < size->cols; j++){
-			offset = i * (size->cols) + j;
+	for (i=0; i < tb_attr->rows; i++){
+		for (j=0; j < tb_attr->cols; j++){
+			offset = i * (tb_attr->cols) + j;
 			tmp_str=system_data[offset];
 
 			if(tmp_str == "&nbsp;")
 				empty_row+=1;
 			else{
 				addf_exact("%s", system_data[offset].c_str());
-				if(j < (size->cols - 1))
+				if(j < (tb_attr->cols - 1))
 					add_exact(",");
 			}
 		}
-		if(empty_row < size->cols)
+		if(empty_row < tb_attr->cols)
 		add_exact("\n");
 		empty_row=0;
 	}
src/report/report-formatter-csv.h +1 -2
index 994b765..198f597 100644
@@ -82,8 +82,7 @@ public:
 	void add_title(struct tag_attr *title_att, const char *title);
 	void add_navigation();
 	void add_summary_list(string *list, int size);
-	void add_table(string *system_data, struct table_size *size,
-			struct table_attributes *tb_attr);
+	void add_table(string *system_data, struct table_attributes *tb_attr);
 
 private:
 	void add_doc_header();
src/report/report-formatter-html.cpp +4 -4
index 5920d9c..fa758ec 100644
@@ -534,7 +534,7 @@ report_formatter_html::add_summary_list(string *list, int size)
 
 
 void
-report_formatter_html::add_table(string *system_data, struct table_size *size, struct table_attributes* tb_attr)
+report_formatter_html::add_table(string *system_data, struct table_attributes* tb_attr)
 {
 	int i, j;
 	int offset=0;
@@ -545,14 +545,14 @@ report_formatter_html::add_table(string *system_data, struct table_size *size, s
 	else
 		addf_exact("<table class=\"%s\">\n", tb_attr->table_class);
 
-	for (i=0; i < size->rows; i++){
+	for (i=0; i < tb_attr->rows; i++){
 		if (tb_attr->tr_class == empty)
 			add_exact("<tr> ");
 		else
 			addf_exact("<tr class=\"%s\"> ", tb_attr->tr_class);
 
-		for (j=0; j < size->cols; j++){
-			offset = i * (size->cols) + j;
+		for (j=0; j < tb_attr->cols; j++){
+			offset = i * (tb_attr->cols) + j;
 
 			if (tb_attr->pos_table_title == T &&  i==0)
 				addf_exact("<th class=\"%s\"> %s </th> ",
src/report/report-formatter-html.h +1 -2
index d625ced..1ad1c68 100644
@@ -94,8 +94,7 @@ public:
 	void add_title(struct tag_attr *title_att, const char *title);
 	void add_navigation();
 	void add_summary_list(string *list, int size);
-	void add_table(string *system_data, struct table_size *size,
-			struct table_attributes *tb_attr);
+	void add_table(string *system_data, struct table_attributes *tb_attr);
 
 private:
 	/* Document structure related functions */
src/report/report-formatter.h +0 -1
index 4fe2c42..7984dc5 100644
@@ -72,7 +72,6 @@ public:
 	virtual void add_navigation() {}
 	virtual void add_summary_list(string *list, int size) {}
 	virtual void add_table(string *system_data,
-			struct table_size *size,
 			struct table_attributes *tb_attr)     {}
 };
 
src/report/report-maker.cpp +2 -3
index 031b692..0fd133c 100644
@@ -381,9 +381,8 @@ report_maker::add_summary_list(string *list, int size)
 }
 
 void
-report_maker::add_table(string *system_data, struct table_size *size,
-		struct table_attributes *tb_attr)
+report_maker::add_table(string *system_data, struct table_attributes *tb_attr)
 {
-	formatter->add_table(system_data, size, tb_attr);
+	formatter->add_table(system_data, tb_attr);
 }
 
src/report/report-maker.h +1 -2
index e75c99a..f6897cf 100644
@@ -201,8 +201,7 @@ public:
 	void add_title(struct tag_attr *att_title, const char *title);
 	void add_navigation();
 	void add_summary_list(string *list, int size);
-	void add_table(string *system_data, struct table_size *size,
-			struct table_attributes *tb_attr);
+	void add_table(string *system_data, struct table_attributes *tb_attr);
 
 private:
 	void setup_report_formatter();
src/report/report.cpp +47 -34

102 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#13 lore raw

PATCH 13/29 report-html-css: html 5 and css for new design

In reply to Alexandra Yates

Redesign css for effective readability of html report.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/powertop.css |  216 ++++++++++++++++++++++--------------------------------
 1 file changed, 86 insertions(+), 130 deletions(-)
src/powertop.css +86 -130
index 6d43e07..69e78f9 100644
@@ -1,13 +1,13 @@
-<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
-<html>
+<!DOCTYPE html>
+<html lang='en'>
 <head>
 <title>PowerTOP report</title>
-<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">
+<meta http-equiv='content-type' content='text/html;charset=utf-8'>
+
 <script type='text/javascript'>
 
 var powertop = {
  blocks: {
-  system: 'System Info',
   summary: 'Summary',
   cpuidle: 'CPU Idle',
   cpufreq: 'CPU Frequency',
@@ -67,190 +67,146 @@ var powertop = {
    powertop.toggle('summary');
  }
 }
-
 </script>
+
 <style type='text/css'>
-table
-{
-	background-color: #F8F8F8;
-	color: black;
+/* General CSS */
+*{
+	margin:0px;
+	padding:0px;
 }
 
-th
-{
-	text-align: right;
+#main_container{
+	width: 960px;
+	margin: 2px auto;
 }
-th.device
-{
-	text-align: left;
+
+/* Top logo & system table css */
+#main_header{
+	min-width: 960px;
+	display:block;
+}
+
+img.pwtop_logo{
+	float:left;
+	height:90px;
+	width: 400px;
 }
-th.process
+
+.sys_info
 {
+	float: left;
+	height:116px;
+	width:450px;
+	font-size: 12px;
+	display: inline;
+	position relative;
 	text-align: left;
 }
 
-th.tunable
-{
+th{
 	text-align: left;
 }
 
-td.package_odd
+/* CSS Main Content */
+
+.content_title
 {
-	background-color: #E0ffE0;
-	color: black;
-	text-align: right;
+	color: #296629;
+	padding:0px;
+	margin:2px;
 }
-td.package_even
-{
-	background-color: #F0ffF0;
-	color: black;
-	text-align: right;
+
+#chart_div{
+	float: left;
 }
 
-td.core_even
+.small
 {
-	background-color: #F0ffF0;
-	color: black;
-	text-align: right;
+	font-size: 10px;
 }
 
-td.core_odd
+table.emphasis2
 {
-	background-color: #E0E0ff;
-	color: black;
-	text-align: right;
+	font-size: 13px;
+	max-width:95%;
 }
 
-td.cpu_even_freq
-{
-	background-color: #E2E2E2;
-	color: black;
+
+th.emph_title {
+	padding:5px;
 }
 
-td.cpu_odd_freq
-{
-	background-color: #F4f4F4;
-	color: black;
+tr.emph1:nth-child(odd) {
+	background: #ffffff;
 }
 
-td.cpu_even_even
-{
-	background-color: #E0E0f0;
-	color: black;
-	text-align: right;
+tr.emph1:nth-child(even) {
+	background: #ebebeb;
 }
 
-td.cpu_even_odd
-{
-	background-color: #F0f0F0;
-	color: black;
-	text-align: right;
+tr.tune:nth-child(odd) {
+	background: #fffcfc;
 }
-td.cpu_odd_even
-{
-	background-color: #E0E0ff;
-	color: black;
-	text-align: right;
+tr.tune:nth-child(even) {
+	background: #fff0f0;
 }
 
-td.cpu_odd_odd
-{
-	background-color: #F0ffF0;
-	color: black;
-	text-align: right;
+td.no_wrap:first-child {
+	white-space:nowrap;
 }
 
-tr.device_odd
-{
-	background-color: #E0E0E0;
-	color: black;
+.side_by_side_left{
+	float:left;
 }
-tr.device_even
-{
-	background-color: #F0f0F0;
-	color: black;
+.side_by_side_right{
+	float:right;
 }
 
-tr.process_odd
-{
-	background-color: #E0E0E0;
-	color: black;
+#device{
+	display: inline-block;
 }
-tr.process_even
-{
-	background-color: #F0f0F0;
-	color: black;
+.clear_block{
+	clear:both;
 }
 
-td.device_power
-{
-	text-align: right;
+td.package{
+	background-color: #e0ddfa; /*purple*/
 }
 
-td.process_power
-{
-	text-align: right;
+td.core{
+	background-color: #d1ddff; /*ccebff; /*blue*/
 }
 
-td.device_util
-{
-	text-align: right;
+td.cpu{
+	background-color: #ffffeb; /* yellow */
 }
 
-tr.tunable_odd
-{
-	background-color: #E0E0E0;
-	color: black;
-}
-tr.tunable_even
-{
-	background-color: #F0f0F0;
-	color: black;
+th.title{
+	text-align: center;
+	/*border-bottom: 1px solid #666;*/
 }
 
-tr.tunable_odd_bad
-{
-	background-color: #FFE0E0;
-	color: black;
-}
-tr.tunable_even_bad
-{
-	background-color: #FFf0F0;
-	color: black;
-}
 
-tr.system_odd
-{
-	background-color: #E0E0E0;
-	color: black;
-}
-tr.system_even
+li.summary_list
 {
-	background-color: #F0f0F0;
-	color: black;
+	display: inline;
+	padding: 5px;
+	background-color: #f6f6f9;
+	font-size: 12px;
 }
 
-tr.device_odd
-{
-	background-color: #E0E0E0;
-	color: black;
-}
-tr.device_even
-{
-	background-color: #F0f0F0;
-	color: black;
-}
+
+
+/*menu css*/
 
 body {
 	background-color: #eee; /* Background color */
-	color: #222;            /* Foreground color used for text */
+	color: #222;            /* Font color */
 	font-family: Helvetica;
 	font-size: 14px;
-	margin: 0;              /* Amount of negative space around the
-                                   outside of the body */
-	padding: 0;             /* Amount of negative space around the
-                                   inside of the body */
 }
+
 #top {
 	background-color: #ccc;
 	border-bottom: 1px solid #666;
Signature · 1 line
1.7.9.5
author
#14 lore raw

PATCH 14/29 report-summary: enable html and csv new styles

In reply to Alexandra Yates

Generates html and csv report with redesign summary.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/process/do_process.cpp          |  122 ++++++++++++++++++++++-------------
 src/report/report-data-html.cpp     |   25 +++++++
 src/report/report-data-html.h       |   13 ++++
 src/report/report-formatter-csv.cpp |    4 +-
 4 files changed, 118 insertions(+), 46 deletions(-)
src/process/do_process.cpp +77 -45
index d81a2a9..44dd5e0 100644
@@ -29,6 +29,7 @@
 #include "processdevice.h"
 #include "../lib.h"
 #include "../report/report.h"
+#include "../report/report-data-html.h"
 #include "../report/report-maker.h"
 #include "../devlist.h"
 
@@ -235,7 +236,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
 		field = pevent_find_any_field(event, "next_comm");
 		if (!field || !(field->flags & FIELD_IS_STRING))
 			return; /* ?? */
-	
+
 		next_comm = get_pevent_field_str(trace, event, field);
 
 		ret = pevent_get_field_val(NULL, event, "next_pid", &rec, &val, 0);
@@ -294,8 +295,8 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
 	}
 	else if (strcmp(event->name, "sched_wakeup") == 0) {
 		class power_consumer *from = NULL;
-		class process *dest_proc = NULL;  
-		class process *from_proc = NULL; 
+		class process *dest_proc = NULL;
+		class process *from_proc = NULL;
 		const char *comm;
 		int flags;
 		int pid;
@@ -324,7 +325,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
 		field = pevent_find_any_field(event, "comm");
 
 		if (!field || !(field->flags & FIELD_IS_STRING))
- 			return; 
+ 			return;
 
 		comm = get_pevent_field_str(trace, event, field);
 
@@ -633,7 +634,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
 
 		ret = pevent_get_field_val(NULL, event, "dev", &rec, &val, 0);
 		if (ret < 0)
-			
+
 			return;
 		dev = (int)val;
 
@@ -787,7 +788,7 @@ void process_update_display(void)
 	WINDOW *win;
 	double pw;
 	int tl;
-	int tlt; 
+	int tlt;
 	int tlr;
 
 	int show_power;
@@ -979,7 +980,7 @@ void report_process_update_display(void)
 			report.begin_cell(CELL_SOFTWARE_POWER);
 			report.add(power);
 		}
-		
+
 		report.begin_cell(CELL_SOFTWARE_POWER);
 		report.add(usage);
 		report.begin_cell(CELL_SOFTWARE_POWER);
@@ -1002,39 +1003,61 @@ void report_summary(void)
 	unsigned int i;
 	unsigned int total;
 	int show_power;
+	int rows, cols, idx;
 
 	sort(all_power.begin(), all_power.end(), power_cpu_sort);
 	show_power = global_power_valid();
 
-	report.begin_section(SECTION_SUMMARY);
-	report.add_header(__("Power Consumption Summary"));
-	report.begin_paragraph();
-	report.addf("%.1f %s, %.1f %s, %.1f %s, %.1f %s %.1f%% %s",
-		    total_wakeups(),	 __("wakeups/second"),
-		    total_gpu_ops(),	 __("GPU ops/second"),
-		    total_disk_hits(),	 __("VFS ops/sec"),
-		    total_xwakes(),	 __("GFX wakes/sec and"),
-		    total_cpu_time() * 100, __("CPU use"));
-
-	report.begin_table(TABLE_WIDE);
-	report.begin_row();
-	if (show_power) {
-		report.begin_cell(CELL_SUMMARY_HEADER);
-		report.add(__("Power est."));
-	}
+	/* div attr css_class and css_id */
+	tag_attr div_attr;
+	init_div(&div_attr, "summary", "");
 
-	report.begin_cell(CELL_SUMMARY_HEADER);
-	report.add(__("Usage"));
-	report.begin_cell(CELL_SUMMARY_HEADER);
-	report.add(__("Events/s"));
-	report.begin_cell(CELL_SUMMARY_CATEGORY);
-	report.add(__("Category"));
-	report.begin_cell(CELL_SUMMARY_DESCRIPTION);
-	report.add(__("Description"));
 
+	/* Set table attributes, rows, and cols */
+	cols=4;
+	if (show_power)
+		cols=5;
+	idx=cols;
 	total = all_power.size();
 	if (total > 10)
 		total = 10;
+	rows=total+1;
+	table_attributes std_table_css;
+	init_std_table_attr(&std_table_css, rows, cols);
+
+	/* Set title attributes */
+	tag_attr title_attr;
+	init_title_attr(&title_attr);
+
+	/* Set array for summary */
+	int summary_size =12;
+	string summary[summary_size];
+	summary[0]="Target:";
+	summary[1]="1 units/s";
+	summary[2]="System: ";
+	summary[3]= double_to_string(total_wakeups());
+	summary[3].append(" wakeup/s");
+	summary[4]="CPU: ";
+	summary[5]= double_to_string(total_cpu_time()*100);
+	summary[5].append("\% usage");
+	summary[6]="GPU:";
+	summary[7]=double_to_string(total_gpu_ops());
+	summary[7].append(" ops/s");
+	summary[8]="GFX:";
+	summary[9]=double_to_string(total_xwakes());
+	summary[9].append(" wakeups/s");
+	summary[10]="VFS:";
+	summary[11]= double_to_string(total_disk_hits());
+	summary[11].append(" ops/s");
+
+	/* Set array of data in row Major order */
+	string summary_data[cols * (rows+1)];
+	summary_data[0]="Usage";
+	summary_data[1]="Events/s";
+	summary_data[2]="Category";
+	summary_data[3]="Description";
+	if (show_power)
+		summary_data[4]="PW Estimate";
 
 	for (i = 0; i < all_power.size(); i++) {
 		char power[16];
@@ -1052,7 +1075,7 @@ void report_summary(void)
 			break;
 
 		if (all_power[i]->events() == 0 && all_power[i]->usage() == 0 &&
-		    all_power[i]->Witts() == 0)
+				all_power[i]->Witts() == 0)
 			break;
 
 		usage[0] = 0;
@@ -1070,21 +1093,30 @@ void report_summary(void)
 		else if (all_power[i]->events() <= 0.3)
 			sprintf(events, "%5.2f", all_power[i]->events());
 
-		report.begin_row(ROW_SUMMARY);
-		if (show_power) {
-			report.begin_cell(CELL_SUMMARY_ITEM);
-			report.add(power);
-		}
+		summary_data[idx]=string(usage);
+		idx+=1;
 
-		report.begin_cell(CELL_SUMMARY_ITEM);
-		report.add(usage);
-		report.begin_cell(CELL_SUMMARY_ITEM);
-		report.add(events);
-		report.begin_cell();
-		report.add(name);
-		report.begin_cell();
-		report.add(pretty_print(all_power[i]->description(), descr, 128));
+		summary_data[idx]=string(events);
+		idx+=1;
+
+		summary_data[idx]=string(name);
+		idx+=1;
+
+		summary_data[idx]=string(pretty_print(all_power[i]->description(), descr, 128));
+		idx+=1;
+
+		if (show_power){
+			summary_data[idx]=power;
+			idx+=1;
+		}
 	}
+
+	/* Report Summary for all */
+	report.add_summary_list(summary, summary_size);
+	report.add_div(&div_attr);
+	report.add_title(&title_attr, "Top 10 Power Consumers");
+	report.add_table(summary_data, &std_table_css);
+	report.end_div();
 }
 
 
src/report/report-data-html.cpp +25 -0
index e150961..ed0d692 100644
@@ -23,3 +23,28 @@ void init_title_attr(struct tag_attr *title_attr)
 	title_attr->css_class="content_title";
 	title_attr->css_id="";
 }
+
+void init_std_table_attr(struct table_attributes *table_css, int rows, int cols){
+	table_css->table_class="emphasis2";
+	table_css->tr_class="emph1";
+	table_css->th_class="emph_title";
+	table_css->td_class="";
+	table_css->pos_table_title=T;
+	table_css->title_mod=0;
+	table_css->rows=rows;
+	table_css->cols=cols;
+}
+
+/* Other Helper Functions */
+string
+double_to_string(double dval)
+{
+	ostringstream dtmp;
+	string str;
+	dtmp << dval;
+	str= dtmp.str();
+	str = str.substr(0, str.find(".")+2);
+	return str;
+}
+
+
src/report/report-data-html.h +13 -0
index 7db7d4b..524cd24 100644
@@ -1,3 +1,8 @@
+#include <string>
+#include <sstream>
+
+using namespace std;
+
 struct tag_attr {
 	const char *css_class;
 	const char *css_id;
@@ -28,3 +33,11 @@ init_top_table_attr(struct table_attributes *table_css, int rows, int cols);
 
 void
 init_title_attr(struct tag_attr *title_attr);
+
+void
+init_std_table_attr(struct table_attributes *table_css, int rows, int cols);
+
+/* Other helper functions */
+string
+double_to_string(double dval);
+
src/report/report-formatter-csv.cpp +3 -1
index 086cc79..facdd4d 100644
@@ -275,7 +275,9 @@ report_formatter_csv::add_summary_list(string *list, int size)
 	int i;
 	add_exact("\n");
 	for (i=0; i < size; i+=2){
-		addf_exact("%s %s,", list[i].c_str(), list[i+1].c_str());
+		addf_exact("%s %s", list[i].c_str(), list[i+1].c_str());
+		if(i < (size - 1))
+			add_exact(",");
 	}
 	add_exact("\n");
 }
Signature · 1 line
1.7.9.5
author
#15 lore raw

PATCH 15/29 report: redesign html menu

In reply to Alexandra Yates

Changes menu design to align under logo and system Information following dashboard design rules for readability and functionality.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/powertop.css |   57 +++++++++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 29 deletions(-)
src/powertop.css +28 -29
index 69e78f9..8cbc137 100644
@@ -35,7 +35,7 @@ var powertop = {
   return x;
  },
  setupbuttons: function() {
-   var t = document.getElementById('top');
+   var t = document.getElementById('main_menu');
    if (t) {
      for (var b in powertop.blocks) {
        t.appendChild(powertop.newbutton(b, powertop.blocks[b]));
@@ -207,51 +207,50 @@ body {
 	font-size: 14px;
 }
 
-#top {
-	background-color: #ccc;
-	border-bottom: 1px solid #666;
-	color: #222;
-	display: block;
-	font-size: 20px;
+#main_menu {
+	display: inline-block;
 	font-weight: bold;
-	padding: 10px 0;
+	padding: 5px 0;
 	text-align: center;
-	text-decoration: none;
-	text-shadow: 0px 1px 1px #fff;
 	background-image: -webkit-gradient(linear, left top, left bottom,
-						from(#ccc), to(#999));
+		from(#aaa), to(#eee));
+	background: -moz-linear-gradient(top,  #aaa,  #eee);
 }
 
 
-#top div {
-	height: 30px;
+#main_menu div {
+	font-size: 12px;
 	font-weight: bold;
-	text-align: center;
 	color: white;
-	text-shadow: rgba(0,0,0,0.6) 0px -1px 1px;
-	line-height: 28px;
-	border-width:0px 8px 0px 8px;
 }
-#top div.nav_button {
- display: inline;
- cursor: pointer;
- padding: 0.3em 0.5em;
- margin: 0 0.2em;
+
+#main_menu div.nav_button {
+	margin: 0 0.2em;
+	display: inline;
+	cursor: pointer;
+	color: #223232;
+	font-size: 13px;
+	font-weight: bold;
+	padding: 5px;
+	text-align: center;
+	text-decoration: none;
 }
 
 div.pressed {
-	background-color: #000000;
-	border: 1px solid #000000;
-	color: #000000;
-	border-radius: 8px;
+	border: -webkit-gradient(linear, left top, left bottom,
+		from(#b2ffb2), to(#e0ffe0));
+	border-width:0px 8px 0px 8px;
+	background: #999;
+	background-image: -webkit-gradient(linear, left top, left bottom,
+		from(#b2ffb2), to(#e0ffe0));
+	background: -moz-linear-gradient(top,  #b2ffb2,  #e0ffe0);
 }
+
 div.hide {
- display: none;
+	display: none;
 }
 </style>
 </head>
 
 <body onload='powertop.onload();'>
-<div id='top'>
-</div>
 
Signature · 1 line
1.7.9.5
author
#16 lore raw

PATCH 16/29 report: Cpu Idle section redesigned html & csv

In reply to Alexandra Yates

Enables "CPU Idle" section redisign for html and csv reports.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/cpu/cpu.cpp                 |  188 +++++++++++++++++++++++++++------------
 src/report/report-data-html.cpp |   39 ++++++++
 src/report/report-data-html.h   |   18 ++++
 3 files changed, 187 insertions(+), 58 deletions(-)
src/cpu/cpu.cpp +130 -58
index 4a7e197..ac89ec7 100644
@@ -41,6 +41,7 @@
 #include "../display.h"
 #include "../report/report.h"
 #include "../report/report-maker.h"
+#include "../report/report-data-html.h"
 
 static class abstract_cpu system_level;
 
@@ -420,122 +421,193 @@ static int get_cstates_num(void)
 
 void report_display_cpu_cstates(void)
 {
-	char buffer[512], buffer2[512];
+	char buffer[512], buffer2[512], tmp_num[50];
 	unsigned int package, core, cpu;
-	int line, cstates_num;
+	int line, cstates_num, title=0, core_num=0;
 	class abstract_cpu *_package, * _core, * _cpu;
 
 	cstates_num = get_cstates_num();
+	/* div attr css_class and css_id */
+	tag_attr div_attr;
+	init_div(&div_attr, "clear_block", "cpuidle");
+
+	/* Set Table attributes, rows, and cols */
+	table_attributes std_table_css;
+	table_size pkg_tbl_size;
+	table_size core_tbl_size;
+	table_size cpu_tbl_size;
+
+
+	/* Set Title attributes */
+	tag_attr title_attr;
+	init_title_attr(&title_attr);
 
-	report.begin_section(SECTION_CPUIDLE);
-	report.add_header("Processor Idle state report");
+	/* Report add section */
+	report.add_div(&div_attr);
+	report.add_title(&title_attr, "Processor Idle State Report");
+
+	/* Set array of data in row Major order */
+       	int idx1, idx2, idx3;
+	string tmp_str;
 
 	for (package = 0; package < system_level.children.size(); package++) {
 		bool first_core = true;
+		idx1=0;
+		idx2=0;
+		idx3=0;
 
 		_package = system_level.children[package];
 		if (!_package)
 			continue;
+		/* Tables for PKG, CORE, CPU */
+		pkg_tbl_size.cols=2;
+		pkg_tbl_size.rows= cstates_num+1;
+		string pkg_data[pkg_tbl_size.cols * pkg_tbl_size.rows];
+
+		core_tbl_size.cols=2;
+		core_tbl_size.rows=(cstates_num *_package->children.size())
+				+ _package->children.size();
+		string core_data[core_tbl_size.cols * core_tbl_size.rows];
+		int num_cpus=0;
+
+		for (core = 0; core < _package->children.size(); core++) {
+			_core = _package->children[core];
+			if (!_core)
+				continue;
+			for (cpu = 0; cpu < _core->children.size(); cpu++) {
+				if (!_cpu)
+					continue;
+				_cpu = _core->children[cpu];
+				num_cpus+=1;
+			}
+		}
+
+		cpu_tbl_size.cols=((2 * num_cpus)+1) ;
+		cpu_tbl_size.rows= cstates_num * _package->children.size();
+
+		string cpu_data[cpu_tbl_size.cols * cpu_tbl_size.rows];
 
-		report.begin_table(TABLE_WIDE);
 		for (core = 0; core < _package->children.size(); core++) {
+			cpu_data[idx3]="&nbsp;";
+			idx3+=1;
 			_core = _package->children[core];
+
 			if (!_core)
 				continue;
 
+			/* *** PKG STARTS *** */
 			for (line = LEVEL_HEADER; line <= cstates_num; line++) {
 				bool first_cpu = true;
-
 				if (!_package->has_cstate_level(line))
-					continue;
-
-				report.begin_row();
+				continue;
 				buffer[0] = 0;
 				buffer2[0] = 0;
-
 				if (line == LEVEL_HEADER) {
 					if (first_core) {
-						report.begin_cell(CELL_FIRST_PACKAGE_HEADER);
-						report.addf(__("Package %i"), _package->get_number());
-					} else {
-						report.begin_cell(CELL_EMPTY_PACKAGE_HEADER);
-						report.add_empty_cell();
+						pkg_data[idx1]="Package";
+						idx1+=1;
+						sprintf(tmp_num,"%d",  _package->get_number());
+						pkg_data[idx1]= string(tmp_num);
+						idx1+=1;
 					}
 				} else if (first_core) {
-					report.begin_cell(CELL_STATE_NAME);
-					report.add(_package->fill_cstate_name(line, buffer));
-					report.begin_cell(CELL_PACKAGE_STATE_VALUE);
-					report.add(_package->fill_cstate_line(line, buffer2));
-				} else {
-					report.begin_cell(CELL_EMPTY_PACKAGE_STATE);
-					report.add_empty_cell();
+					tmp_str=string(_package->fill_cstate_name(line, buffer));
+					pkg_data[idx1]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+					idx1+=1;
+					tmp_str=string(_package->fill_cstate_line(line, buffer2));
+					pkg_data[idx1]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+					idx1+=1;
 				}
 
-				report.begin_cell(CELL_SEPARATOR);
-				report.add_empty_cell();
-
+				/* *** CORE STARTS *** */
 				if (!_core->can_collapse()) {
 					buffer[0] = 0;
 					buffer2[0] = 0;
 
 					if (line == LEVEL_HEADER) {
-						report.begin_cell(CELL_CORE_HEADER);
 						/* Here we need to check for which core type we
-  						 * are using. Do not use the core type for the 
-  						 * report.addf as it breaks an important macro use 
-  						 * for translation decision making for the reports. 
-  						   */
-						const char* core_type = _core->get_type(); 
-					        if (core_type != NULL) {	
+						* are using. Do not use the core type for the
+						* report.addf as it breaks an important macro use
+						* for translation decision making for the reports.
+						* */
+						const char* core_type = _core->get_type();
+						if (core_type != NULL) {
 							if (strcmp(core_type, "Core") == 0 ) {
-								report.addf(__("Core %i"), _core->get_number());
+								core_data[idx2]="";
+								idx2+=1;
+								sprintf(tmp_num,"Core %d",_core->get_number());
+								core_data[idx2]=string(tmp_num);
+								idx2+=1;
+								core_num+=1;
 							} else {
-								report.addf(__("GPU %i"), _core->get_number());
-							} 
+								core_data[idx2]="";
+								idx2+=1;
+								sprintf(tmp_num,"GPU %d",_core->get_number());
+								core_data[idx2]=string(tmp_num);
+								idx2+=1;
+							}
 						}
-                                       } 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));
+					} else {
+						tmp_str=string(_core->fill_cstate_name(line, buffer));
+						core_data[idx2]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+						idx2+=1;
+						tmp_str=string(_core->fill_cstate_line(line, buffer2));
+						core_data[idx2]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+						idx2+=1;
 					}
 				}
-
-				report.begin_cell(CELL_SEPARATOR);
-				report.add_empty_cell();
-
+				// *** CPU STARTS ***
 				for (cpu = 0; cpu < _core->children.size(); cpu++) {
 					_cpu = _core->children[cpu];
+
 					if (!_cpu)
 						continue;
-
-					report.set_cpu_number(cpu);
 					if (line == LEVEL_HEADER) {
-						report.begin_cell(CELL_CPU_CSTATE_HEADER);
-						report.addf(__("CPU %i"), _cpu->get_number());
+						cpu_data[idx3] = "CPU";
+						idx3+=1;
+						sprintf(tmp_num,"%d",_cpu->get_number());
+						cpu_data[idx3]=string(tmp_num);
+						idx3+=1;
 						continue;
 					}
 
 					if (first_cpu) {
-						report.begin_cell(CELL_STATE_NAME);
-						report.add(_cpu->fill_cstate_name(line, buffer));
+						title+=1;
+						cpu_data[idx3]=(string(_cpu->fill_cstate_name(line, buffer)));
+						idx3+=1;
 						first_cpu = false;
 					}
 
 					buffer[0] = 0;
-					report.begin_cell(CELL_CPU_STATE_VALUE);
-					report.add(_cpu->fill_cstate_percentage(line, buffer));
-					report.begin_cell(CELL_CPU_STATE_VALUE);
-					if (line != LEVEL_C0)
-						report.add(_cpu->fill_cstate_time(line, buffer));
-					else
-						report.add_empty_cell();
+					tmp_str=string(_cpu->fill_cstate_percentage(line, buffer));
+					cpu_data[idx3]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+					idx3+=1;
+
+					if (line != LEVEL_C0){
+						tmp_str=string(_cpu->fill_cstate_time(line, buffer));
+						cpu_data[idx3]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+						idx3+=1;
+					} else {
+						cpu_data[idx3]="&nbsp;";
+						idx3+=1;
+					}
 				}
 			}
-
 			first_core = false;
 		}
+
+		/* Report Output */
+		title=title/core_num;
+		init_pkg_table_attr(&std_table_css, pkg_tbl_size.rows,  pkg_tbl_size.cols);
+		report.add_table(pkg_data, &std_table_css);
+		init_core_table_attr(&std_table_css, title+1, core_tbl_size.rows,
+				core_tbl_size.cols);
+		report.add_table(core_data, &std_table_css);
+		init_cpu_table_attr(&std_table_css, title+1, cpu_tbl_size.rows,
+				cpu_tbl_size.cols);
+		report.add_table(cpu_data, &std_table_css);
 	}
+	report.end_div();
 }
 
 void report_display_cpu_pstates(void)
src/report/report-data-html.cpp +39 -0
index ed0d692..28732c9 100644
@@ -35,6 +35,45 @@ void init_std_table_attr(struct table_attributes *table_css, int rows, int cols)
 	table_css->cols=cols;
 }
 
+void init_pkg_table_attr(struct table_attributes *table_css, int rows, int cols){
+	table_css->table_class="emphasis2 side_by_side_left";
+	table_css->tr_class="";
+	table_css->th_class="title";
+	table_css->td_class="package";
+	table_css->pos_table_title=T;
+	table_css->title_mod=0;
+	table_css->rows=rows;
+	table_css->cols=cols;
+}
+
+void init_core_table_attr(struct table_attributes *table_css, int title_mod,
+		int rows, int cols){
+	table_css->table_class="emphasis2 side_by_side_left";
+	table_css->tr_class="";
+	table_css->th_class="title";
+	table_css->td_class="core";
+	table_css->pos_table_title=TC;
+	table_css->title_mod=title_mod;
+	table_css->rows=rows;
+	table_css->cols=cols;
+}
+
+void init_cpu_table_attr(struct table_attributes *table_css, int title_mod,
+		int rows, int cols){
+	table_css->table_class="emphasis2 side_by_side_left";
+	table_css->tr_class="";
+	table_css->th_class="title";
+	table_css->td_class="cpu";
+	table_css->pos_table_title=TLC;
+	table_css->title_mod=title_mod;
+	table_css->rows=rows;
+	table_css->cols=cols;
+}
+
+
+
+
+
 /* Other Helper Functions */
 string
 double_to_string(double dval)
src/report/report-data-html.h +18 -0
index 524cd24..61e75c0 100644
@@ -21,6 +21,12 @@ struct table_attributes {
 	int cols;
 };
 
+struct table_size {
+	int rows;
+	int cols;
+};
+
+
 /* Definition of css atributes for the cases that apply to powertop
  * html report
  * */
@@ -37,6 +43,18 @@ init_title_attr(struct tag_attr *title_attr);
 void
 init_std_table_attr(struct table_attributes *table_css, int rows, int cols);
 
+void
+init_pkg_table_attr(struct table_attributes *table_css, int rows, int cols);
+
+void
+init_core_table_attr(struct table_attributes *table_css, int title_mod,
+		int rows, int cols);
+
+void
+init_cpu_table_attr(struct table_attributes *table_css, int title_mod,
+		int rows, int cols);
+
+
 /* Other helper functions */
 string
 double_to_string(double dval);
Signature · 1 line
1.7.9.5
author
#17 lore raw

PATCH 17/29 report: Fixed html summary & menu colapse styles

In reply to Alexandra Yates

Fixed summary to only show in the summary section. Also fixed page to avoid the menu to wrap around with the logo/system info section.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/powertop.css                     |    2 +-
 src/process/do_process.cpp           |    2 +-
 src/report/report-formatter-html.cpp |    1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
src/powertop.css +1 -1
index 8cbc137..97c15cc 100644
@@ -253,4 +253,4 @@ div.hide {
 </head>
 
 <body onload='powertop.onload();'>
-
+<div id=\"main_container\">
src/process/do_process.cpp +1 -1
index 44dd5e0..6708f12 100644
@@ -1010,7 +1010,7 @@ void report_summary(void)
 
 	/* div attr css_class and css_id */
 	tag_attr div_attr;
-	init_div(&div_attr, "summary", "");
+	init_div(&div_attr, "", "summary");
 
 
 	/* Set table attributes, rows, and cols */
src/report/report-formatter-html.cpp +1 -0
index fa758ec..210a354 100644
@@ -52,6 +52,7 @@ static const char report_html_alternative_head[] =
 /* ************************************************************************ */
 
 static const char report_html_footer[] =
+	"</div>\n"
 	"</body>\n"
 	"</html>\n";
 
Signature · 1 line
1.7.9.5
author
#18 lore raw

PATCH 18/29 report: CPU Frequency html & csv

In reply to Alexandra Yates

Enables html and csv report new stlyes for "CPU Frequency" section.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/cpu/cpu.cpp |  139 ++++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 101 insertions(+), 38 deletions(-)
src/cpu/cpu.cpp +101 -38
index ac89ec7..acb5a25 100644
@@ -612,29 +612,81 @@ void report_display_cpu_cstates(void)
 
 void report_display_cpu_pstates(void)
 {
-	char buffer[512], buffer2[512];
+	char buffer[512], buffer2[512], tmp_num[50];
 	unsigned int package, core, cpu;
 	int line;
 	class abstract_cpu *_package, * _core, * _cpu;
 	unsigned int i, pstates_num;
 
-	for (i = 0, pstates_num = 0; i < all_cpus.size(); i++)
+	/* div attr css_class and css_id */
+	tag_attr div_attr;
+	init_div(&div_attr, "clear_block", "cpufreq");
+
+	/* Set Table attributes, rows, and cols */
+	table_attributes std_table_css;
+	table_size pkg_tbl_size;
+	table_size core_tbl_size;
+	table_size cpu_tbl_size;
+
+
+	/* Set Title attributes */
+	tag_attr title_attr;
+	init_title_attr(&title_attr);
+
+	/* Report add section */
+        report.add_div(&div_attr);
+        report.add_title(&title_attr, "Processor Frequency Report");
+
+        /* Set array of data in row Major order */
+	int idx1, idx2, idx3, num_cpus=0;
+        string tmp_str;
+
+	for (i = 0, pstates_num = 0; i < all_cpus.size(); i++) {
 		if (all_cpus[i])
 			pstates_num = std::max<unsigned int>(pstates_num,
-								all_cpus[i]->pstates.size());
-
-	report.begin_section(SECTION_CPUFREQ);
-	report.add_header("Processor Frequency Report");
+				all_cpus[i]->pstates.size());
+	}
 
 	for (package = 0; package < system_level.children.size(); package++) {
 		bool first_core = true;
+		idx1=0;
+		idx2=0;
+		idx3=0;
 
 		_package = system_level.children[package];
 		if (!_package)
 			continue;
 
-		report.begin_table(TABLE_WIDE);
+		/*  Tables for PKG, CORE, CPU */
+		pkg_tbl_size.cols=2;
+		pkg_tbl_size.rows=pstates_num+2;
+		string pkg_data[pkg_tbl_size.cols * pkg_tbl_size.rows];
+
+		core_tbl_size.cols=2;
+		core_tbl_size.rows=((pstates_num+2) *_package->children.size());
+		string core_data[core_tbl_size.cols * core_tbl_size.rows];
+
+		/* PKG */
+		num_cpus=0;
+		for (core = 0; core < _package->children.size(); core++) {
+			_core = _package->children[core];
+			if (!_core)
+				continue;
+			for (cpu = 0; cpu < _core->children.size(); cpu++) {
+				if (!_cpu)
+				continue;
+				_cpu = _core->children[cpu];
+				num_cpus+=1;
+			}
+		}
+		cpu_tbl_size.cols= num_cpus+1;
+		cpu_tbl_size.rows= (pstates_num+2)* _package->children.size();
+		string cpu_data[cpu_tbl_size.cols * cpu_tbl_size.rows];
+
+		/* Core */
 		for (core = 0; core < _package->children.size(); core++) {
+			cpu_data[idx3]="&nbsp;";
+			idx3+=1;
 			_core = _package->children[core];
 			if (!_core)
 				continue;
@@ -646,75 +698,86 @@ void report_display_cpu_pstates(void)
 				bool first_cpu = true;
 
 				if (!_package->has_pstate_level(line))
-					continue;
-
-				report.begin_row();
+				continue;
 
 				buffer[0] = 0;
 				buffer2[0] = 0;
 				if (first_core) {
 					if (line == LEVEL_HEADER) {
-						report.begin_cell(CELL_FIRST_PACKAGE_HEADER);
-						report.addf(__("Package %i"), _package->get_number());
+						pkg_data[idx1]="Package";
+						idx1+=1;
+						sprintf(tmp_num,"%d",  _package->get_number());
+						pkg_data[idx1]= string(tmp_num);
+						idx1+=1;
 					} else {
-						report.begin_cell(CELL_STATE_NAME);
-						report.add(_package->fill_pstate_name(line, buffer));
-						report.begin_cell(CELL_PACKAGE_STATE_VALUE);
-						report.add(_package->fill_pstate_line(line, buffer2));
+						tmp_str=string(_package->fill_pstate_name(line, buffer));
+						pkg_data[idx1]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+						idx1+=1;
+						tmp_str=string(_package->fill_pstate_line(line, buffer2));
+						pkg_data[idx1]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+						idx1+=1;
 					}
-				} else {
-					report.begin_cell(CELL_EMPTY_PACKAGE_STATE);
-					report.add_empty_cell();
 				}
 
-				report.begin_cell(CELL_SEPARATOR);
-				report.add_empty_cell();
 
 				if (!_core->can_collapse()) {
 					buffer[0] = 0;
 					buffer2[0] = 0;
 					if (line == LEVEL_HEADER) {
-						report.begin_cell(CELL_CORE_HEADER);
-						report.addf(__("Core %i"), _core->get_number());
+						core_data[idx2]="";
+						idx2+=1;
+						sprintf(tmp_num,"Core %d",_core->get_number());
+						core_data[idx2]=string(tmp_num);
+						idx2+=1;
 					} else {
-						report.begin_cell(CELL_STATE_NAME);
-						report.add(_core->fill_pstate_name(line, buffer));
-						report.begin_cell(CELL_PACKAGE_STATE_VALUE);
-						report.add(_core->fill_pstate_line(line, buffer2));
+						tmp_str=string(_core->fill_pstate_name(line, buffer));
+						core_data[idx2]= (tmp_str=="" ? "&nbsp;" : tmp_str);
+						idx2+=1;
+						tmp_str=string(_core->fill_pstate_line(line, buffer2));
+						core_data[idx2]= (tmp_str=="" ? "&nbsp;" : tmp_str);
+						idx2+=1;
 					}
 				}
 
-				report.begin_cell(CELL_SEPARATOR);
-				report.add_empty_cell();
-
+				/* CPU */
 				for (cpu = 0; cpu < _core->children.size(); cpu++) {
 					buffer[0] = 0;
 					_cpu = _core->children[cpu];
 					if (!_cpu)
 						continue;
 
-					report.set_cpu_number(cpu);
 					if (line == LEVEL_HEADER) {
-						report.begin_cell(CELL_CPU_PSTATE_HEADER);
-						report.addf(__("CPU %i"), _cpu->get_number());
+						sprintf(tmp_num,"CPU %d",_cpu->get_number());
+						cpu_data[idx3] = string(tmp_num);
+						idx3+=1;
 						continue;
 					}
 
 					if (first_cpu) {
-						report.begin_cell(CELL_STATE_NAME);
-						report.add(_cpu->fill_pstate_name(line, buffer));
+						tmp_str=string(_cpu->fill_pstate_name(line, buffer));
+						cpu_data[idx3]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+						idx3+=1;
 						first_cpu = false;
 					}
 
 					buffer[0] = 0;
-					report.begin_cell(CELL_CPU_STATE_VALUE);
-					report.add(_cpu->fill_pstate_line(line, buffer));
+					tmp_str=string(_cpu->fill_pstate_line(line, buffer));
+					cpu_data[idx3]=(tmp_str=="" ? "&nbsp;" : tmp_str);
+					idx3+=1;
 				}
 			}
-
 			first_core = false;
 		}
+		init_pkg_table_attr(&std_table_css, pkg_tbl_size.rows, pkg_tbl_size.cols);
+		report.add_table(pkg_data, &std_table_css);
+		init_core_table_attr(&std_table_css, (pstates_num+2),
+				core_tbl_size.rows, core_tbl_size.cols);
+		report.add_table(core_data, &std_table_css);
+		init_cpu_table_attr(&std_table_css, (pstates_num+2),
+				cpu_tbl_size.rows, cpu_tbl_size.cols);
+		report.add_table(cpu_data, &std_table_css);
 	}
+	report.end_div();
 }
 
 void impl_w_display_cpu_states(int state)
Signature · 1 line
1.7.9.5
author
#19 lore raw

PATCH 19/29 report: redesign System Information csv and html

In reply to Alexandra Yates

Enabled "System Information" section for csv and html report design.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/process/do_process.cpp      |  113 ++++++++++++++++++++++-----------------
 src/report/report-data-html.cpp |   11 +++-
 src/report/report-data-html.h   |    2 +
 3 files changed, 77 insertions(+), 49 deletions(-)
src/process/do_process.cpp +65 -48
index 6708f12..c50fdd3 100644
@@ -889,42 +889,48 @@ void report_process_update_display(void)
 {
 	unsigned int i;
 	unsigned int total;
+	int show_power, cols, rows, idx;
 
-	int show_power;
-
-	sort(all_power.begin(), all_power.end(), power_cpu_sort);
-
-	show_power = global_power_valid();
+	/* div attr css_class and css_id */
+	tag_attr div_attr;
+	init_div(&div_attr, "clear_block", "software");
 
-	report.begin_section(SECTION_SOFTWARE);
-	report.add_header(__("Overview of Software Power Consumers"));
-	report.begin_table(TABLE_WIDE);
-	report.begin_row();
-	if (show_power) {
-		report.begin_cell(CELL_SOFTWARE_HEADER);
-		report.add(__("Power est."));
-	}
+	/* Set Table attributes, rows, and cols */
+	cols=7;
+	if (show_power)
+		cols=8;
 
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("Usage"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("Wakeups/s"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("GPU ops/s"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("Disk IO/s"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("GFX Wakeups/s"));
-	report.begin_cell(CELL_SOFTWARE_PROCESS);
-	report.add(__("Category"));
-	report.begin_cell(CELL_SOFTWARE_DESCRIPTION);
-	report.add(__("Description"));
+	idx=cols;
 
 	total = all_power.size();
-
 	if (total > 100)
 		total = 100;
 
+	rows=total+1;
+	table_attributes std_table_css;
+	init_nowarp_table_attr(&std_table_css, rows, cols);
+
+
+	/* Set Title attributes */
+	tag_attr title_attr;
+	init_title_attr(&title_attr);
+
+	/* Set array of data in row Major order */
+	string  software_data[cols * rows];
+	software_data[0]="Usage";
+	software_data[1]="Wakeups/s";
+	software_data[2]="GPU ops/s";
+	software_data[3]="Disk IO/s";
+	software_data[4]="GFX Wakeups/s";
+	software_data[5]="Category";
+	software_data[6]="Description";
+
+	if (show_power)
+		software_data[7]="PW Estimate";
+
+	sort(all_power.begin(), all_power.end(), power_cpu_sort);
+	show_power = global_power_valid();
+
 	for (i = 0; i < total; i++) {
 		char power[16];
 		char name[20];
@@ -943,7 +949,8 @@ void report_process_update_display(void)
 		if (strcmp(name, "Device") == 0)
 			continue;
 
-		if (all_power[i]->events() == 0 && all_power[i]->usage() == 0 && all_power[i]->Witts() == 0)
+		if (all_power[i]->events() == 0 && all_power[i]->usage() == 0
+				&& all_power[i]->Witts() == 0)
 			break;
 
 		usage[0] = 0;
@@ -958,7 +965,7 @@ void report_process_update_display(void)
 			sprintf(wakes, "%5.2f", all_power[i]->wake_ups / measurement_time);
 		sprintf(gpus, "%5.1f", all_power[i]->gpu_ops / measurement_time);
 		sprintf(disks, "%5.1f (%5.1f)", all_power[i]->hard_disk_hits / measurement_time,
-			all_power[i]->disk_hits / measurement_time);
+				all_power[i]->disk_hits / measurement_time);
 		sprintf(xwakes, "%5.1f", all_power[i]->xwakes / measurement_time);
 		if (!all_power[i]->show_events()) {
 			wakes[0] = 0;
@@ -975,27 +982,37 @@ void report_process_update_display(void)
 		if (all_power[i]->xwakes == 0)
 			xwakes[0] = 0;
 
-		report.begin_row(ROW_SOFTWARE);
+		software_data[idx]=string(usage);
+		idx+=1;
+
+		software_data[idx]=string(wakes);
+		idx+=1;
+
+		software_data[idx]=string(gpus);
+		idx+=1;
+
+		software_data[idx]=string(disks);
+		idx+=1;
+
+		software_data[idx]=string(xwakes);
+		idx+=1;
+
+		software_data[idx]=string(name);
+		idx+=1;
+
+		software_data[idx]=string(pretty_print(all_power[i]->description(), descr, 128));
+		idx+=1;
 		if (show_power) {
-			report.begin_cell(CELL_SOFTWARE_POWER);
-			report.add(power);
+			software_data[idx]=string(power);
+			idx+=1;
 		}
-
-		report.begin_cell(CELL_SOFTWARE_POWER);
-		report.add(usage);
-		report.begin_cell(CELL_SOFTWARE_POWER);
-		report.add(wakes);
-		report.begin_cell(CELL_SOFTWARE_POWER);
-		report.add(gpus);
-		report.begin_cell(CELL_SOFTWARE_POWER);
-		report.add(disks);
-		report.begin_cell(CELL_SOFTWARE_POWER);
-		report.add(xwakes);
-		report.begin_cell();
-		report.add(name);
-		report.begin_cell();
-		report.add(pretty_print(all_power[i]->description(), descr, 128));
 	}
+
+	/* Report Output */
+	report.add_div(&div_attr);
+	report.add_title(&title_attr, "Overview of Software Power Consumers");
+	report.add_table(software_data, &std_table_css);
+        report.end_div();
 }
 
 void report_summary(void)
src/report/report-data-html.cpp +10 -1
index 28732c9..f0d536d 100644
@@ -71,7 +71,16 @@ void init_cpu_table_attr(struct table_attributes *table_css, int title_mod,
 }
 
 
-
+void init_nowarp_table_attr(struct table_attributes *table_css, int rows, int cols){
+	table_css->table_class="emphasis2";
+	table_css->tr_class="emph1";
+	table_css->th_class="emph_title";
+	table_css->td_class="no_wrap";
+	table_css->pos_table_title=T;
+	table_css->title_mod=0;
+	table_css->rows=rows;
+	table_css->cols=cols;
+}
 
 
 /* Other Helper Functions */
src/report/report-data-html.h +2 -0
index 61e75c0..d2d782b 100644
@@ -53,6 +53,8 @@ init_core_table_attr(struct table_attributes *table_css, int title_mod,
 void
 init_cpu_table_attr(struct table_attributes *table_css, int title_mod,
 		int rows, int cols);
+void
+init_nowarp_table_attr(struct table_attributes *table_css, int rows, int cols);
 
 
 /* Other helper functions */
Signature · 1 line
1.7.9.5
#20 lore raw

Re: [Powertop] [PATCH 19/29] report: redesign System Information csv and html

Hi Alexandra,

Quoted 14 lines · Alexandra Yates

Enabled "System Information" section for csv and html report design.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
  src/process/do_process.cpp      |  113 ++++++++++++++++++++++-----------------
  src/report/report-data-html.cpp |   11 +++-
  src/report/report-data-html.h   |    2 +
  3 files changed, 77 insertions(+), 49 deletions(-)
src/process/do_process.cpp +0 -0
index 6708f12..c50fdd3 100644
@@ -889,42 +889,48 @@ void report_process_update_display(void)

...

Quoted 28 lines
src/process/do_process.cpp +4 -22
-	report.begin_section(SECTION_SOFTWARE);
-	report.add_header(__("Overview of Software Power Consumers"));
-	report.begin_table(TABLE_WIDE);
-	report.begin_row();
-	if (show_power) {
-		report.begin_cell(CELL_SOFTWARE_HEADER);
-		report.add(__("Power est."));
-	}
+	/* Set Table attributes, rows, and cols */
+	cols=7;
+	if (show_power)
+		cols=8;
 
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("Usage"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("Wakeups/s"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("GPU ops/s"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("Disk IO/s"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("GFX Wakeups/s"));
-	report.begin_cell(CELL_SOFTWARE_PROCESS);
-	report.add(__("Category"));
-	report.begin_cell(CELL_SOFTWARE_DESCRIPTION);
-	report.add(__("Description"));

...

src/process/do_process.cpp void report_process_update_display(void) · line 929

Quoted 13 lines
src/process/do_process.cpp +12 -0
+	/* Set array of data in row Major order */
+	string  software_data[cols * rows];
+	software_data[0]="Usage";
+	software_data[1]="Wakeups/s";
+	software_data[2]="GPU ops/s";
+	software_data[3]="Disk IO/s";
+	software_data[4]="GFX Wakeups/s";
+	software_data[5]="Category";
+	software_data[6]="Description";
+
+	if (show_power)
+		software_data[7]="PW Estimate";

Didn't you miss the __(...) macro here? This macro is used for localizing strings to produce reports on another languages too.

Thank you.

Signature · 9 lines
Best regards,
Igor Zhbanov,
Expert Software Engineer,
phone: +7 (495) 797 25 00 ext 3981
e-mail: i.zhbanov(a)samsung.com

Mobile group, Moscow R&D center, Samsung Electronics
12 Dvintsev street, building 1
127018, Moscow, Russian Federation
author
#21 lore raw

Re: [Powertop] [PATCH 19/29] report: redesign System Information csv and html

Quoted 74 lines

Hi Alexandra,

Quoted 15 lines · Alexandra Yates

Enabled "System Information" section for csv and html report design.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
  src/process/do_process.cpp      |  113
++++++++++++++++++++++-----------------
  src/report/report-data-html.cpp |   11 +++-
  src/report/report-data-html.h   |    2 +
  3 files changed, 77 insertions(+), 49 deletions(-)
src/process/do_process.cpp +0 -0
index 6708f12..c50fdd3 100644
@@ -889,42 +889,48 @@ void report_process_update_display(void)

...

Quoted 28 lines
src/process/do_process.cpp +4 -22
-	report.begin_section(SECTION_SOFTWARE);
-	report.add_header(__("Overview of Software Power Consumers"));
-	report.begin_table(TABLE_WIDE);
-	report.begin_row();
-	if (show_power) {
-		report.begin_cell(CELL_SOFTWARE_HEADER);
-		report.add(__("Power est."));
-	}
+	/* Set Table attributes, rows, and cols */
+	cols=7;
+	if (show_power)
+		cols=8;
 
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("Usage"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("Wakeups/s"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("GPU ops/s"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("Disk IO/s"));
-	report.begin_cell(CELL_SOFTWARE_HEADER);
-	report.add(__("GFX Wakeups/s"));
-	report.begin_cell(CELL_SOFTWARE_PROCESS);
-	report.add(__("Category"));
-	report.begin_cell(CELL_SOFTWARE_DESCRIPTION);
-	report.add(__("Description"));

...

src/process/do_process.cpp void report_process_update_display(void) · line 929

Quoted 13 lines
src/process/do_process.cpp +12 -0
+	/* Set array of data in row Major order */
+	string  software_data[cols * rows];
+	software_data[0]="Usage";
+	software_data[1]="Wakeups/s";
+	software_data[2]="GPU ops/s";
+	software_data[3]="Disk IO/s";
+	software_data[4]="GFX Wakeups/s";
+	software_data[5]="Category";
+	software_data[6]="Description";
+
+	if (show_power)
+		software_data[7]="PW Estimate";

Didn't you miss the __(...) macro here? This macro is used for localizing strings to produce reports on another languages too.

Thank you.

--
Best regards,
Igor Zhbanov,
Expert Software Engineer,
phone: +7 (495) 797 25 00 ext 3981
e-mail: i.zhbanov(a)samsung.com

Quoted 9 lines

Mobile group, Moscow R&D center, Samsung Electronics 12 Dvintsev street, building 1
127018, Moscow, Russian Federation

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop

Hi Igor,

I totally missed that macro, I will correct and recheck all the other patches to ensure they all meet the requirement.

Thank you,
Alexandra.

author
#22 lore raw

PATCH 20/29 report: redesign Device Power Report css & html

In reply to Alexandra Yates

Redesign Device Power Report table part of "Device Info" section.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/devices/device.cpp |   72 +++++++++++++++++++++++-------------------------
 1 file changed, 35 insertions(+), 37 deletions(-)
src/devices/device.cpp +35 -37
index 00ec5e6..1d9b1d4 100644
@@ -49,6 +49,7 @@ using namespace std;
 #include "../lib.h"
 #include "../report/report.h"
 #include "../report/report-maker.h"
+#include "../report/report-data-html.h"
 #include "../measurement/measurement.h"
 #include "../devlist.h"
 #include <unistd.h>
@@ -217,43 +218,35 @@ void report_devices(void)
 void show_report_devices(void)
 {
 	unsigned int i;
-	int show_power;
-	double pw;
+	int show_power, cols, rows, idx;
 
 	show_power = global_power_valid();
 	sort(all_devices.begin(), all_devices.end(), power_device_sort);
 
-	report.begin_section(SECTION_DEVPOWER);
-	report.add_header("Device Power Report");
+	/* div attr css_class and css_id */
+        tag_attr div_attr;
+        init_div(&div_attr, "", "device");
 
-	pw = global_joules_consumed();
-	if (pw > 0.0001) {
-		char buf[32];
+        /* Set Table attributes, rows, and cols */
+        table_attributes std_table_css;
+	cols=2;
+        if (show_power)
+                cols=3;
 
-		report.begin_paragraph();
-		report.addf("The battery reports a discharge rate of %sW",
-			    fmt_prefix(pw, buf));
-	}
+	idx = cols;
+ 	rows= all_devices.size() + 1;
+        init_std_table_attr(&std_table_css, rows, cols);
 
-	if (show_power) {
-		char buf[32];
+        /* Set Title attributes */
+        tag_attr title_attr;
+        init_title_attr(&title_attr);
 
-		report.begin_paragraph();
-		report.addf("System baseline power is estimated at %sW",
-			    fmt_prefix(get_parameter_value("base power"), buf));
-	}
-
-	report.begin_table(TABLE_WIDE);
-	report.begin_row();
-	if (show_power) {
-		report.begin_cell(CELL_DEVPOWER_HEADER);
-		report.add("Power est.");
-	}
-
-	report.begin_cell(CELL_DEVPOWER_HEADER);
-	report.add("Usage");
-	report.begin_cell(CELL_DEVPOWER_DEV_NAME);
-	report.add("Device name");
+        /* Set array of data in row Major order */
+	string device_data[cols * rows];
+	device_data[0]= "Usage";
+	device_data[1]= "Device Name";
+	if (show_power)
+		device_data[2]= "PW Estimate";
 
 	for (i = 0; i < all_devices.size(); i++) {
 		double P;
@@ -278,17 +271,22 @@ void show_report_devices(void)
 		if (!show_power || !all_devices[i]->power_valid())
 			strcpy(power, "           ");
 
-		report.begin_row(ROW_DEVPOWER);
+		device_data[idx]= string(util);
+		idx+=1;
+
+		device_data[idx]= string(all_devices[i]->human_name());
+		idx+=1;
+
 		if (show_power) {
-			report.begin_cell(CELL_DEVPOWER_POWER);
-			report.add(power);
+			device_data[idx]= string(power);
+			idx+=1;
 		}
-
-		report.begin_cell(CELL_DEVPOWER_UTIL);
-		report.add(util);
-		report.begin_cell();
-		report.add(all_devices[i]->human_name());
 	}
+	/* Report Output */
+	report.add_div(&div_attr);
+	report.add_title(&title_attr,"Device Power Report");
+	report.add_table(device_data, &std_table_css);
+	report.end_div();
 }
 
 
Signature · 1 line
1.7.9.5
author
#23 lore raw

PATCH 21/29 report: Redesign Device Activity css & html

In reply to Alexandra Yates

Enables new design for Process Device Activity table part of "Device info" section. These changes are for csv and html reports.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/devlist.cpp |   47 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 15 deletions(-)
src/devlist.cpp +32 -15
index 633a568..09d256b 100644
@@ -45,6 +45,7 @@ using namespace std;
 #include "lib.h"
 #include "report/report.h"
 #include "report/report-maker.h"
+#include "report/report-data-html.h"
 
 #include "process/process.h"
 #include "devices/device.h"
@@ -284,9 +285,9 @@ void report_show_open_devices(void)
 	vector<struct devuser *> *target;
 	unsigned int i;
 	char prev[128], proc[128];
+	int idx, cols, rows;
 
 	prev[0] = 0;
-
 	if (phase == 1)
 		target = &one;
 	else
@@ -295,27 +296,43 @@ void report_show_open_devices(void)
 	if (target->size() == 0)
 		return;
 
-	sort(target->begin(), target->end(), devlist_sort);
+	/* div attr css_class and css_id */
+	tag_attr div_attr;
+	init_div(&div_attr, "", "device");
+
+	/* Set Table attributes, rows, and cols */
+	table_attributes std_table_css;
+	cols = 2;
+	idx = cols;
+	rows= target->size() + 1;
+	init_std_table_attr(&std_table_css, rows, cols);
+
+	/* Set Title attributes */
+	tag_attr title_attr;
+	init_title_attr(&title_attr);
 
-	report.add_header("Process device activity");
-	report.begin_table(TABLE_WIDE);
-	report.begin_row();
-	report.begin_cell(CELL_DEVACTIVITY_PROCESS);
-	report.add("Process");
-	report.begin_cell(CELL_DEVACTIVITY_DEVICE);
-	report.add("Device");
+	/* Set array of data in row Major order */
+	string process_data[cols * rows];
+
+	sort(target->begin(), target->end(), devlist_sort);
+	process_data[0]="Process";
+	process_data[1]="Device";
 
 	for (i = 0; i < target->size(); i++) {
 		proc[0] = 0;
-
 		if (strcmp(prev, (*target)[i]->comm) != 0)
 			sprintf(proc, "%s", (*target)[i]->comm);
 
-		report.begin_row(ROW_DEVPOWER);
-		report.begin_cell();
-		report.add(proc);
-		report.begin_cell();
-		report.add((*target)[i]->device);
+		process_data[idx]=string(proc);
+		idx+=1;
+		process_data[idx]=string((*target)[i]->device);
+		idx+=1;
 		sprintf(prev, "%s", (*target)[i]->comm);
 	}
+
+	/* Report Output */
+	report.add_div(&div_attr);
+	report.add_title(&title_attr, "Process Device Activity");
+	report.add_table(process_data, &std_table_css);
+	report.end_div();
 }
Signature · 1 line
1.7.9.5
author
#24 lore raw

PATCH 22/29 report: cleanup csv title and unused vars

In reply to Alexandra Yates

Removed old csv headder to avoid redundancy. Removed unused variables from report.cpp str2 and str3.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter-csv.cpp |    2 +-
 src/report/report.cpp               |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
src/report/report-formatter-csv.cpp +1 -1
index facdd4d..0ab1091 100644
@@ -57,7 +57,7 @@ report_formatter_csv::finish_report()
 void
 report_formatter_csv::add_doc_header()
 {
-	add_header(report_csv_header, 1);
+	/*add_header(report_csv_header, 1);*/
 }
 
 /* ************************************************************************ */
src/report/report.cpp +1 -1
index de1c000..2fb6952 100644
@@ -100,7 +100,7 @@ static string read_os_release(const string &filename)
 
 static void system_info(void)
 {
-	string str, str2, str3;
+	string str;
 
 	/* div attr css_class and css_id */
 	tag_attr div_attr;
Signature · 1 line
1.7.9.5
author
#25 lore raw

PATCH 23/29 report: report tuning with new desig html csv

In reply to Alexandra Yates

Changes tunning reporting calls to use the new design on and csv reports.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-data-html.cpp |    9 +++
 src/report/report-data-html.h   |    2 +
 src/tuning/tuning.cpp           |  125 +++++++++++++++++++++++----------------
 3 files changed, 86 insertions(+), 50 deletions(-)
src/report/report-data-html.cpp +9 -0
index f0d536d..72d2e52 100644
@@ -82,6 +82,15 @@ void init_nowarp_table_attr(struct table_attributes *table_css, int rows, int co
 	table_css->cols=cols;
 }
 
+void init_tune_table_attr(struct table_attributes *table_css, int rows, int cols){
+	table_css->table_class="emphasis2";
+	table_css->tr_class="tune";
+	table_css->th_class="emph_title";
+	table_css->td_class="";
+	table_css->pos_table_title=T;
+	table_css->rows=rows;
+	table_css->cols=cols;
+}
 
 /* Other Helper Functions */
 string
src/report/report-data-html.h +2 -0
index d2d782b..7e517eb 100644
@@ -56,6 +56,8 @@ init_cpu_table_attr(struct table_attributes *table_css, int title_mod,
 void
 init_nowarp_table_attr(struct table_attributes *table_css, int rows, int cols);
 
+void
+init_tune_table_attr(struct table_attributes *table_css, int rows, int cols);
 
 /* Other helper functions */
 string
src/tuning/tuning.cpp +75 -50

153 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#26 lore raw

PATCH 24/29 report-html: fixed not hidding sections errors

In reply to Alexandra Yates

Removed multiple division when displaying more than one table on a section as it was the case of Device Info and Tuning sections. Now all sections display accordingly to the selected menu button.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/devices/device.cpp          |    5 ++---
 src/devlist.cpp                 |    5 +----
 src/powertop.css                |   19 +++++++++----------
 src/report/report-data-html.cpp |   11 +++++++++++
 src/report/report-data-html.h   |    4 ++++
 src/tuning/tuning.cpp           |    6 +-----
 6 files changed, 28 insertions(+), 22 deletions(-)
src/devices/device.cpp +2 -3
index 1d9b1d4..1913604 100644
@@ -225,7 +225,7 @@ void show_report_devices(void)
 
 	/* div attr css_class and css_id */
         tag_attr div_attr;
-        init_div(&div_attr, "", "device");
+        init_div(&div_attr, "", "devinfo");
 
         /* Set Table attributes, rows, and cols */
         table_attributes std_table_css;
@@ -235,7 +235,7 @@ void show_report_devices(void)
 
 	idx = cols;
  	rows= all_devices.size() + 1;
-        init_std_table_attr(&std_table_css, rows, cols);
+        init_std_side_table_attr(&std_table_css, rows, cols);
 
         /* Set Title attributes */
         tag_attr title_attr;
@@ -286,7 +286,6 @@ void show_report_devices(void)
 	report.add_div(&div_attr);
 	report.add_title(&title_attr,"Device Power Report");
 	report.add_table(device_data, &std_table_css);
-	report.end_div();
 }
 
 
src/devlist.cpp +1 -4
index 09d256b..cd23969 100644
@@ -296,9 +296,6 @@ void report_show_open_devices(void)
 	if (target->size() == 0)
 		return;
 
-	/* div attr css_class and css_id */
-	tag_attr div_attr;
-	init_div(&div_attr, "", "device");
 
 	/* Set Table attributes, rows, and cols */
 	table_attributes std_table_css;
@@ -331,7 +328,7 @@ void report_show_open_devices(void)
 	}
 
 	/* Report Output */
-	report.add_div(&div_attr);
+	/* No div attribute here inherits from device power report */
 	report.add_title(&title_attr, "Process Device Activity");
 	report.add_table(process_data, &std_table_css);
 	report.end_div();
src/powertop.css +9 -10
index 97c15cc..0c0f75b 100644
@@ -12,7 +12,7 @@ var powertop = {
   cpuidle: 'CPU Idle',
   cpufreq: 'CPU Frequency',
   software: 'Software Info',
-  device: 'Device Info',
+  devinfo: 'Device Info',
   tuning: 'Tuning'
  },
  cadd: function(idx, c){
@@ -76,6 +76,13 @@ var powertop = {
 	padding:0px;
 }
 
+body {
+	background-color: #eee; /* Background color */
+	color: #222;            /* Font color */
+	font-family: Helvetica;
+	font-size: 14px;
+}
+
 #main_container{
 	width: 960px;
 	margin: 2px auto;
@@ -198,15 +205,7 @@ li.summary_list
 
 
 
-/*menu css*/
-
-body {
-	background-color: #eee; /* Background color */
-	color: #222;            /* Font color */
-	font-family: Helvetica;
-	font-size: 14px;
-}
-
+/* main menu css*/
 #main_menu {
 	display: inline-block;
 	font-weight: bold;
src/report/report-data-html.cpp +11 -0
index 72d2e52..78354c3 100644
@@ -34,6 +34,17 @@ void init_std_table_attr(struct table_attributes *table_css, int rows, int cols)
 	table_css->rows=rows;
 	table_css->cols=cols;
 }
+void init_std_side_table_attr(struct table_attributes *table_css, int rows, int cols){
+	table_css->table_class="emphasis2 side_by_side_left";
+	table_css->tr_class="emph1";
+	table_css->th_class="emph_title";
+	table_css->td_class="";
+	table_css->pos_table_title=T;
+	table_css->title_mod=0;
+	table_css->rows=rows;
+	table_css->cols=cols;
+}
+
 
 void init_pkg_table_attr(struct table_attributes *table_css, int rows, int cols){
 	table_css->table_class="emphasis2 side_by_side_left";
src/report/report-data-html.h +4 -0
index 7e517eb..f16977e 100644
@@ -44,6 +44,10 @@ void
 init_std_table_attr(struct table_attributes *table_css, int rows, int cols);
 
 void
+init_std_side_table_attr(struct table_attributes *table_css, int rows,
+		int cols);
+
+void
 init_pkg_table_attr(struct table_attributes *table_css, int rows, int cols);
 
 void
src/tuning/tuning.cpp +1 -5
index e251f56..4b2588d 100644
@@ -207,7 +207,7 @@ void report_show_tunables(void)
 
 	 /* div attr css_class and css_id */
         tag_attr div_attr;
-        init_div(&div_attr, "", "tuning");
+        init_div(&div_attr, "clear_block", "tuning");
 
 	/* Set Table attributes, rows, and cols */
 	table_attributes tune_table_css;
@@ -242,7 +242,6 @@ void report_show_tunables(void)
 	report.add_div(&div_attr);
 	report.add_title(&title_attr,"Software Settings in Need of Tuning");
 	report.add_table(tunable_data, &tune_table_css);
-	report.end_div();
 
 	/* Second Table */
 	/* Set Table attributes, rows, and cols */
@@ -258,10 +257,8 @@ void report_show_tunables(void)
 		untunable_data[i+1]= string(all_untunables[i]->description());
 
 	/* Report Output */
-	report.add_div(&div_attr);
 	report.add_title(&title_attr,"Untunable Software Issues");
 	report.add_table(untunable_data, &tune_table_css);
-	report.end_div();
 
 	/* Third Table */
 	/* Set Table attributes, rows, and cols */
@@ -283,7 +280,6 @@ void report_show_tunables(void)
 		idx+=1;
         }
 	/* Report Output */
-	report.add_div(&div_attr);
 	report.add_title(&title_attr,"Optimal Tuned Software Settings");
         report.add_table(tuned_data, &tune_table_css);
         report.end_div();
Signature · 1 line
1.7.9.5
author
#27 lore raw

PATCH 25/29 report: fixed empty SW settings in need of tunning

In reply to Alexandra Yates

After tunning the sistem the Software Setings in Need of Tunning table appreared empty. Added a conditional statement to print the table only when there are software settings in need of tunning.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/tuning/tuning.cpp |   60 ++++++++++++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 25 deletions(-)
src/tuning/tuning.cpp +35 -25
index 4b2588d..0f5bf25 100644
@@ -209,39 +209,49 @@ void report_show_tunables(void)
         tag_attr div_attr;
         init_div(&div_attr, "clear_block", "tuning");
 
+	/* Set Title attributes */
+       	tag_attr title_attr;
+        init_title_attr(&title_attr);
+
 	/* Set Table attributes, rows, and cols */
 	table_attributes tune_table_css;
 	cols=2;
 	idx = cols;
-	rows= all_tunables.size() + 1;
-	init_tune_table_attr(&tune_table_css, rows, cols);
-
-	/* Set Title attributes */
-        tag_attr title_attr;
-        init_title_attr(&title_attr);
-
-	/* Set array of data in row Major order */
-	string tunable_data[cols * rows];
-
-	tunable_data[0]="Description";
-	tunable_data[1]="Script";
-
 
 	for (i = 0; i < all_tunables.size(); i++) {
-		int gb;
-		gb = all_tunables[i]->good_bad();
-		if (gb != TUNE_BAD)
-			continue;
-		tunable_data[idx]=string(all_tunables[i]->description());
-		idx+=1;
-		tunable_data[idx]=string(all_tunables[i]->toggle_script());
-		idx+=1;
+		int tgb;
+		tgb = all_tunables[i]->good_bad();
+		if (tgb == TUNE_BAD)
+			rows+=1;
 	}
-
-	/* Report Output */
+	/* add section */
 	report.add_div(&div_attr);
-	report.add_title(&title_attr,"Software Settings in Need of Tuning");
-	report.add_table(tunable_data, &tune_table_css);
+
+	if (rows > 0){
+		rows= rows + 1;
+		init_tune_table_attr(&tune_table_css, rows, cols);
+
+		/* Set array of data in row Major order */
+		string tunable_data[cols * rows];
+
+		tunable_data[0]="Description";
+		tunable_data[1]="Script";
+
+		for (i = 0; i < all_tunables.size(); i++) {
+			int gb;
+			gb = all_tunables[i]->good_bad();
+			if (gb != TUNE_BAD)
+				continue;
+			tunable_data[idx]=string(all_tunables[i]->description());
+			idx+=1;
+			tunable_data[idx]=string(all_tunables[i]->toggle_script());
+			idx+=1;
+		}
+
+		/* Report Output */
+		report.add_title(&title_attr,"Software Settings in Need of Tuning");
+		report.add_table(tunable_data, &tune_table_css);
+	}
 
 	/* Second Table */
 	/* Set Table attributes, rows, and cols */
Signature · 1 line
1.7.9.5
author
#28 lore raw

PATCH 26/29 report: design batery discharge/system baseline

In reply to Alexandra Yates

Redesigns the header section on Device Power Report to include the battery discharge report and system baseline power.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/devices/device.cpp |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
src/devices/device.cpp +23 -1
index 1913604..89d2452 100644
@@ -219,6 +219,7 @@ void show_report_devices(void)
 {
 	unsigned int i;
 	int show_power, cols, rows, idx;
+	double pw;
 
 	show_power = global_power_valid();
 	sort(all_devices.begin(), all_devices.end(), power_device_sort);
@@ -241,6 +242,28 @@ void show_report_devices(void)
         tag_attr title_attr;
         init_title_attr(&title_attr);
 
+	/* Add section */
+	report.add_div(&div_attr);
+
+	/* Device Summary */
+	int summary_size=2;
+        string summary[summary_size];
+	pw = global_joules_consumed();
+	char buf[32];
+	if (pw > 0.0001) {
+		summary[0]= "The battery reports a discharge rate of: ";
+		summary[1]=string(fmt_prefix(pw, buf));
+		summary[1].append(" W");
+		report.add_summary_list(summary, summary_size);
+	}
+
+	if (show_power) {
+		summary[0]="The system baseline power is estimated at: ";
+		summary[1]=string(fmt_prefix(get_parameter_value("base power"), buf));
+		summary[1].append(" W");
+		report.add_summary_list(summary, summary_size);
+	}
+
         /* Set array of data in row Major order */
 	string device_data[cols * rows];
 	device_data[0]= "Usage";
@@ -283,7 +306,6 @@ void show_report_devices(void)
 		}
 	}
 	/* Report Output */
-	report.add_div(&div_attr);
 	report.add_title(&title_attr,"Device Power Report");
 	report.add_table(device_data, &std_table_css);
 }
Signature · 1 line
1.7.9.5
author
#29 lore raw

PATCH 27/29 report: conditional runs ncurses & cpu html report

In reply to Alexandra Yates

Adds a conditional to fix n-curses from breaking when calling one_measurment from main. Now will execute report_display_cpu_cstates and report_display_cpu_pstates only when a csv or an HTML report are generated.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/main.cpp |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
src/main.cpp +4 -3
index 4e34ee6..c57aa57 100644
@@ -216,10 +216,11 @@ void one_measurement(int seconds, char *workload)
 	report_summary();
 	w_display_cpu_cstates();
 	w_display_cpu_pstates();
-	report_display_cpu_cstates();
-	report_display_cpu_pstates();
+	if (reporttype != REPORT_OFF) {
+		report_display_cpu_cstates();
+		report_display_cpu_pstates();
+	}
 	report_process_update_display();
-
 	tuning_update_display();
 
 	end_process_data();
Signature · 1 line
1.7.9.5
author
#30 lore raw

PATCH 28/29 report: logo size & menu compatibility

In reply to Alexandra Yates

Fixed css on logo to show image in real size. Additionaly changed the tags in navigation from nav to div to enable compatibility with the new navigation menu and IE.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/powertop.css                     |    5 +++--
 src/report/report-formatter-html.cpp |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
src/powertop.css +3 -2
index 0c0f75b..1792d6b 100644
@@ -96,8 +96,9 @@ body {
 
 img.pwtop_logo{
 	float:left;
-	height:90px;
-	width: 400px;
+	height:40%;
+	width: 40%;
+	padding:20px;
 }
 
 .sys_info
src/report/report-formatter-html.cpp +1 -1
index 210a354..e18b543 100644
@@ -518,7 +518,7 @@ report_formatter_html::add_title(struct tag_attr *title_att, const char *title)
 void
 report_formatter_html::add_navigation()
 {
-	add_exact("<br/><nav id=\"main_menu\"> </nav>\n");
+	add_exact("<br/><div id=\"main_menu\"> </div>\n");
 }
 
 void
Signature · 1 line
1.7.9.5
author
#31 lore raw

PATCH 29/29 tunables: removed on-demand cpu frequency governor

In reply to Alexandra Yates

Remove sugestion to use the on-demand cpu frequency governor from powertop tunables as that is not longer a good sugestion since the pstate driver is the Intel recomended replacement.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/tuning/cpufreq.cpp |  213 ------------------------------------------------
 src/tuning/cpufreq.h   |   50 ------------
 src/tuning/tuning.cpp  |    1 -
 3 files changed, 264 deletions(-)
 delete mode 100644 src/tuning/cpufreq.cpp
 delete mode 100644 src/tuning/cpufreq.h
src/tuning/cpufreq.cpp deleted +0 -213
deleted file mode 100644
index e870559..0000000
@@ -1,213 +0,0 @@
-/*
- * Copyright 2010, Intel Corporation
- *
- * This file is part of PowerTOP
- *
- * This program file 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; version 2 of the License.
- *
- * 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 in a file named COPYING; if not, write to the
- * Free Software Foundation, Inc,
- * 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- * or just google for it.
- *
- * Authors:
- *	Arjan van de Ven <arjan(a)linux.intel.com>
- */
-
-#include "tuning.h"
-#include "tunable.h"
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <utility>
-#include <iostream>
-#include <fstream>
-#include <unistd.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <ctype.h>
-
-#include "../lib.h"
-#include "cpufreq.h"
-
-cpufreq_tunable::cpufreq_tunable(void) : tunable("", 0.3, _("Good"), _("Bad"), _("Unknown"))
-{
-	string str;
-	sprintf(desc, _("Using 'ondemand' cpufreq governor"));
-
-	str = read_sysfs_string("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor");
-	strcpy(original, str.c_str());
-	if (strlen(original) < 1)
-		strcpy(original, "ondemand");
-}
-
-
-int cpufreq_tunable::good_bad(void)
-{
-	DIR *dir;
-	struct dirent *dirent;
-	FILE *file;
-	char filename[PATH_MAX];
-	char line[1024];
-
-	char gov[1024];
-	int ret = TUNE_GOOD;
-
-
-	gov[0] = 0;
-
-
-	dir = opendir("/sys/devices/system/cpu");
-	if (!dir)
-		return ret;
-
-	while ((dirent = readdir(dir))) {
-		if (strncmp(dirent->d_name, "cpu", 3) != 0 || !isdigit(dirent->d_name[3]))
-			continue;
-		sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_governor", dirent->d_name);
-		file = fopen(filename, "r");
-		if (!file)
-			continue;
-		memset(line, 0, 1024);
-		if (fgets(line, 1023,file)==NULL) {
-			fclose(file);
-			continue;
-		}
-		if (strlen(gov)==0)
-			strcpy(gov, line);
-		else
-			/* if the governors are inconsistent, warn */
-			if (strcmp(gov, line))
-				ret = TUNE_BAD;
-		fclose(file);
-	}
-
-	closedir(dir);
-
-	/* if the governor is set to userspace, also warn */
-	if (strstr(gov, "userspace"))
-		ret = TUNE_BAD;
-
-	/* if the governor is set to performance, also warn */
-	/* FIXME: check if this is fair on all cpus */
-	if (strstr(gov, "performance"))
-		ret = TUNE_BAD;
-
-	return ret;
-}
-
-void cpufreq_tunable::toggle(void)
-{
-	DIR *dir;
-	struct dirent *dirent;
-	FILE *file;
-	char filename[PATH_MAX];
-	int good;
-	good = good_bad();
-
-	system("/sbin/modprobe cpufreq_ondemand > /dev/null 2>&1");
-
-	if (good == TUNE_GOOD) {
-		dir = opendir("/sys/devices/system/cpu");
-		if (!dir)
-			return;
-
-		while ((dirent = readdir(dir))) {
-			if (strncmp(dirent->d_name, "cpu", 3) != 0 || !isdigit(dirent->d_name[3]))
-				continue;
-			sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_governor", dirent->d_name);
-			file = fopen(filename, "w");
-			if (!file)
-				continue;
-			fprintf(file, "%s\n", original);
-			fclose(file);
-		}
-
-		closedir(dir);
-		return;
-	}
-	dir = opendir("/sys/devices/system/cpu");
-	if (!dir)
-		return;
-
-	while ((dirent = readdir(dir))) {
-		if (strncmp(dirent->d_name, "cpu", 3) != 0 || !isdigit(dirent->d_name[3]))
-			continue;
-		sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_governor", dirent->d_name);
-		file = fopen(filename, "w");
-		if (!file)
-			continue;
-		fprintf(file, "ondemand\n");
-		fclose(file);
-	}
-
-	closedir(dir);
-}
-
-const char *cpufreq_tunable::toggle_script(void) {
-	DIR *dir;
-	struct dirent *dirent;
-	char filename[PATH_MAX];
-	char tmp[4096];
-	struct stat statbuf;
-	int good;
-	good = good_bad();
-
-	strcpy(toggle_good, "/sbin/modprobe cpufreq_ondemand > /dev/null 2>&1\n");
-
-	if (good == TUNE_GOOD) {
-		dir = opendir("/sys/devices/system/cpu");
-		if (!dir)
-			return NULL;
-
-		while ((dirent = readdir(dir))) {
-			if (strncmp(dirent->d_name, "cpu", 3) != 0 || !isdigit(dirent->d_name[3]))
-				continue;
-			sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_governor", dirent->d_name);
-			if (stat(filename, &statbuf) == -1)
-				continue;
-			sprintf(tmp, "echo '%s' > '%s';\n", original, filename);
-			strcat(toggle_good, tmp);
-		}
-
-		closedir(dir);
-		return toggle_good;
-	}
-
-	dir = opendir("/sys/devices/system/cpu");
-	if (!dir)
-		return NULL;
-
-	while ((dirent = readdir(dir))) {
-		if (strncmp(dirent->d_name, "cpu", 3) != 0 || !isdigit(dirent->d_name[3]))
-			continue;
-		sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_governor", dirent->d_name);
-		if (stat(filename, &statbuf) == -1)
-			continue;
-		sprintf(tmp, "echo 'ondemand' > '%s';\n", filename);
-		strcat(toggle_good, tmp);
-	}
-
-	closedir(dir);
-	return toggle_good;
-}
-
-
-void add_cpufreq_tunable(void)
-{
-	class cpufreq_tunable *cf;
-
-	cf = new class cpufreq_tunable();
-	all_tunables.push_back(cf);
-}
src/tuning/cpufreq.h deleted +0 -50

50 lines not on this page · raw message

src/tuning/tuning.cpp +0 -1
index 0f5bf25..7f6d3ec 100644
@@ -67,7 +67,6 @@ static void init_tuning(void)
 	add_ethernet_tunable();
 	add_bt_tunable();
 	add_wifi_tunables();
-	add_cpufreq_tunable();
 
 	sort_tunables();
 }
Signature · 1 line
1.7.9.5