Report Redesign
Alexandra Yates
v2 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, 1141 insertions(+), 1552 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
Alexandra Yates
PATCH v2 1/31 report-formater-html: add logo
Adds html new logo implementation
--- 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
src/report/report-formatter-html.cpp +18 -0
@@ -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
@@ -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
Alexandra Yates
PATCH v2 2/31 report: call powertop logo
In reply to Alexandra YatesImplements add_logo in report generator
--- 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
@@ -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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 3/31 html-report: add title and div tags
In reply to Alexandra YatesImplements add_title and add_div methods that pass css attributes for modular styling.
--- src/report/report-data-html.h | 4 ++++ src/report/report-formatter-html.cpp | 33 +++++++++++++++++++++++++++++++++ src/report/report-formatter-html.h | 5 ++++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/report/report-data-html.h
src/report/report-data-html.h new file +4 -0
@@ -0,0 +1,4 @@ +struct tag_attr { +const char *css_class; +const char *css_id; +};
src/report/report-formatter-html.cpp +33 -0
@@ -464,6 +464,8 @@ report_formatter_html::set_cpu_number(int nr) cpu_nr = nr; } + +/* Report Style */ void report_formatter_html::add_logo() {
@@ -481,3 +483,34 @@ report_formatter_html::end_hheader() { add_exact("</header>\n\n"); } +void +report_formatter_html::add_div(struct tag_attr * div_attr) +{ + std::string empty=""; + std::string tmp_str; + + if (div_attr->css_class == empty && div_attr->css_id == empty) + add_exact("<div>\n"); + + else if (div_attr->css_class == empty && div_attr->css_id != empty) + addf_exact("<div id=\"%s\">\n", div_attr->css_id); + + else if (div_attr->css_class != empty && div_attr->css_id == empty) + addf_exact("<div class=\"%s\">\n", div_attr->css_class); + + else if (div_attr->css_class != empty && div_attr->css_id != empty) + addf_exact("<div class=\"%s\" id=\"%s\">\n", div_attr->css_class, div_attr->css_id); +} + +void +report_formatter_html::end_div() +{ + add_exact("</div>\n"); +} + +void +report_formatter_html::add_title(struct tag_attr *title_att, const char *title) +{ + addf_exact("<h2 class=\"%s\"> %s </h2>\n", title_att->css_class, title); +} +
src/report/report-formatter-html.h +4 -1
@@ -29,7 +29,7 @@#include <string> #include "report-formatter-base.h" - +#include "report-data-html.h" /* Whether to replace " and ' in HTML by " and ' 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
Igor Zhbanov
Re: [Powertop] [PATCH v2 03/31] html-report: add title and div tags
Hi Alexandra,
Alexandra Yates wrote:
...
Quoted 7 lines
src/report/report-formatter-html.cpp +7
-0+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)
src/report/report-formatter-html.cpp report_formatter_html::end_hheader() · line 502
Quoted 10 lines
src/report/report-formatter-html.cpp +10
-0+ 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);
Please use indentation like:
if (something)
do_something(); else if (other) do_something else();
Signature · 9 lines
Best regards, Igor Zhbanov, Expert Software Engineer, phone: +7 (495) 797 25 00 ext 3981 e-mail: i.zhbanov(a)samsung.com Mobile group, Moscow R&D center, Samsung Electronics 12 Dvintsev street, building 1 127018, Moscow, Russian Federation
Alexandra Yates
PATCH v2 4/31 report: report maker add title and div
In reply to Alexandra YatesCalls to add a title and add a division from report maker using report object to the generated report.
--- 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
@@ -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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 5/31 report-csv: title, div, logo, header
In reply to Alexandra YatesImplements csv report functionality to add title, division, header, and logo.
--- 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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 6/31 report-html: summary list and navigation
In reply to Alexandra YatesGenerates the html tags to add navigation and summary including css attribute support.
--- 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
@@ -514,3 +514,21 @@ report_formatter_html::add_title(struct tag_attr *title_att, const char *title) addf_exact("<h2 class=\"%s\"> %s </h2>\n", title_att->css_class, title); } +void +report_formatter_html::add_navigation() +{ + add_exact("<br/><nav id=\"main_menu\"> </nav>\n"); +} + +void +report_formatter_html::add_summary_list(std::string *list, int size) +{ + int i; + add_exact("<div><br/> <ul>\n"); + for (i=0; i < size; i+=2){ + addf_exact("<li class=\"summary_list\"> <b> %s </b> %s </li>", + list[i].c_str(), list[i+1].c_str()); + } + add_exact("</ul> </div> <br />\n"); +} +
src/report/report-formatter-html.h +2 -0
@@ -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
Alexandra Yates
PATCH v2 7/31 report-maker: navigation & summary
In reply to Alexandra YatesImplements methods to generate navigation and summary from the report object.
--- 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
@@ -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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 8/31 report-csv: Added navigation & summary list
In reply to Alexandra YatesImplements csv report functionality to add navigation and summary on the csv report.
--- 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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 9/31 report-html: Table generation
In reply to Alexandra YatesGenerates 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.
--- 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
@@ -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
@@ -30,6 +30,9 @@#include "report-formatter-base.h" #include "report-data-html.h" + +using namespace std; +/* Whether to replace " and ' in HTML by " and ' 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
Alexandra Yates
PATCH v2 10/31 report-maker: modular table generation
In reply to Alexandra YatesGenerates 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.
--- 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
@@ -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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 11/31 report-csv: modular table
In reply to Alexandra YatesGenerates 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.
--- 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
@@ -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 == " ") + 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
@@ -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
Alexandra Yates
PATCH v2 12/31 report: Logo and system Information
In reply to Alexandra YatesReports PowerTop logo and the system information table with the redesign css and organization.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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 == " ") 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
@@ -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
@@ -534,7 +534,7 @@ report_formatter_html::add_summary_list(string *list, int size) void -report_formatter_html::add_table(string *system_data, struct table_size *size, struct table_attributes* tb_attr) +report_formatter_html::add_table(string *system_data, struct table_attributes* tb_attr) { int i, j; int offset=0;
@@ -545,14 +545,14 @@ report_formatter_html::add_table(string *system_data, struct table_size *size, s else addf_exact("<table class=\"%s\">\n", tb_attr->table_class); - for (i=0; i < size->rows; i++){ + for (i=0; i < tb_attr->rows; i++){ if (tb_attr->tr_class == empty) add_exact("<tr> "); else addf_exact("<tr class=\"%s\"> ", tb_attr->tr_class); - for (j=0; j < size->cols; j++){ - offset = i * (size->cols) + j; + for (j=0; j < tb_attr->cols; j++){ + offset = i * (tb_attr->cols) + j; if (tb_attr->pos_table_title == T && i==0) addf_exact("<th class=\"%s\"> %s </th> ",
src/report/report-formatter-html.h +1 -2
@@ -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
@@ -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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 13/31 report-html-css: html 5 and css for new design
In reply to Alexandra YatesRedesign css for effective readability of html report.
--- src/powertop.css | 216 ++++++++++++++++++++++-------------------------------- 1 file changed, 86 insertions(+), 130 deletions(-)
src/powertop.css +86 -130
@@ -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
Alexandra Yates
PATCH v2 14/31 report-summary: enable html and csv new styles
In reply to Alexandra YatesGenerates html and csv report with redesign summary preserving translation macros.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 15/31 report: redesign html menu
In reply to Alexandra YatesChanges menu design to align under logo and system Information following dashboard design rules for readability and functionality.
--- src/powertop.css | 57 +++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 29 deletions(-)
src/powertop.css +28 -29
@@ -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
Alexandra Yates
PATCH v2 16/31 report: CPU Idle section redesigned html & csv
In reply to Alexandra YatesEnables "CPU Idle" section redesign for html and csv reports preserving translation macros.
--- 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
@@ -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]=" "; + 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=="" ? " " : tmp_str); + idx1+=1; + tmp_str=string(_package->fill_cstate_line(line, buffer2)); + pkg_data[idx1]=(tmp_str=="" ? " " : 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=="" ? " " : tmp_str); + idx2+=1; + tmp_str=string(_core->fill_cstate_line(line, buffer2)); + core_data[idx2]=(tmp_str=="" ? " " : 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=="" ? " " : tmp_str); + idx3+=1; + + if (line != LEVEL_C0){ + tmp_str=string(_cpu->fill_cstate_time(line, buffer)); + cpu_data[idx3]=(tmp_str=="" ? " " : tmp_str); + idx3+=1; + } else { + cpu_data[idx3]=" "; + 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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 17/31 report: Fixed html summary & menu colapse styles
In reply to Alexandra YatesFixed summary to only show in the summary section. Also fixed page to avoid the menu to wrap around with the logo/system info section.
--- 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
@@ -262,4 +262,4 @@ div.hide { </head> <body onload='powertop.onload();'> - +<div id=\"main_container\">
src/process/do_process.cpp +1 -1
@@ -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
@@ -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
Alexandra Yates
PATCH v2 18/31 report: CPU Frequency html & csv
In reply to Alexandra YatesEnables html and csv report new stlyes for "CPU Frequency" section, While preserving translation macros.
--- src/cpu/cpu.cpp | 139 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 101 insertions(+), 38 deletions(-)
src/cpu/cpu.cpp +101 -38
@@ -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]=" "; + 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=="" ? " " : tmp_str); + idx1+=1; + tmp_str=string(_package->fill_pstate_line(line, buffer2)); + pkg_data[idx1]=(tmp_str=="" ? " " : 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=="" ? " " : tmp_str); + idx2+=1; + tmp_str=string(_core->fill_pstate_line(line, buffer2)); + core_data[idx2]= (tmp_str=="" ? " " : 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=="" ? " " : 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=="" ? " " : 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
Alexandra Yates
PATCH v2 19/31 report: redesign Software Information csv and html
In reply to Alexandra YatesEnabled "Overview of Software Power Consumers" section for csv and html report redesign, while preserving translation macros.
--- 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
@@ -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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 20/31 report: redesign Device Power Report csv & html
In reply to Alexandra YatesRedesign Device Power Report table part of "Device Info" section, while preserving translation macros.
--- src/devices/device.cpp | 72 +++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 37 deletions(-)
src/devices/device.cpp +35 -37
@@ -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
Alexandra Yates
PATCH v2 21/31 report: Redesign Device Activity csv & html report
In reply to Alexandra YatesEnables new design for "Process Device Activity" table part of "Device info" section, while preserving translation macros.
--- src/devices/device.cpp | 1 - src/devlist.cpp | 46 +++++++++++++++++++++++++++++++--------------- 2 files changed, 31 insertions(+), 16 deletions(-)
src/devices/device.cpp +0 -1
@@ -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
Alexandra Yates
PATCH v2 22/31 report: cleanup csv title and unused vars
In reply to Alexandra YatesRemoved old csv headder to avoid redundancy. Removed unused variables from report.cpp str2 and str3.
--- 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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 23/31 report: report tuning with new desig html & csv
In reply to Alexandra YatesChanges tunning reporting calls to use the new design on html and csv reports, while preserving the translation macros.
--- 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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 24/31 report-html: fixed not hidding sections errors
In reply to Alexandra YatesRemoved 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.
--- 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 | 9 +++++---- 6 files changed, 32 insertions(+), 19 deletions(-)
src/devices/device.cpp +2 -2
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 +5 -4
@@ -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,13 @@ void report_show_tunables(void) untunable_data[i+1]= string(all_untunables[i]->description()); /* Report Output */ +<<<<<<< HEAD report.add_div(&div_attr); report.add_title(&title_attr,__("Untunable Software Issues")); +======= + report.add_title(&title_attr,"Untunable Software Issues"); +>>>>>>> 4d9b82e... report-html: fixed not hidding sections errors report.add_table(untunable_data, &tune_table_css); - report.end_div(); /* Third Table */ /* Set Table attributes, rows, and cols */
@@ -283,7 +285,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
Igor Zhbanov
Re: [Powertop] [PATCH v2 24/31] report-html: fixed not hidding sections errors
Hi Alexandra,
Quoted 14 lines · 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 | 9 +++++---- 6 files changed, 32 insertions(+), 19 deletions(-)
...
Quoted 4 lines
src/tuning/tuning.cpp +0
-0
...
src/tuning/tuning.cpp void report_show_tunables(void) · line 259
Quoted 4 lines
src/tuning/tuning.cpp +0
-0@@ -258,10 +257,13 @@ void report_show_tunables(void) untunable_data[i+1]= string(all_untunables[i]->description()); /* Report Output */
Here is some garbage after merge.
Quoted 19 lines
src/tuning/tuning.cpp +4
-2+<<<<<<< HEAD report.add_div(&div_attr); report.add_title(&title_attr,__("Untunable Software Issues")); +======= + report.add_title(&title_attr,"Untunable Software Issues"); +>>>>>>> 4d9b82e... report-html: fixed not hidding sections errors report.add_table(untunable_data, &tune_table_css); - report.end_div(); /* Third Table */ /* Set Table attributes, rows, and cols */@@ -283,7 +285,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 · 9 lines
Best regards, Igor Zhbanov, Expert Software Engineer, phone: +7 (495) 797 25 00 ext 3981 e-mail: i.zhbanov(a)samsung.com Mobile group, Moscow R&D center, Samsung Electronics 12 Dvintsev street, building 1 127018, Moscow, Russian Federation
Alexandra Yates
PATCH v2 25/31 report: fixed empty SW settings in need of tunning
In reply to Alexandra YatesAfter 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.
--- src/tuning/tuning.cpp | 65 ++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 30 deletions(-)
src/tuning/tuning.cpp +35 -30
@@ -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 */
@@ -257,12 +267,7 @@ void report_show_tunables(void) untunable_data[i+1]= string(all_untunables[i]->description()); /* Report Output */ -<<<<<<< HEAD - report.add_div(&div_attr); report.add_title(&title_attr,__("Untunable Software Issues")); -======= - report.add_title(&title_attr,"Untunable Software Issues"); ->>>>>>> 4d9b82e... report-html: fixed not hidding sections errors report.add_table(untunable_data, &tune_table_css); /* Third Table */
Signature · 1 line
1.7.9.5
Igor Zhbanov
Re: [Powertop] [PATCH v2 25/31] report: fixed empty SW settings in need of tunning
Hi Alexandra,
Quoted 13 lines · 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 | 65 ++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 30 deletions(-)src/tuning/tuning.cpp +0
-0
...
src/tuning/tuning.cpp void report_show_tunables(void) · line 271
Quoted 11 lines
src/tuning/tuning.cpp +0
-5@@ -257,12 +267,7 @@ void report_show_tunables(void) untunable_data[i+1]= string(all_untunables[i]->description()); /* Report Output */ -<<<<<<< HEAD - report.add_div(&div_attr); report.add_title(&title_attr,__("Untunable Software Issues")); -======= - report.add_title(&title_attr,"Untunable Software Issues"); ->>>>>>> 4d9b82e... report-html: fixed not hidding sections errors report.add_table(untunable_data, &tune_table_css);
Here is some garbage after merge.
Quoted 2 lines
src/tuning/tuning.cpp +0
-0/* Third Table */
Signature · 9 lines
Best regards, Igor Zhbanov, Expert Software Engineer, phone: +7 (495) 797 25 00 ext 3981 e-mail: i.zhbanov(a)samsung.com Mobile group, Moscow R&D center, Samsung Electronics 12 Dvintsev street, building 1 127018, Moscow, Russian Federation
Alexandra Yates
PATCH v2 26/31 report: design batery discharge/system baseline
In reply to Alexandra YatesRedesigns the header section on Device Power Report to include the battery discharge report and system baseline power, while preserving the translation macros.
--- src/devices/device.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
src/devices/device.cpp +23 -1
@@ -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
Alexandra Yates
PATCH v2 27/31 report: conditional runs ncurses & cpu html report
In reply to Alexandra YatesAdds 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.
--- src/main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
src/main.cpp +4 -3
@@ -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
Alexandra Yates
PATCH v2 28/31 report: logo size & menu compatibility
In reply to Alexandra YatesFixed 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.
--- src/powertop.css | 5 +++-- src/report/report-formatter-html.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
src/powertop.css +3 -2
@@ -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
@@ -518,7 +518,7 @@ report_formatter_html::add_title(struct tag_attr *title_att, const char *title) void report_formatter_html::add_navigation() { - add_exact("<br/><nav id=\"main_menu\"> </nav>\n"); + add_exact("<br/><div id=\"main_menu\"> </div>\n"); } void
Signature · 1 line
1.7.9.5
Alexandra Yates
PATCH v2 29/31 tunables: removed on-demand cpu frequency governor
In reply to Alexandra YatesRemove 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.
--- 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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 30/31 report-cleanup: removed old table, row, & cell.
In reply to Alexandra YatesThe 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
Alexandra Yates
PATCH v2 31/31 report-cleanup: removed html & csv old methods
In reply to Alexandra YatesRemoved 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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