Skip to contentSkip to conversation

Report Redesign

PATCH In review Alexandra Yates 3 participants 45 messages Nov 18, 2013 – Dec 13, 2013

lore
Share & tools
lore

Alexandra Yates

author
#0 lore raw

v3 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 and cleans up unused reporting functions. Additionally, removes 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.

Igor Zhbanov reported that the localization macro __(…) was left out from previous version. These patches changed to add the localization macro to all report components.

Alexandra Yates (31):
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 Software Information csv and html
report: redesign Device Power Report csv & html
report: Redesign Device Activity csv & html report
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
report-cleanup: removed old table, row, & cell.
report-cleanup: removed html & csv old methods

 PowerTop.png                         |  Bin 0 -> 6975 bytes
 src/Makefile.am                      |    5 +-
 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  |  189 ++++++---------
 src/report/report-formatter-csv.h    |   42 ++--
 src/report/report-formatter-html.cpp |  417 +++++++++-------------------------
 src/report/report-formatter-html.h   |   71 ++----
 src/report/report-formatter.h        |   32 +--
 src/report/report-maker.cpp          |  180 ++-------------
 src/report/report-maker.h            |  114 ++--------
 src/report/report.cpp                |   83 ++++---
 src/tuning/cpufreq.cpp               |  213 -----------------
 src/tuning/cpufreq.h                 |   50 ----
 src/tuning/tuning.cpp                |  131 ++++++-----
 21 files changed, 1142 insertions(+), 1551 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 v3 1/31 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 v3 2/31 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 v3 3/31 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 |   35 ++++++++++++++++++++++++++++++++++
 src/report/report-formatter-html.h   |    5 ++++-
 3 files changed, 43 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 +35 -0
index 79a0c35..2e59725 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,36 @@ 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 v3 4/31 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 v3 5/31 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 v3 6/31 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 2e59725..93a4c48 100644
@@ -516,3 +516,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
#7 lore raw

Re: [Powertop] [PATCH v3 06/31] report-html: summary list and navigation

Quoted 19 lines · 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 +2 -0
index 2e59725..93a4c48 100644
@@ -516,3 +516,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()

src/report/report-formatter-html.cpp report_formatter_html::add_title(struct tag_attr *title_att, const char *title) · line 530

Quoted 10 lines
src/report/report-formatter-html.cpp +10 -0
+{
+	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){

summary list is guaranteed to contain `2 * n' elements?

	-ss
Quoted 27 lines
src/report/report-formatter-html.cpp +6 -0
+		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 · 6 lines
1.7.9.5

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop
author
#8 lore raw

Re: [Powertop] [PATCH v3 06/31] report-html: summary list and navigation

Quoted 63 lines · Alexandra Yates
Quoted 22 lines

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 +2 -0
index 2e59725..93a4c48 100644
@@ -516,3 +516,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()

src/report/report-formatter-html.cpp report_formatter_html::add_title(struct tag_attr · line 530

Quoted 10 lines
src/report/report-formatter-html.cpp +10 -0
+{
+	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){

summary list is guaranteed to contain `2 * n' elements?

	-ss
Quoted 23 lines
src/report/report-formatter-html.cpp +6 -0
+		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 -1
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 */
--

1.7.9.5

Quoted 6 lines
Quoted 5 lines

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

Yes.

Thank you,
Alexandra.

author
#9 lore raw

PATCH v3 7/31 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
#10 lore raw

PATCH v3 8/31 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
#11 lore raw

PATCH v3 9/31 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
#12 lore raw

Re: [Powertop] [PATCH v3 09/31] report-html: Table generation

Quoted 103 lines · 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 +30 -5
index 93a4c48..f508ae0 100644
@@ -420,10 +420,10 @@ report_formatter_html::end_paragraph()
 
 /* ************************************************************************ */
 
-std::string
+string
 report_formatter_html::escape_string(const char *str)
 {
-	std::string res;
+	string res;
 
 	assert(str);
 
@@ -487,8 +487,8 @@ report_formatter_html::end_hheader()
 void
 report_formatter_html::add_div(struct tag_attr * div_attr)
 {
-	std::string empty="";
-	std::string tmp_str;
+	string empty="";
+	string tmp_str;
 
 	if (div_attr->css_class == empty && div_attr->css_id == empty)
 		add_exact("<div>\n");
@@ -523,7 +523,7 @@ report_formatter_html::add_navigation()
 }
 
 void
-report_formatter_html::add_summary_list(std::string *list, int size)
+report_formatter_html::add_summary_list(string *list, int size)
 {
 	int i;
 	add_exact("<div><br/> <ul>\n");
@@ -534,3 +534,52 @@ report_formatter_html::add_summary_list(std::string *list, int size)
 	add_exact("</ul> </div> <br />\n");
 }
 
+
+void
+report_formatter_html::add_table(string *system_data, struct table_size *size, struct table_attributes* tb_attr)
+{
+	int i, j;
+	int offset=0;
+	string  empty="";
+
+	if (tb_attr->table_class == empty)
+		add_exact("<table>\n");
+	else
+		addf_exact("<table class=\"%s\">\n", tb_attr->table_class);
+
+	for (i=0; i < size->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;
+
+			if (tb_attr->pos_table_title == T &&  i==0)
+				addf_exact("<th class=\"%s\"> %s </th> ",
+				tb_attr->th_class,system_data[offset].c_str());

src/report/report-formatter-html.cpp report_formatter_html::add_summary_list(std::string *list, int size) · line 571

Quoted 10 lines
src/report/report-formatter-html.cpp +10 -0
+			else if (tb_attr->pos_table_title == L &&  j==0)
+				addf_exact("<th class=\"%s\"> %s </th> ",
+				tb_attr->th_class, system_data[offset].c_str());
+			else if (tb_attr->pos_table_title == TL && ( i==0 || j==0 ))
+				addf_exact("<th class=\"%s\"> %s </th> ",
+				tb_attr->th_class, system_data[offset].c_str());
+			else if (tb_attr->pos_table_title == TC && ((i % tb_attr->title_mod ) == 0))
+				addf_exact("<th class=\"%s\"> %s </th> ", tb_attr->th_class,
+					system_data[offset].c_str());
+			else if (tb_attr->pos_table_title == TLC && ((i % tb_attr->title_mod) == 0 || j==0))

this is cryptic.
can we change enum to contain TOP, LEFT, CENTER and so, it will make code better:

	`tb_attr->pos_table_title == T' vs `tb_attr->pos_table_title == POSITION_TOP'
	or `tb_attr->pos_table_title == TOP'

	-ss
Quoted 56 lines
src/report/report-formatter-html.cpp +14 -0
+				addf_exact("<th class=\"%s\"> %s </th> ", tb_attr->th_class,
+				system_data[offset].c_str());
+			else
+				if ( tb_attr->td_class == empty)
+					addf_exact("<td > %s </td> ", system_data[offset].c_str());
+				else
+					addf_exact("<td class=\"%s\"> %s </td> ", tb_attr->td_class,
+						system_data[offset].c_str());
+		}
+		add_exact("</tr>\n");
+	}
+	add_exact("</table>\n");
+}
+
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 · 6 lines
1.7.9.5

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop
author
#13 lore raw

Re: [Powertop] [PATCH v3 09/31] report-html: Table generation

Quoted 189 lines · Alexandra Yates
Quoted 121 lines

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 +2 -2
index 93a4c48..f508ae0 100644
@@ -420,10 +420,10 @@ report_formatter_html::end_paragraph()
 
 /*
 ************************************************************************
 */
 
-std::string
+string
 report_formatter_html::escape_string(const char *str)
 {
-	std::string res;
+	string res;
 
src/report/report-formatter-html.cpp +6 -3
 	assert(str);
@@ -487,8 +487,8 @@ report_formatter_html::end_hheader()
 void
 report_formatter_html::add_div(struct tag_attr * div_attr)
 {
-	std::string empty="";
-	std::string tmp_str;
+	string empty="";
+	string tmp_str;
 
 	if (div_attr->css_class == empty && div_attr->css_id == empty)
 		add_exact("<div>\n");
@@ -523,7 +523,7 @@ report_formatter_html::add_navigation()
 }
 
 void
-report_formatter_html::add_summary_list(std::string *list, int size)
+report_formatter_html::add_summary_list(string *list, int size)
 {
 	int i;
 	add_exact("<div><br/> <ul>\n");
@@ -534,3 +534,52 @@ report_formatter_html::add_summary_list(std::string
 *list, int size)
 	add_exact("</ul> </div> <br />\n");
 }
 
+
+void
+report_formatter_html::add_table(string *system_data, struct table_size

*size, struct table_attributes* tb_attr)

src/report/report-formatter-html.cpp +29 -0
+{
+	int i, j;
+	int offset=0;
+	string  empty="";
+
+	if (tb_attr->table_class == empty)
+		add_exact("<table>\n");
+	else
+		addf_exact("<table class=\"%s\">\n", tb_attr->table_class);
+
+	for (i=0; i < size->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;
+
+			if (tb_attr->pos_table_title == T &&  i==0)
+				addf_exact("<th class=\"%s\"> %s </th> ",
+				tb_attr->th_class,system_data[offset].c_str());
+			else if (tb_attr->pos_table_title == L &&  j==0)
+				addf_exact("<th class=\"%s\"> %s </th> ",
+				tb_attr->th_class, system_data[offset].c_str());
+			else if (tb_attr->pos_table_title == TL && ( i==0 || j==0 ))
+				addf_exact("<th class=\"%s\"> %s </th> ",
+				tb_attr->th_class, system_data[offset].c_str());
+			else if (tb_attr->pos_table_title == TC && ((i % tb_attr->title_mod

) == 0))

src/report/report-formatter-html.cpp +3 -0
+				addf_exact("<th class=\"%s\"> %s </th> ", tb_attr->th_class,
+					system_data[offset].c_str());
+			else if (tb_attr->pos_table_title == TLC && ((i %
Quoted 1 line

tb_attr->title_mod) == 0 || j==0))

this is cryptic.
can we change enum to contain TOP, LEFT, CENTER and so, it will make code better:

	`tb_attr->pos_table_title == T' vs `tb_attr->pos_table_title ==
POSITION_TOP'
	or `tb_attr->pos_table_title == TOP'

	-ss
Quoted 53 lines
src/report/report-formatter-html.cpp +14 -0
+				addf_exact("<th class=\"%s\"> %s </th> ", tb_attr->th_class,
+				system_data[offset].c_str());
+			else
+				if ( tb_attr->td_class == empty)
+					addf_exact("<td > %s </td> ", system_data[offset].c_str());
+				else
+					addf_exact("<td class=\"%s\"> %s </td> ", tb_attr->td_class,
+						system_data[offset].c_str());
+		}
+		add_exact("</tr>\n");
+	}
+	add_exact("</table>\n");
+}
+
src/report/report-formatter-html.h +7 -3
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];
--

1.7.9.5

Quoted 6 lines
Quoted 5 lines

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

This is a good point. I didn't think about that. We could do that.

Thank you,
Alexandra.

author
#14 lore raw

PATCH v3 10/31 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
#15 lore raw

PATCH v3 11/31 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
#16 lore raw

PATCH v3 12/31 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 f508ae0..aeecdde 100644
@@ -536,7 +536,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;
@@ -547,14 +547,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
#17 lore raw

PATCH v3 13/31 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 ce7dbb2..19b9484 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',
@@ -76,190 +76,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
#18 lore raw

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

In reply to Alexandra Yates

Generates html and csv report with redesign summary preserving translation macros.

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..df7d646 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
#19 lore raw

PATCH v3 15/31 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 19b9484..d724ead 100644
@@ -44,7 +44,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]));
@@ -216,51 +216,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
#20 lore raw

PATCH v3 16/31 report: CPU Idle section redesigned html & csv

In reply to Alexandra Yates

Enables "CPU Idle" section redesign for html and csv reports preserving translation macros.

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..b8f74a8 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
#21 lore raw

PATCH v3 17/31 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 d724ead..38daa1f 100644
@@ -262,4 +262,4 @@ div.hide {
 </head>
 
 <body onload='powertop.onload();'>
-
+<div id=\"main_container\">
src/process/do_process.cpp +1 -1
index df7d646..c676978 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 aeecdde..d6a8a6a 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
#22 lore raw

PATCH v3 18/31 report: CPU Frequency html & csv

In reply to Alexandra Yates

Enables html and csv report new stlyes for "CPU Frequency" section, While preserving translation macros.

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 b8f74a8..c3787e6 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
#23 lore raw

Re: [Powertop] [PATCH v3 18/31] report: CPU Frequency html & csv

Quoted 111 lines · Alexandra Yates

Enables html and csv report new stlyes for "CPU Frequency" section, While preserving translation macros.

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 +60 -10
index b8f74a8..c3787e6 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;

src/cpu/cpu.cpp void report_display_cpu_pstates(void) · line 711

Quoted 10 lines
src/cpu/cpu.cpp +5 -2
 				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;

initialisation:

       report.begin_section(SECTION_CPUFREQ);
       report.add_header("Processor Frequency Report");

       report.begin_table(TABLE_WIDE);

vs

       /* 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;

reporter usage:

         report.begin_cell(CELL_CORE_HEADER);
         report.addf(__("Core %i"), _core->get_number());

vs

         core_data[idx2]="";
         idx2+=1;
         sprintf(tmp_num,__("Core %d"),_core->get_number());
         core_data[idx2]=string(tmp_num);
         idx2+=1;

and

         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));

vs

         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;

sorry, but the existing one really looks easier to follow and use. current reporter user cares less about reporter internall details.

	-ss
Quoted 106 lines
src/cpu/cpu.cpp +36 -26
 					} 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 · 6 lines
1.7.9.5

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop
author
#24 lore raw

Re: [Powertop] [PATCH v3 18/31] report: CPU Frequency html & csv

Quoted 311 lines · Alexandra Yates
Quoted 113 lines

Enables html and csv report new stlyes for "CPU Frequency" section, While preserving translation macros.

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 +59 -7
index b8f74a8..c3787e6 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)
src/cpu/cpu.cpp +1 -3
 				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;

src/cpu/cpu.cpp void report_display_cpu_pstates(void) · line 711

Quoted 10 lines
src/cpu/cpu.cpp +5 -2
 				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;

initialisation:

       report.begin_section(SECTION_CPUFREQ);
       report.add_header("Processor Frequency Report");

       report.begin_table(TABLE_WIDE);

vs

       /* 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;

reporter usage:

         report.begin_cell(CELL_CORE_HEADER);
         report.addf(__("Core %i"), _core->get_number());

vs

         core_data[idx2]="";
         idx2+=1;
         sprintf(tmp_num,__("Core %d"),_core->get_number());
         core_data[idx2]=string(tmp_num);
         idx2+=1;

and

         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));

vs

         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;

sorry, but the existing one really looks easier to follow and use. current reporter user
cares less about reporter internall details.

	-ss
Quoted 102 lines
src/cpu/cpu.cpp +36 -26
 					} 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)
--
1.7.9.5

Quoted 6 lines
Quoted 5 lines

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

This is matter of opinion. I found this module the most difficult to
manipulate in general because the complexity of the current code.

If you look the other examples they are pretty straight forward.

Thank you,
Alexandra.

author
#25 lore raw

Re: [Powertop] [PATCH v3 18/31] report: CPU Frequency html & csv

Quoted 321 lines
Quoted 314 lines · Alexandra Yates
Quoted 114 lines

Enables html and csv report new stlyes for "CPU Frequency" section, While preserving translation macros.

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 +59 -7
index b8f74a8..c3787e6 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];
src/cpu/cpu.cpp +1 -3
 			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;

src/cpu/cpu.cpp void report_display_cpu_pstates(void) · line 711

Quoted 10 lines
src/cpu/cpu.cpp +5 -2
 				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;

initialisation:

       report.begin_section(SECTION_CPUFREQ);
       report.add_header("Processor Frequency Report");

       report.begin_table(TABLE_WIDE);

vs

       /* 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;

reporter usage:

         report.begin_cell(CELL_CORE_HEADER);
         report.addf(__("Core %i"), _core->get_number());

vs

         core_data[idx2]="";
         idx2+=1;
         sprintf(tmp_num,__("Core %d"),_core->get_number());
         core_data[idx2]=string(tmp_num);
         idx2+=1;

and

         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));

vs

         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;

sorry, but the existing one really looks easier to follow and use. current
reporter user
cares less about reporter internall details.

	-ss
Quoted 102 lines
src/cpu/cpu.cpp +36 -26
 					} 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)
--
1.7.9.5

Quoted 6 lines
Quoted 5 lines

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

Quoted 8 lines

This is matter of opinion. I found this module the most difficult to
manipulate in general because the complexity of the current code.

If you look the other examples they are pretty straight forward.

Thank you,
Alexandra.

Hi Sergey,

I gave more thought at your feedback and you are right to bring attention to the items here. As I mentioned before during this iteration of changes I tried to reuse as much code as possible, therefore the current result is not optimal.

However, it is part of my plan to continue changing the UI code to remove clutter like the once you pointed. But this changes will come in the next phase of development, because it will be more intrusive. The current changes are incremental so that we have a chance to do testing in between the big changes of the UI.

Thank you again for taking the time to look at my code and your feedback, I will make sure to incorporate it as a requirement for phase two.

Alexandra.

#26 lore raw

Re: [Powertop] [PATCH v3 18/31] report: CPU Frequency html & csv

Quoted 1 line · Alexandra Yates
Quoted 1 line
Quoted 1 line · Alexandra Yates

[..]

Quoted 82 lines
Quoted 82 lines
Quoted 82 lines

initialisation:

       report.begin_section(SECTION_CPUFREQ);
       report.add_header("Processor Frequency Report");

       report.begin_table(TABLE_WIDE);

vs

       /* 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;

reporter usage:

         report.begin_cell(CELL_CORE_HEADER);
         report.addf(__("Core %i"), _core->get_number());

vs

         core_data[idx2]="";
         idx2+=1;
         sprintf(tmp_num,__("Core %d"),_core->get_number());
         core_data[idx2]=string(tmp_num);
         idx2+=1;

and

         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));

vs

         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;

sorry, but the existing one really looks easier to follow and use. current
reporter user
cares less about reporter internall details.

[..]

Quoted 11 lines
Quoted 9 lines

This is matter of opinion. I found this module the most difficult to
manipulate in general because the complexity of the current code.

If you look the other examples they are pretty straight forward.

Thank you,
Alexandra.

Hi Sergey,

Hi,

Quoted 4 lines

I gave more thought at your feedback and you are right to bring attention to the items here. As I mentioned before during this iteration of changes I tried to reuse as much code as possible, therefore the current result is not optimal.

and saying that you pushed NACK-ed patchset to the master. there is a git branch' command for incremental-make-it-ready-for-master' work. my concerns are not about some fancy coding styles or my own opinion. new reporter API simply asks for error. and you made off by one error using your own `pretty straight forward' API.

[PATCH 19/31]

+ int show_power, cols, rows, idx;

[..]

+ cols=7;
+ if (show_power)
+ cols=8;

[..]

+ if (show_power)
+ software_data[7]=__("PW Estimate");
+
+ sort(all_power.begin(), all_power.end(), power_cpu_sort);
+ show_power = global_power_valid();

[..]

+ 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;
                }

I'm not sure that powertop master now even works.

	-ss
Quoted 10 lines

However, it is part of my plan to continue changing the UI code to remove clutter like the once you pointed. But this changes will come in the next phase of development, because it will be more intrusive. The current changes are incremental so that we have a chance to do testing in between the big changes of the UI.

Thank you again for taking the time to look at my code and your feedback, I will make sure to incorporate it as a requirement for phase two.

Alexandra.

#27 lore raw

Re: [Powertop] [PATCH v3 18/31] report: CPU Frequency html & csv

Quoted 112 lines · On Thu, 12 Dec 2013 11:02:19 +0300 Sergey Senozhatsky…
Quoted 1 line · Alexandra Yates
Quoted 1 line
Quoted 1 line · Alexandra Yates

[..]

Quoted 82 lines
Quoted 82 lines
Quoted 82 lines

initialisation:

       report.begin_section(SECTION_CPUFREQ);
       report.add_header("Processor Frequency Report");

       report.begin_table(TABLE_WIDE);

vs

       /* 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;

reporter usage:

         report.begin_cell(CELL_CORE_HEADER);
         report.addf(__("Core %i"), _core->get_number());

vs

         core_data[idx2]="";
         idx2+=1;
         sprintf(tmp_num,__("Core %d"),_core->get_number());
         core_data[idx2]=string(tmp_num);
         idx2+=1;

and

         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));

vs

         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;

sorry, but the existing one really looks easier to follow and use. current
reporter user
cares less about reporter internall details.

[..]

Quoted 11 lines
Quoted 9 lines

This is matter of opinion. I found this module the most difficult to
manipulate in general because the complexity of the current code.

If you look the other examples they are pretty straight forward.

Thank you,
Alexandra.

Hi Sergey,

Hi,

Quoted 4 lines

I gave more thought at your feedback and you are right to bring attention to the items here. As I mentioned before during this iteration of changes I tried to reuse as much code as possible, therefore the current result is not optimal.

and saying that you pushed NACK-ed patchset to the master. there is a git branch' command for incremental-make-it-ready-for-master' work. my concerns are not about some fancy coding styles or my own opinion. new reporter API simply asks for error. and you made off by one error using your own `pretty straight forward' API.

[snip]

Quoted 4 lines

I'm not sure that powertop master now even works.

	-ss

Hi Sergey,
Pushing Alex's patches, despite the very legitimate issues you raised, was my call. I did this to force testing on them. Anyone who is looking for stable powertop should be using a tagged release. As much as I appreciate that your point of view with regard to having branches for development (i.e. your next tree, or any other branch) my feeling is that nobody will test these. Because this UI change is something we want for 2.6, I decided it was better to push it to master early on and get the bugs worked out upstream than hang onto it until it was complete and integrate it too close to March. I thought sooner rather than later was better, so we could get as much testing time as possible on them.

Kristen

author
#28 lore raw

PATCH v3 19/31 report: redesign Software Information csv and html

In reply to Alexandra Yates

Enabled "Overview of Software Power Consumers" section for csv and html report redesign, while preserving translation macros.

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 c676978..6fc7a5b 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
#29 lore raw

Re: [Powertop] [PATCH v3 19/31] report: redesign Software Information csv and html

Quoted 123 lines · Alexandra Yates

Enabled "Overview of Software Power Consumers" section for csv and html report redesign, while preserving translation macros.

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 +44 -31
index c676978..6fc7a5b 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);

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

Quoted 10 lines
src/process/do_process.cpp +10 -0
+		idx+=1;
+
+		software_data[idx]=string(disks);
+		idx+=1;
+
+		software_data[idx]=string(xwakes);
+		idx+=1;
+
+		software_data[idx]=string(name);
+		idx+=1;

/** just a side note*/

I think C++ can help us. we can just declare std::vector and push_back().

	-ss
Quoted 76 lines
src/process/do_process.cpp +10 -17
+		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 · 6 lines
1.7.9.5

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop
author
#30 lore raw

PATCH v3 20/31 report: redesign Device Power Report csv & html

In reply to Alexandra Yates

Redesign Device Power Report table part of "Device Info" section, while preserving translation macros.

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..4120b9c 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
#31 lore raw

PATCH v3 21/31 report: Redesign Device Activity csv & html report

In reply to Alexandra Yates

Enables new design for "Process Device Activity" table part of "Device info" section, while preserving translation macros.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/devices/device.cpp |    1 -
 src/devlist.cpp        |   46 +++++++++++++++++++++++++++++++---------------
 2 files changed, 31 insertions(+), 16 deletions(-)
src/devices/device.cpp +0 -1
index 4120b9c..83ee02f 100644
@@ -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 +31 -15

73 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#32 lore raw

PATCH v3 22/31 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 3b46f58..56232a6 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
#33 lore raw

PATCH v3 23/31 report: report tuning with new desig html & csv

In reply to Alexandra Yates

Changes tunning reporting calls to use the new design on html and csv reports, while preserving the translation macros.

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
#34 lore raw

PATCH v3 24/31 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          |    4 ++--
 src/devlist.cpp                 |    4 +---
 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(+), 20 deletions(-)
src/devices/device.cpp +2 -2
index 83ee02f..a916bf6 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;
src/devlist.cpp +1 -3
index ada3538..1b99490 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,6 +328,7 @@ void report_show_open_devices(void)
 	}
 
 	/* Report Output */
+	/* 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 38daa1f..ff86880 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){
@@ -85,6 +85,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;
@@ -207,15 +214,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 8a41114..ad73b2e 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
#35 lore raw

PATCH v3 25/31 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 ad73b2e..67d604f 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
#36 lore raw

PATCH v3 26/31 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, while preserving the translation macros.

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 a916bf6..da595a8 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
#37 lore raw

PATCH v3 27/31 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
#38 lore raw

PATCH v3 28/31 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 ff86880..847f25f 100644
@@ -105,8 +105,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 d6a8a6a..f52408b 100644
@@ -520,7 +520,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
#39 lore raw

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

In reply to Alexandra Yates

Remove suggestion to use the on-demand cpu frequency governor from PowerTOP tunables as that is no longer a good suggestion since the P-State driver is the Intel recommended replacement.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/Makefile.am        |    4 +-
 src/tuning/cpufreq.cpp |  213 ------------------------------------------------
 src/tuning/cpufreq.h   |   50 ------------
 src/tuning/tuning.cpp  |    2 -
 4 files changed, 2 insertions(+), 267 deletions(-)
 delete mode 100644 src/tuning/cpufreq.cpp
 delete mode 100644 src/tuning/cpufreq.h
src/Makefile.am +2 -2
index e19b606..0fe3c04 100644
@@ -18,8 +18,8 @@ powertop_SOURCES = parameters/persistent.cpp parameters/learn.cpp parameters/par
 		devices/thinkpad-light.cpp devices/ahci.h devices/i915-gpu.h devices/network.h \
 		devices/rfkill.cpp devices/alsa.h devices/thinkpad-fan.h devices/device.h \
 		devices/usb.h devices/backlight.h devices/backlight.cpp devices/runtime_pm.h \
-		devices/thinkpad-light.h devices/network.cpp lib.h tuning tuning/cpufreq.h \
-		tuning/bluetooth.cpp tuning/cpufreq.cpp tuning/tuning.cpp tuning/tuningusb.cpp \
+		devices/thinkpad-light.h devices/network.cpp lib.h tuning \
+		tuning/bluetooth.cpp tuning/tuning.cpp tuning/tuningusb.cpp \
 		tuning/ethernet.cpp tuning/bluetooth.h tuning/tuning.h tuning/ethernet.h \
 		tuning/tunable.cpp tuning/nl80211.h tuning/iw.c tuning/wifi.cpp tuning/tuningsysfs.h \
 		tuning/tuningsysfs.cpp tuning/wifi.h tuning/runtime.cpp tuning/tunable.h \
src/tuning/cpufreq.cpp deleted +0 -213

213 lines not on this page · raw message

src/tuning/cpufreq.h deleted +0 -50

50 lines not on this page · raw message

src/tuning/tuning.cpp +0 -2
index 67d604f..ec7d2ad 100644
@@ -35,7 +35,6 @@
 #include "tuningusb.h"
 #include "runtime.h"
 #include "bluetooth.h"
-#include "cpufreq.h"
 #include "ethernet.h"
 #include "wifi.h"
 #include "../display.h"
@@ -67,7 +66,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
#40 lore raw

Re: [Powertop] [PATCH v3 29/31] tunables: removed on-demand cpu frequency governor

Quoted 3 lines · Alexandra Yates

Remove suggestion to use the on-demand cpu frequency governor from PowerTOP tunables as that is no longer a good suggestion since the P-State driver is the Intel recommended replacement.

I need to think about it.

IIRC, in this email
https://lists.01.org/pipermail/powertop/2013-September/000952.html

Quoted 8 lines · Christian Krause

tunables show:

Bad Using 'ondemand' cpufreq governor

but: I don't have a ondemand cpufreq governor -- that is what I just found out: since some kernel versions ago the intel_pstate driver is the default for my cpu:

Quoted 9 lines
   # zgrep PSTATE /proc/config.gz
   CONFIG_X86_INTEL_PSTATE=y
   # cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_driver
   intel_pstate
   intel_pstate
   intel_pstate
   intel_pstate

I'm not really sure why we delete cpufreq code and kill this feature.

for example:

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
ondemand performance
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance

powertop can help here

	-ss
Quoted 328 lines
Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/Makefile.am        |    4 +-
 src/tuning/cpufreq.cpp |  213 ------------------------------------------------
 src/tuning/cpufreq.h   |   50 ------------
 src/tuning/tuning.cpp  |    2 -
 4 files changed, 2 insertions(+), 267 deletions(-)
 delete mode 100644 src/tuning/cpufreq.cpp
 delete mode 100644 src/tuning/cpufreq.h
src/Makefile.am +2 -2
index e19b606..0fe3c04 100644
@@ -18,8 +18,8 @@ powertop_SOURCES = parameters/persistent.cpp parameters/learn.cpp parameters/par
 		devices/thinkpad-light.cpp devices/ahci.h devices/i915-gpu.h devices/network.h \
 		devices/rfkill.cpp devices/alsa.h devices/thinkpad-fan.h devices/device.h \
 		devices/usb.h devices/backlight.h devices/backlight.cpp devices/runtime_pm.h \
-		devices/thinkpad-light.h devices/network.cpp lib.h tuning tuning/cpufreq.h \
-		tuning/bluetooth.cpp tuning/cpufreq.cpp tuning/tuning.cpp tuning/tuningusb.cpp \
+		devices/thinkpad-light.h devices/network.cpp lib.h tuning \
+		tuning/bluetooth.cpp tuning/tuning.cpp tuning/tuningusb.cpp \
 		tuning/ethernet.cpp tuning/bluetooth.h tuning/tuning.h tuning/ethernet.h \
 		tuning/tunable.cpp tuning/nl80211.h tuning/iw.c tuning/wifi.cpp tuning/tuningsysfs.h \
 		tuning/tuningsysfs.cpp tuning/wifi.h tuning/runtime.cpp tuning/tunable.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
deleted file mode 100644
index 983f813..0000000
@@ -1,50 +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>
- */
-#ifndef _INCLUDE_GUARD_CPUFREQ_TUNE_H
-#define _INCLUDE_GUARD_CPUFREQ_TUNE_H
-
-#include <vector>
-
-#include "tunable.h"
-
-using namespace std;
-
-class cpufreq_tunable : public tunable {
-	char original[4096];
-public:
-	cpufreq_tunable(void);
-
-	virtual int good_bad(void);
-
-	virtual void toggle(void);
-
-	virtual const char *toggle_script(void);
-
-};
-
-extern void add_cpufreq_tunable(void);
-
-
-#endif
src/tuning/tuning.cpp +0 -2
index 67d604f..ec7d2ad 100644
@@ -35,7 +35,6 @@
 #include "tuningusb.h"
 #include "runtime.h"
 #include "bluetooth.h"
-#include "cpufreq.h"
 #include "ethernet.h"
 #include "wifi.h"
 #include "../display.h"
@@ -67,7 +66,6 @@ static void init_tuning(void)
 	add_ethernet_tunable();
 	add_bt_tunable();
 	add_wifi_tunables();
-	add_cpufreq_tunable();
 
 	sort_tunables();
 }
Signature · 6 lines
1.7.9.5

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

Re: [Powertop] [PATCH v3 29/31] tunables: removed on-demand cpu frequency governor

Quoted 46 lines · On Tue, 10 Dec 2013 23:27:52 +0300 Sergey Senozhatsky…
Quoted 3 lines · Alexandra Yates

Remove suggestion to use the on-demand cpu frequency governor from PowerTOP tunables as that is no longer a good suggestion since the P-State driver is the Intel recommended replacement.

I need to think about it.

IIRC, in this email
https://lists.01.org/pipermail/powertop/2013-September/000952.html

Quoted 8 lines · Christian Krause

tunables show:

Bad Using 'ondemand' cpufreq governor

but: I don't have a ondemand cpufreq governor -- that is what I just found out: since some kernel versions ago the intel_pstate driver is the default for my cpu:

Quoted 9 lines
   # zgrep PSTATE /proc/config.gz
   CONFIG_X86_INTEL_PSTATE=y
   # cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_driver
   intel_pstate
   intel_pstate
   intel_pstate
   intel_pstate

I'm not really sure why we delete cpufreq code and kill this feature.

for example:

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
ondemand performance
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance
Quoted 5 lines

powertop can help here

	-ss

Actually, in most cases using performance would be preferred over ondemand unless you are on ancient hardware. You may be interested in reading this article which sort of summarizes the situation.

http://www.phoronix.com/scan.php?page=news_item&px=MTM3NDQ

author
#42 lore raw

PATCH v3 30/31 report-cleanup: removed old table, row, & cell.

In reply to Alexandra Yates

The old add table headder, add row, add cell and add empty cell were removed since they are replaced by the new add_table function for html and csv reports.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter-csv.cpp  |   66 ---------
 src/report/report-formatter-csv.h    |   12 +-
 src/report/report-formatter-html.cpp |  270 +---------------------------------
 src/report/report-formatter-html.h   |   42 ------
 src/report/report-formatter.h        |   10 --
 src/report/report-maker.cpp          |  118 +--------------
 src/report/report-maker.h            |   10 +-
 7 files changed, 6 insertions(+), 522 deletions(-)
src/report/report-formatter-csv.cpp +0 -66
index 0ab1091..941f722 100644
@@ -91,55 +91,6 @@ report_formatter_csv::end_section()
 }
 
 /* ************************************************************************ */
-
-void
-report_formatter_csv::begin_table(table_type ttype)
-{
-	add_exact("\n");
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::end_table()
-{
-	add_exact("\n");
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::begin_row(row_type rtype)
-{
-	table_cell_number = 0;
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::end_row()
-{
-	add_exact("\n");
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::begin_cell(cell_type ctype)
-{
-	if (table_cell_number > 0) {
-		addf_exact("%c", REPORT_CSV_DELIMITER);
-#ifdef REPORT_CSV_ADD_SPACE
-		add_exact(" ");
-#endif /* !REPORT_CSV_ADD_SPACE */
-	}
-
-	text_start = result.length();
-	csv_need_quotes = false;
-}
-
-/* ************************************************************************ */
-
 void
 report_formatter_csv::add_quotes()
 {
@@ -156,23 +107,6 @@ report_formatter_csv::add_quotes()
 /* ************************************************************************ */
 
 void
-report_formatter_csv::end_cell()
-{
-	add_quotes();
-	table_cell_number++;
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::add_empty_cell()
-{
-	/* Do nothing special */
-}
-
-/* ************************************************************************ */
-
-void
 report_formatter_csv::begin_paragraph()
 {
 	text_start = result.length();
src/report/report-formatter-csv.h +1 -11
index 198f597..6336e2c 100644
@@ -58,16 +58,6 @@ public:
 	void begin_section(section_type stype);
 	void end_section();
 
-	void begin_table(table_type ttype);
-	void end_table();
-
-	void begin_row(row_type rtype);
-	void end_row();
-
-	void begin_cell(cell_type ctype);
-	void end_cell();
-	void add_empty_cell();
-
 	void begin_paragraph();
 	void end_paragraph();
 
@@ -92,7 +82,7 @@ private:
 	string escape_string(const char *str);
 
 	bool csv_need_quotes;
-	size_t table_cell_number, text_start;
+	size_t text_start;
 };
 
 #endif /* _REPORT_FORMATTER_CSV_H_ */
src/report/report-formatter-html.cpp +1 -269

294 lines not on this page · raw message

src/report/report-formatter-html.h +0 -42

66 lines not on this page · raw message

src/report/report-formatter.h +0 -10
index 7984dc5..6d31759 100644
@@ -46,16 +46,6 @@ public:
 	virtual void begin_section(section_type stype) {}
 	virtual void end_section() {}
 
-	virtual void begin_table(table_type ttype) {}
-	virtual void end_table() {}
-
-	virtual void begin_row(row_type rtype) {}
-	virtual void end_row() {}
-
-	virtual void begin_cell(cell_type ctype) {}
-	virtual void end_cell() {}
-	virtual void add_empty_cell() {}
-
 	virtual void begin_paragraph() {}
 	virtual void end_paragraph() {}
 
src/report/report-maker.cpp +3 -115

148 lines not on this page · raw message

src/report/report-maker.h +1 -9
index f6897cf..cfa25dd 100644
@@ -184,10 +184,6 @@ public:
 
 	void add_header(const char *header, int level = 2);
 	void begin_section(section_type stype = SECTION_DEFAULT);
-	void begin_table(table_type ttype = TABLE_DEFAULT);
-	void begin_row(row_type rtype = ROW_DEFAULT);
-	void begin_cell(cell_type ctype = CELL_DEFAULT);
-	void add_empty_cell();
 	void begin_paragraph();
 
 	void set_cpu_number(int nr);
@@ -207,15 +203,11 @@ private:
 	void setup_report_formatter();
 
 	void end_section();
-	void end_table();
-	void end_row();
-	void end_cell();
 	void end_paragraph();
 
 	report_type type;
 	report_formatter *formatter;
-	bool cell_opened, row_opened, table_opened, section_opened,
-	     paragraph_opened;
+	bool section_opened, paragraph_opened;
 };
 
 #endif /* _REPORT_MAKER_H_ */
Signature · 1 line
1.7.9.5
author
#43 lore raw

PATCH v3 31/31 report-cleanup: removed html & csv old methods

In reply to Alexandra Yates

Removed old methods that handled adding and removing header, section, paragraph, quotes, and remaining enums related to the previous implementation of table, row, cell and its corresponding css formatting. All these methods were replaced by the previously commited html and csv design methods.

Signed-off-by Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter-csv.cpp  |   87 ++----------------------------
 src/report/report-formatter-csv.h    |   19 +------
 src/report/report-formatter-html.cpp |   64 +---------------------
 src/report/report-formatter-html.h   |   17 +-----
 src/report/report-formatter.h        |   13 +----
 src/report/report-maker.cpp          |   91 +------------------------------
 src/report/report-maker.h            |   97 ++++------------------------------
 src/report/report.cpp                |    2 +-
 8 files changed, 21 insertions(+), 369 deletions(-)
src/report/report-formatter-csv.cpp +4 -83
index 941f722..a6787c1 100644
@@ -35,94 +35,20 @@
 #include "report-formatter-csv.h"
 #include "report-data-html.h"
 
-static const char report_csv_header[] = "PowerTOP Report";
 
 /* ************************************************************************ */
-
 report_formatter_csv::report_formatter_csv()
 {
-	add_doc_header();
+	/* Do nothing special  */
 }
 
 /* ************************************************************************ */
-
 void
 report_formatter_csv::finish_report()
 {
 	/* Do nothing special */
 }
 
-/* ************************************************************************ */
-
-void
-report_formatter_csv::add_doc_header()
-{
-	/*add_header(report_csv_header, 1);*/
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::add_header(const char *header, int level)
-{
-	assert(header);
-
-	text_start = result.length();
-	csv_need_quotes = false;
-	addf("%.*s%s%.*s", 4 - level, "***", header, 4 - level, "***");
-	add_quotes();
-	add_exact("\n");
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::begin_section(section_type stype)
-{
-	/* Do nothing special */
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::end_section()
-{
-	/* Do nothing special */
-}
-
-/* ************************************************************************ */
-void
-report_formatter_csv::add_quotes()
-{
-#ifdef REPORT_CSV_ESCAPE_EMPTY
-	if (csv_need_quotes || result.length() == text_start) {
-#else /* !REPORT_CSV_ESCAPE_EMPTY */
-	if (csv_need_quotes) {
-#endif /* !REPORT_CSV_ESCAPE_EMPTY */
-		result.insert(text_start, "\"");
-		add_exact("\"");
-	}
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::begin_paragraph()
-{
-	text_start = result.length();
-	csv_need_quotes = false;
-}
-
-/* ************************************************************************ */
-
-void
-report_formatter_csv::end_paragraph()
-{
-	add_quotes();
-	add_exact("\n");
-}
-
-/* ************************************************************************ */
 
 string
 report_formatter_csv::escape_string(const char *str)
@@ -150,13 +76,8 @@ report_formatter_csv::escape_string(const char *str)
 	return res;
 }
 
-/* ************************************************************************ */
 
-void
-report_formatter_csv::set_cpu_number(int nr UNUSED)
-{
-	/* Do nothing */
-}
+
 
 /* Report Style */
 void
@@ -166,7 +87,7 @@ report_formatter_csv::add_header()
 }
 
 void
-report_formatter_csv::end_hheader()
+report_formatter_csv::end_header()
 {
 	/* Do nothing */
 }
@@ -174,7 +95,7 @@ report_formatter_csv::end_hheader()
 void
 report_formatter_csv::add_logo()
 {
-	add_exact("\t\t\tP o w e r T o p\n");
+	add_exact("\t\t\tP o w e r T O P\n");
 }
 
 
src/report/report-formatter-csv.h +2 -17
index 6336e2c..7edfc01 100644
@@ -31,7 +31,7 @@
 #include "report-formatter-base.h"
 
 /* Offices like semicolon separated values instead of comma */
-#define REPORT_CSV_DELIMITER ';'
+#define REPORT_CSV_DELIMITER ','
 
 /* "a,b,c" vs "a, b, c" */
 /*#define REPORT_CSV_ADD_SPACE*/
@@ -50,23 +50,12 @@ class report_formatter_csv: public report_formatter_string_base
 {
 public:
 	report_formatter_csv();
-
 	void finish_report();
 
-	void add_header(const char *header, int level);
-
-	void begin_section(section_type stype);
-	void end_section();
-
-	void begin_paragraph();
-	void end_paragraph();
-
-	void set_cpu_number(int nr);
-
 	/* Report Style */
 	void add_logo();
 	void add_header();
-	void end_hheader();
+	void end_header();
 	void add_div(struct tag_attr *div_attr);
 	void end_div();
 	void add_title(struct tag_attr *title_att, const char *title);
@@ -75,12 +64,8 @@ public:
 	void add_table(string *system_data, struct table_attributes *tb_attr);
 
 private:
-	void add_doc_header();
-
 	void add_quotes();
-
 	string escape_string(const char *str);
-
 	bool csv_need_quotes;
 	size_t text_start;
 };
src/report/report-formatter-html.cpp +1 -63

88 lines not on this page · raw message

src/report/report-formatter-html.h +1 -16
index 9ba3edf..c003fd9 100644
@@ -48,23 +48,12 @@ class report_formatter_html: public report_formatter_string_base
 {
 public:
 	report_formatter_html();
-
 	void finish_report();
 
-	void add_header(const char *header, int level);
-
-	void begin_section(section_type stype);
-	void end_section();
-
-	void begin_paragraph();
-	void end_paragraph();
-
-	void set_cpu_number(int nr);
-
 	/* Report Style */
 	void add_logo();
 	void add_header();
-	void end_hheader();
+	void end_header();
 	void add_div(struct tag_attr *div_attr);
 	void end_div();
 	void add_title(struct tag_attr *title_att, const char *title);
@@ -75,14 +64,10 @@ public:
 private:
 	/* Document structure related functions */
 	void init_markup();
-	void set_section(section_type stype, const char *id = "");
 	void add_doc_header();
 	void add_doc_footer();
-
 	string escape_string(const char *str);
 
-	html_section sections[SECTION_MAX];
-	int cpu_nr;
 };
 
 #endif /* _REPORT_FORMATTER_HTML_H_ */
src/report/report-formatter.h +1 -12
index 6d31759..940b5cf 100644
@@ -41,21 +41,10 @@ public:
 	virtual void add(const char *str) {}
 	virtual void addv(const char *fmt, va_list ap) {}
 
-	virtual void add_header(const char *header, int level) {}
-
-	virtual void begin_section(section_type stype) {}
-	virtual void end_section() {}
-
-	virtual void begin_paragraph() {}
-	virtual void end_paragraph() {}
-
-	/* 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() {}
+	virtual void end_header() {}
 	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) {}
src/report/report-maker.cpp +2 -89

128 lines not on this page · raw message

src/report/report-maker.h +9 -88

141 lines not on this page · raw message

src/report/report.cpp +1 -1
index 56232a6..9e94607 100644
@@ -155,7 +155,7 @@ static void system_info(void)
 	report.add_title(&title_attr, __("System Information"));
 	report.add_table(system_data, &sys_table);
 	report.end_div();
-	report.end_hheader();
+	report.end_header();
 	report.add_navigation();
 }
 
Signature · 1 line
1.7.9.5
#44 lore raw
In reply to Alexandra Yates
Quoted 10 lines · Alexandra Yates

This patches are to be applied post release 2.5.

This set of patches include the redesign changes for HTML and CSV reports and cleans up unused reporting functions. Additionally, removes 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.

Igor Zhbanov reported that the localization macro __(…) was left out from previous version. These patches changed to add the localization macro to all report components.

Hello Alexandra,

thanks for your patches. I'll take a look in a week or two [sorry to tell that, really don't have enough time at the moment].

and thanks to Igor Zhbanov for review.

thanks,

	-ss
Quoted 68 lines

Alexandra Yates (31):
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 Software Information csv and html
report: redesign Device Power Report csv & html
report: Redesign Device Activity csv & html report
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
report-cleanup: removed old table, row, & cell.
report-cleanup: removed html & csv old methods

 PowerTop.png                         |  Bin 0 -> 6975 bytes
 src/Makefile.am                      |    5 +-
 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  |  189 ++++++---------
 src/report/report-formatter-csv.h    |   42 ++--
 src/report/report-formatter-html.cpp |  417 +++++++++-------------------------
 src/report/report-formatter-html.h   |   71 ++----
 src/report/report-formatter.h        |   32 +--
 src/report/report-maker.cpp          |  180 ++-------------
 src/report/report-maker.h            |  114 ++--------
 src/report/report.cpp                |   83 ++++---
 src/tuning/cpufreq.cpp               |  213 -----------------
 src/tuning/cpufreq.h                 |   50 ----
 src/tuning/tuning.cpp                |  131 ++++++-----
 21 files changed, 1142 insertions(+), 1551 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 · 6 lines
1.7.9.5

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